org.easymock.classextension.EasyMock.reset()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.easymock.classextension.EasyMock.reset()方法的一些代码示例,展示了EasyMock.reset()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EasyMock.reset()方法的具体详情如下:
包路径:org.easymock.classextension.EasyMock
类名称:EasyMock
方法名:reset

EasyMock.reset介绍

暂无

代码示例

代码示例来源:origin: geoserver/geoserver

@Override
  public Void answer() throws Throwable {
    verify(log);
    reset(log);
    log.removeHandler(handlerCap.getValue());
    expectLastCall().once();
    log.setLevel(Level.OFF);
    expectLastCall().once();
    replay(log);
    throw ex;
  }
});

代码示例来源:origin: geoserver/geoserver

@Override
  public Void answer() throws Throwable {
    verify(log);
    reset(log);
    log.removeHandler(handlerCap.getValue());
    expectLastCall().once();
    log.setLevel(Level.OFF);
    expectLastCall().once();
    replay(log);
    return null;
  }
});

代码示例来源:origin: geoserver/geoserver

@Override
  public Void answer() throws Throwable {
    verify(log);
    reset(log);
    log.removeHandler(handlerCap.getValue());
    expectLastCall().once();
    log.setLevel(Level.OFF);
    expectLastCall().once();
    handlerCap.getValue().publish(record);
    assertThat(
        ((LoggerRule) handlerCap.getValue()).records(),
        contains(record));
    replay(log);
    return null;
  }
});

代码示例来源:origin: geoserver/geoserver

@Override
  public Void answer() throws Throwable {
    verify(log);
    reset(log);
    log.removeHandler(handlerCap.getValue());
    expectLastCall().once();
    log.setLevel(Level.OFF);
    expectLastCall().once();
    replay(log);
    handlerCap.getValue().publish(record);
    ((LoggerRule) handlerCap.getValue())
        .assertLogged(sameInstance(record));
    return null;
  }
});

代码示例来源:origin: geoserver/geoserver

@Override
  public Void answer() throws Throwable {
    verify(log);
    reset(log);
    log.removeHandler(handlerCap.getValue());
    expectLastCall().once();
    log.setLevel(Level.OFF);
    expectLastCall().once();
    replay(log);
    handlerCap.getValue().publish(record);
    ((LoggerRule) handlerCap.getValue())
        .assertLogged(sameInstance(record));
    return null;
  }
});

代码示例来源:origin: geoserver/geoserver

@Override
  public Void answer() throws Throwable {
    verify(log);
    reset(log);
    log.removeHandler(handlerCap.getValue());
    expectLastCall().once();
    log.setLevel(Level.OFF);
    expectLastCall().once();
    replay(log);
    handlerCap.getValue().publish(record);
    ((LoggerRule) handlerCap.getValue())
        .assertLogged(sameInstance(record));
    ((LoggerRule) handlerCap.getValue()).assertLogged(not(anything()));
    return null;
  }
});

代码示例来源:origin: geoserver/geoserver

@Test
public void testRelativeToStore() throws IOException {
  GeoServerDataDirectory dd = createDataDirectoryMock();
  replay(dd);
  GeoServerTemplateLoader tl = new GeoServerTemplateLoader(getClass(), dd);
  Object source = tl.findTemplateSource("dummy.ftl");
  assertNull(source);
  reset(dd);
  DataStoreInfo s = createNiceMock(DataStoreInfo.class);
  FeatureTypeInfo ft = createNiceMock(FeatureTypeInfo.class);
  expect(ft.getStore()).andReturn(s).anyTimes();
  tl.setFeatureType(ft);
  replay(ft, s, dd);
  assertNull(tl.findTemplateSource("dummy.ftl"));
  reset(dd);
  expect(dd.findSuppStoreFile(s, "dummy.ftl")).andReturn(new File("foo")).once();
  replay(dd);
  assertNotNull(tl.findTemplateSource("dummy.ftl"));
  verify(dd);
}

代码示例来源:origin: geoserver/geoserver

@Test
public void testRelativeToFeatureType() throws IOException {
  GeoServerDataDirectory dd = createDataDirectoryMock();
  replay(dd);
  GeoServerTemplateLoader tl = new GeoServerTemplateLoader(getClass(), dd);
  Object source = tl.findTemplateSource("dummy.ftl");
  assertNull(source);
  reset(dd);
  FeatureTypeInfo ft = createMock(FeatureTypeInfo.class);
  expect(dd.findSuppResourceFile(ft, "dummy.ftl")).andReturn(new File("foo")).once();
  replay(ft, dd);
  tl.setFeatureType(ft);
  source = tl.findTemplateSource("dummy.ftl");
  assertNotNull(source);
  verify(ft, dd);
}

