org.apache.lucene.util.SetOnce.AlreadySetException的实例源码

项目:search    文件TestIndexWriterConfig.java   
@Test
public void testReuse() throws Exception {
  Directory dir = newDirectory();
  // test that IWC cannot be reused across two IWs
  IndexWriterConfig conf = newIndexWriterConfig(null);
  new RandomIndexWriter(random(),dir,conf).close();

  // this should fail
  try {
    assertNotNull(new RandomIndexWriter(random(),conf));
    fail("should have hit AlreadySetException");
  } catch (AlreadySetException e) {
    // expected
  }

  dir.close();
}
项目:elasticsearch_my    文件IndexModuleTests.java   
public void testForceCustomQueryCache() throws IOException {
    Settings indexSettings = Settings.builder()
            .put(Environment.PATH_HOME_SETTING.getKey(),createTempDir().toString())
            .put(IndexMetaData.SETTING_VERSION_CREATED,Version.CURRENT).build();
    IndexModule module = new IndexModule(IndexSettingsModule.newIndexSettings("foo",indexSettings),new AnalysisRegistry(environment,emptyMap(),emptyMap()));
    module.forceQueryCacheProvider((a,b) -> new CustomQueryCache());
    expectThrows(AlreadySetException.class,() -> module.forceQueryCacheProvider((a,b) -> new CustomQueryCache()));
    IndexService indexService = newIndexService(module);
    assertTrue(indexService.cache().query() instanceof CustomQueryCache);
    indexService.close("simon says",false);
}
项目:search    文件TestSetonce.java   
@Test(expected=AlreadySetException.class)
public void testSetonce() throws Exception {
  Setonce<Integer> set = new Setonce<>();
  set.set(new Integer(5));
  assertEquals(5,set.get().intValue());
  set.set(new Integer(7));
}
项目:NYBC    文件TestSetonce.java   
@Test(expected=AlreadySetException.class)
public void testSetonce() throws Exception {
  Setonce<Integer> set = new Setonce<Integer>();
  set.set(new Integer(5));
  assertEquals(5,set.get().intValue());
  set.set(new Integer(7));
}
项目:Maskana-Gestor-de-Conocimiento    文件TestSetonce.java   
@Test(expected=AlreadySetException.class)
public void testSetonce() throws Exception {
  Setonce<Integer> set = new Setonce<Integer>();
  set.set(new Integer(5));
  assertEquals(5,set.get().intValue());
  set.set(new Integer(7));
}
项目:search    文件TestSetonce.java   
@Test(expected=AlreadySetException.class)
public void testSettingCtor() throws Exception {
  Setonce<Integer> set = new Setonce<>(new Integer(5));
  assertEquals(5,set.get().intValue());
  set.set(new Integer(7));
}
项目:NYBC    文件TestSetonce.java   
@Test(expected=AlreadySetException.class)
public void testSettingCtor() throws Exception {
  Setonce<Integer> set = new Setonce<Integer>(new Integer(5));
  assertEquals(5,set.get().intValue());
  set.set(new Integer(7));
}
项目:Maskana-Gestor-de-Conocimiento    文件TestSetonce.java   
@Test(expected=AlreadySetException.class)
public void testSettingCtor() throws Exception {
  Setonce<Integer> set = new Setonce<Integer>(new Integer(5));
  assertEquals(5,set.get().intValue());
  set.set(new Integer(7));
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...