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

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

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

EasyMock.verify介绍

暂无

代码示例

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

public void verify() {
  EasyMock.verify(offerDaoMock);
  EasyMock.verify(offerTimeZoneProcessorMock);
}

代码示例来源: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

@Test
public void testFindInContext() {
  CacheProvider testCacheProvider1 = addMockProvider("testCacheProvider1");
  replay(testCacheProvider1);
  CacheProvider provider = DefaultCacheProvider.findProvider();
  assertThat(provider, sameInstance(testCacheProvider1));
  verify(testCacheProvider1);
}

代码示例来源: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

@Test
public void testDoNothingUntilRun() {
  Logger log = createMock("log", Logger.class);
  Description desc = createMock("desc", Description.class);
  Statement base = createMock("base", Statement.class);
  replay(log, desc, base);
  LoggerRule rule = new LoggerRule(log, Level.FINE);
  rule.apply(base, desc);
  verify(log, desc, base);
}

代码示例来源: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 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 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 testRemoteType() throws Exception {
    SimpleFeatureType ft =
        DataUtilities.createType(
            "remoteType", "the_geom:MultiPolygon,FID:String,ADDRESS:String");

    GeoServerDataDirectory dd = createDataDirectoryMock();
    Catalog cat = createNiceMock(Catalog.class);
    expect(cat.getFeatureTypeByName(ft.getName())).andReturn(null).once();
    replay(dd, cat);

    GeoServerTemplateLoader tl = new GeoServerTemplateLoader(getClass(), dd);
    tl.setCatalog(cat);
    tl.setFeatureType(ft);
    tl.findTemplateSource("header.ftl");

    verify(cat);
  }
}

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

@Test
  public void testPropertyPriority() {
    CacheProvider testCacheProvider3 = addMockProvider("testCacheProvider3");
    CacheProvider testCacheProvider2 = addMockProvider("testCacheProvider2");

    // Test that the bean specified in the property is used

    extensions.property(
        DefaultCacheProvider.BEAN_NAME_PROPERTY,
        "testCacheProvider1,testCacheProvider2,testCacheProvider3");

    replay(testCacheProvider3, testCacheProvider2);

    CacheProvider provider = DefaultCacheProvider.findProvider();

    assertThat(provider, sameInstance(testCacheProvider2));

    verify(testCacheProvider3, testCacheProvider2);
  }
}

代码示例来源: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 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);
}

相关文章