本文整理了Java中org.easymock.classextension.EasyMock.anyObject()
方法的一些代码示例,展示了EasyMock.anyObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EasyMock.anyObject()
方法的具体详情如下:
包路径:org.easymock.classextension.EasyMock
类名称:EasyMock
方法名:anyObject
暂无
代码示例来源:origin: geoserver/geoserver
expect(reader.getFormat()).andReturn(format).anyTimes();
expect(reader.getGridCoverageCount()).andReturn(1);
expect(reader.getOriginalGridToWorld(EasyMock.anyObject(PixelInCell.class)))
.andReturn(new AffineTransform2D(gridToWorld))
.anyTimes();
expect(reader.read(EasyMock.anyObject(GeneralParameterValue[].class))).andReturn(null);
expect(reader.getGridCoverageNames()).andReturn(new String[] {"TheCoverage"});
replay(reader);
expect(format.getReader(EasyMock.eq(rasterSource), EasyMock.anyObject(Hints.class)))
.andReturn(reader)
.anyTimes();
代码示例来源:origin: geoserver/geoserver
@Test
public void testChangeNamespace() {
Catalog cat = createMock(Catalog.class);
cat.addListener((CatalogListener) anyObject());
expectLastCall();
WorkspaceInfo ws = createMock(WorkspaceInfo.class);
ws.setName("abcd");
expectLastCall();
expect(cat.getWorkspaceByName("gs")).andReturn(ws);
cat.save(ws);
expectLastCall();
NamespaceInfo ns = createNiceMock(NamespaceInfo.class);
CatalogModifyEvent e = createNiceMock(CatalogModifyEvent.class);
expect(e.getSource()).andReturn(ns).anyTimes();
expect(e.getPropertyNames()).andReturn(Arrays.asList("prefix"));
expect(e.getOldValues()).andReturn((List) Arrays.asList("gs"));
expect(e.getNewValues()).andReturn((List) Arrays.asList("abcd"));
replay(e, ws, ns, cat);
new NamespaceWorkspaceConsistencyListener(cat).handleModifyEvent(e);
verify(ws, cat);
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testChangeWorkspace() {
Catalog cat = createMock(Catalog.class);
cat.addListener((CatalogListener) anyObject());
expectLastCall();
NamespaceInfo ns = createMock(NamespaceInfo.class);
ns.setPrefix("abcd");
expectLastCall();
expect(cat.getNamespaceByPrefix("gs")).andReturn(ns);
cat.save(ns);
expectLastCall();
WorkspaceInfo ws = createNiceMock(WorkspaceInfo.class);
CatalogModifyEvent e = createNiceMock(CatalogModifyEvent.class);
expect(e.getSource()).andReturn(ws).anyTimes();
expect(e.getPropertyNames()).andReturn(Arrays.asList("name"));
expect(e.getOldValues()).andReturn((List) Arrays.asList("gs"));
expect(e.getNewValues()).andReturn((List) Arrays.asList("abcd"));
replay(e, ws, ns, cat);
new NamespaceWorkspaceConsistencyListener(cat).handleModifyEvent(e);
verify(ns, cat);
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testChangeDefaultWorkspace() {
Catalog cat = createMock(Catalog.class);
cat.addListener((CatalogListener) anyObject());
expectLastCall();
NamespaceInfo def = createNiceMock(NamespaceInfo.class);
expect(cat.getDefaultNamespace()).andReturn(def);
NamespaceInfo ns = createNiceMock(NamespaceInfo.class);
expect(cat.getNamespaceByPrefix("abcd")).andReturn(ns);
cat.setDefaultNamespace(ns);
expectLastCall();
WorkspaceInfo ws = createNiceMock(WorkspaceInfo.class);
expect(ws.getName()).andReturn("abcd");
CatalogModifyEvent e = createNiceMock(CatalogModifyEvent.class);
expect(e.getSource()).andReturn(cat).anyTimes();
expect(e.getPropertyNames()).andReturn(Arrays.asList("defaultWorkspace"));
expect(e.getNewValues()).andReturn((List) Arrays.asList(ws));
replay(ns, ws, e, cat);
new NamespaceWorkspaceConsistencyListener(cat).handleModifyEvent(e);
verify(ns, ws, cat);
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testChangeDefaultNamespace() {
Catalog cat = createMock(Catalog.class);
cat.addListener((CatalogListener) anyObject());
expectLastCall();
WorkspaceInfo def = createNiceMock(WorkspaceInfo.class);
expect(cat.getDefaultWorkspace()).andReturn(def);
WorkspaceInfo ws = createNiceMock(WorkspaceInfo.class);
expect(cat.getWorkspaceByName("abcd")).andReturn(ws);
cat.setDefaultWorkspace(ws);
expectLastCall();
NamespaceInfo ns = createNiceMock(NamespaceInfo.class);
expect(ns.getPrefix()).andReturn("abcd");
CatalogModifyEvent e = createNiceMock(CatalogModifyEvent.class);
expect(e.getSource()).andReturn(cat).anyTimes();
expect(e.getPropertyNames()).andReturn(Arrays.asList("defaultNamespace"));
expect(e.getNewValues()).andReturn((List) Arrays.asList(ns));
replay(ns, ws, e, cat);
new NamespaceWorkspaceConsistencyListener(cat).handleModifyEvent(e);
verify(ns, ws, cat);
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testChangeNamespaceURI() {
Catalog cat = createMock(Catalog.class);
cat.addListener((CatalogListener) anyObject());
expectLastCall();
NamespaceInfo ns = createNiceMock(NamespaceInfo.class);
expect(ns.getPrefix()).andReturn("foo");
expect(ns.getURI()).andReturn("http://foo.org");
WorkspaceInfo ws = createNiceMock(WorkspaceInfo.class);
expect(cat.getWorkspaceByName("foo")).andReturn(ws);
DataStoreInfo ds = createNiceMock(DataStoreInfo.class);
expect(cat.getDataStoresByWorkspace(ws)).andReturn(Arrays.asList(ds));
HashMap params = new HashMap();
params.put("namespace", "http://bar.org");
expect(ds.getConnectionParameters()).andReturn(params).anyTimes();
cat.save(hasNamespace("http://foo.org"));
expectLastCall();
CatalogPostModifyEvent e = createNiceMock(CatalogPostModifyEvent.class);
expect(e.getSource()).andReturn(ns).anyTimes();
expect(ns.getPrefix()).andReturn("foo");
expect(cat.getWorkspaceByName("foo")).andReturn(ws);
replay(ds, ws, ns, e, cat);
new NamespaceWorkspaceConsistencyListener(cat).handlePostModifyEvent(e);
verify(cat);
}
代码示例来源:origin: info.magnolia/magnolia-module-templating
expect(servletContext.getResourceAsStream((String) anyObject())).andStubAnswer(new IAnswer<InputStream>() {
expect(servletContext.getResource((String) anyObject())).andStubAnswer(new IAnswer<URL>() {
代码示例来源:origin: org.geoserver/gs-wms
@Test
public void testInputStream() throws Exception {
InputStream stream = createMock(InputStream.class);
expect(stream.read((byte[]) anyObject())).andReturn(-1).once();
replay(stream);
WMSMapContent map = createNiceMock(WMSMapContent.class);
replay(map);
new RawMap(map, stream, "text/plain").writeTo(null);
verify(stream);
}
}
代码示例来源:origin: org.geoserver.community/gs-jdbcstore
@Override
public void stubConfig(JDBCResourceStoreProperties config) {
expect(config.getInitScript())
.andStubReturn(
URIs.asResource(
JDBCResourceStoreProperties.class.getResource("init.h2.sql")));
expect(config.getJdbcUrl()).andStubReturn(Optional.of("jdbc:h2:mem:test"));
expect(config.getJndiName()).andStubReturn(Optional.<String>absent());
expect(config.getProperty(eq("driverClassName"))).andStubReturn("org.h2.Driver");
expect(config.getProperty(eq("driverClassName"), (String) anyObject()))
.andStubReturn("org.h2.Driver");
}
代码示例来源:origin: info.magnolia/magnolia-module-templating
private void setUpManagers() {
expect(paragraphRendererManager.getRenderer((String) anyObject())).andStubAnswer(new IAnswer<ParagraphRenderer>() {
expect(templateRendererManager.getRenderer((String) anyObject())).andStubAnswer(new IAnswer<TemplateRenderer>() {
expect(paragraphManager.getParagraphDefinition((String) anyObject())).andStubAnswer(new IAnswer<Paragraph>() {
expect(templateManager.getTemplateDefinition((String) anyObject())).andStubAnswer(new IAnswer<Template>() {
代码示例来源:origin: org.geoserver.community/gs-jdbcstore
@Override
public void stubConfig(JDBCResourceStoreProperties config) {
expect(config.getInitScript())
.andStubReturn(
URIs.asResource(
JDBCResourceStoreProperties.class.getResource(
"init.postgres.sql")));
expect(config.getJdbcUrl())
.andStubReturn(Optional.of("jdbc:postgresql://localhost:5432/jdbcstoretest"));
expect(config.getJndiName()).andStubReturn(Optional.<String>absent());
expect(config.getProperty(eq("username"))).andStubReturn("jdbcstore");
expect(config.getProperty(eq("username"), (String) anyObject())).andStubReturn("jdbcstore");
expect(config.getProperty(eq("password"))).andStubReturn("jdbcstore");
expect(config.getProperty(eq("password"), (String) anyObject())).andStubReturn("jdbcstore");
expect(config.getProperty(eq("driverClassName"))).andStubReturn("org.postgresql.Driver");
expect(config.getProperty(eq("driverClassName"), (String) anyObject()))
.andStubReturn("org.postgresql.Driver");
}
内容来源于网络,如有侵权,请联系作者删除!