代码示例来源:origin: geoserver/geoserver

@Test
public void testGlobal() throws IOException {
  GeoServerDataDirectory dd = createDataDirectoryMock();
  DataStoreInfo s = createNiceMock(DataStoreInfo.class);
  FeatureTypeInfo ft = createNiceMock(FeatureTypeInfo.class);
  WorkspaceInfo ws = createNiceMock(WorkspaceInfo.class);
  expect(ft.getStore()).andReturn(s).anyTimes();
  expect(s.getWorkspace()).andReturn(ws).anyTimes();
  replay(ft, s, ws, dd);
  GeoServerTemplateLoader tl = new GeoServerTemplateLoader(getClass(), dd);
  tl.setResource(ft);
  assertNull(tl.findTemplateSource("dummy.ftl"));
  reset(dd);
  expect(dd.findSuppWorkspacesFile(ws, "dummy.ftl")).andReturn(new File("foo")).once();
  replay(dd);
  assertNotNull(tl.findTemplateSource("dummy.ftl"));
  verify(dd);
}

代码示例来源:origin: geoserver/geoserver

@Test
public void testRelativeToWorkspace() throws IOException {
  GeoServerDataDirectory dd = createDataDirectoryMock();
  DataStoreInfo s = createNiceMock(DataStoreInfo.class);
  FeatureTypeInfo ft = createNiceMock(FeatureTypeInfo.class);
  WorkspaceInfo ws = createNiceMock(WorkspaceInfo.class);
  expect(ft.getStore()).andReturn(s).anyTimes();
  expect(s.getWorkspace()).andReturn(ws).anyTimes();
  replay(ft, s, ws, dd);
  GeoServerTemplateLoader tl = new GeoServerTemplateLoader(getClass(), dd);
  tl.setFeatureType(ft);
  Object source = tl.findTemplateSource("dummy.ftl");
  assertNull(source);
  reset(dd);
  expect(dd.findSuppWorkspaceFile(ws, "dummy.ftl")).andReturn(new File("foo")).once();
  replay(dd);
  assertNotNull(tl.findTemplateSource("dummy.ftl"));
  verify(dd);
}

代码示例来源:origin: geoserver/geoserver

@Test
public void testResolveWithProperty() {
  CacheProvider testCacheProvider1 = addMockProvider("testCacheProvider1");
  CacheProvider testCacheProvider2 = addMockProvider("testCacheProvider2");
  // Test that the bean specified in the property is used
  extensions.property(DefaultCacheProvider.BEAN_NAME_PROPERTY, "testCacheProvider1");
  replay(testCacheProvider1, testCacheProvider2);
  CacheProvider provider = DefaultCacheProvider.findProvider();
  assertThat(provider, sameInstance(testCacheProvider1));
  verify(testCacheProvider1, testCacheProvider2);
  // Retry with the property changed to ensure we weren't jsut lucky before
  reset(testCacheProvider1, testCacheProvider2);
  extensions.property(DefaultCacheProvider.BEAN_NAME_PROPERTY, "testCacheProvider2");
  replay(testCacheProvider1, testCacheProvider2);
  provider = DefaultCacheProvider.findProvider();
  assertThat(provider, sameInstance(testCacheProvider2));
  verify(testCacheProvider1, testCacheProvider2);
}

代码示例来源: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 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 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: com.googlecode.junice/junice

/**
 * {@inheritDoc}
 */
public void resetMock(Object... objects) {
  EasyMock.reset(objects);
}

代码示例来源:origin: org.powermock.api/powermock-api-easymock

/**
   * {@inheritDoc}
   */
  public synchronized Object reset(Object... mocks) {
    EasyMock.reset(substitute);
    hasReplayed = false;
    hasVerified = false;
    return null;
  }
}

代码示例来源: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.geoserver/gs-wfs

@SuppressWarnings("deprecation")
protected void setProxyBase(String url) {
  reset(config);
  {
    expect(config.getProxyBaseUrl()).andStubReturn(url);
  }
  replay(config);
}

代码示例来源:origin: org.geoserver/gs-platform

@Override
  public Void answer() throws Throwable {
    verify(log);
    reset(log);
    log.removeHandler(handlerCap.getValue());
    expectLastCall().once();
    log.setLevel(Level.OFF);
    expectLastCall().once();
    replay(log);
    throw ex;
  }
});

代码示例来源:origin: org.geoserver/gs-platform

@Override
  public Void answer() throws Throwable {
    verify(log);
    reset(log);
    log.removeHandler(handlerCap.getValue());
    expectLastCall().once();
    log.setLevel(Level.OFF);
    expectLastCall().once();
    replay(log);
    return null;
  }
});

相关文章