本文整理了Java中org.easymock.classextension.EasyMock.expectLastCall()
方法的一些代码示例,展示了EasyMock.expectLastCall()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EasyMock.expectLastCall()
方法的具体详情如下:
包路径:org.easymock.classextension.EasyMock
类名称:EasyMock
方法名:expectLastCall
暂无
代码示例来源: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 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 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: geotools/geotools
@Test
public void testDefaultTimeouts() throws Exception {
reset(conn);
{
conn.setConnectTimeout(HTTPURIHandler.DEFAULT_CONNECTION_TIMEOUT);
expectLastCall();
conn.setReadTimeout(HTTPURIHandler.DEFAULT_READ_TIMEOUT);
expectLastCall();
expect(conn.getInputStream()).andStubReturn(is);
}
replay(conn);
URI uri = URI.createURI("http://example.com");
handler.createInputStream(uri, Collections.EMPTY_MAP);
}
代码示例来源:origin: geotools/geotools
@Test
public void testCustomConnectTimeout() throws Exception {
final int testValue = 42;
reset(conn);
{
conn.setConnectTimeout(testValue);
expectLastCall();
conn.setReadTimeout(HTTPURIHandler.DEFAULT_READ_TIMEOUT);
expectLastCall();
expect(conn.getInputStream()).andReturn(is);
}
replay(conn);
handler.setConnectionTimeout(testValue);
URI uri = URI.createURI("http://example.com");
handler.createInputStream(uri, Collections.EMPTY_MAP);
}
代码示例来源:origin: geotools/geotools
@Test
public void testCustomReadTimeout() throws Exception {
final int testValue = 42;
reset(conn);
{
conn.setConnectTimeout(HTTPURIHandler.DEFAULT_CONNECTION_TIMEOUT);
expectLastCall();
conn.setReadTimeout(testValue);
expectLastCall();
expect(conn.getInputStream()).andStubReturn(is);
}
replay(conn);
handler.setReadTimeout(testValue);
URI uri = URI.createURI("http://example.com");
handler.createInputStream(uri, Collections.EMPTY_MAP);
}
代码示例来源:origin: geotools/geotools
@Test
public void testTimeout() throws Exception {
reset(conn);
{
conn.setConnectTimeout(anyInt());
expectLastCall();
conn.setReadTimeout(anyInt());
expectLastCall();
expect(conn.getInputStream()).andThrow(new IOException());
}
replay(conn);
URI uri = URI.createURI("http://example.com");
exception.expect(IOException.class);
handler.createInputStream(uri, Collections.EMPTY_MAP);
}
}
代码示例来源:origin: org.powermock.api/powermock-api-easymock
/**
* This method just delegates to EasyMock class extensions
* {@link org.easymock.classextension.EasyMock#expectLastCall()} method.
*
* @see org.easymock.classextension.EasyMock#expectLastCall()
*
* @return The expectation setter.
*/
public static synchronized IExpectationSetters<Object> expectLastCall() {
return org.easymock.classextension.EasyMock.expectLastCall();
}
代码示例来源:origin: geotools/geotools
@Before
public void setUp() throws Exception {
conn = createMock(HttpURLConnection.class);
is = createMock(InputStream.class);
conn.setConnectTimeout(anyInt());
expectLastCall().asStub();
conn.setReadTimeout(anyInt());
expectLastCall().asStub();
expect(conn.getInputStream()).andStubReturn(is);
handler =
new HTTPURIHandler() {
@Override
protected HttpURLConnection getConnection(URI uri) throws IOException {
// TODO Auto-generated method stub
return conn;
}
};
replay(conn, is);
}
代码示例来源:origin: org.powermock.api/powermock-api-easymock
@SuppressWarnings("unchecked")
private static <T> IExpectationSetters<T> doExpectPrivate(Object instance, Method methodToExpect, Object... arguments) throws Exception {
WhiteboxImpl.performMethodInvocation(instance, methodToExpect, arguments);
return (IExpectationSetters<T>) org.easymock.classextension.EasyMock.expectLastCall();
}
代码示例来源:origin: org.geoserver/gs-kml
void dispatch(String path, String q, Catalog cat) throws Exception {
HttpServletRequest req = createNiceMock(HttpServletRequest.class);
expect(req.getPathInfo()).andReturn(path);
expect(req.getQueryString()).andReturn(q);
ServletOutputStream out = createNiceMock(ServletOutputStream.class);
HttpServletResponse res = createMock(HttpServletResponse.class);
expect(res.getOutputStream()).andReturn(out).anyTimes();
res.setContentType("image/png");
expectLastCall();
replay(req, res, out);
IconService service = new IconService(cat);
service.handleRequestInternal(req, res);
verify(cat);
verify(res);
}
}
代码示例来源:origin: org.geoserver.community/gs-jdbcstore
JDBCResourceStoreProperties getConfig(boolean enabled, boolean init) {
JDBCResourceStoreProperties config = createMock(JDBCResourceStoreProperties.class);
expect(config.isInitDb()).andStubReturn(init);
expect(config.isEnabled()).andStubReturn(enabled);
expect(config.isImport()).andStubReturn(init);
expect(config.getIgnoreDirs()).andStubReturn(new String[] {"DirIgnore"});
config.setInitDb(false);
expectLastCall();
try {
config.save();
} catch (Exception e) {
}
expectLastCall();
support.stubConfig(config);
replay(config);
return config;
}
内容来源于网络,如有侵权,请联系作者删除!