/** * Tests that the set with the names of the initializers cannot be modified. * * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test(expected = UnsupportedOperationException.class) public void testResultInitializerNamesModify() throws ConcurrentException { checkInitialize(); final MultiBackgroundInitializer.MultiBackgroundInitializerResults res = initializer .get(); final Iterator<String> it = res.initializerNames().iterator(); it.next(); it.remove(); }
/** * Tests the background processing if there are no child initializers. * * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeNoChildren() throws ConcurrentException { assertTrue("Wrong result of start()", initializer.start()); final MultiBackgroundInitializer.MultiBackgroundInitializerResults res = initializer .get(); assertTrue("Got child initializers", res.initializerNames().isEmpty()); assertTrue("Executor not shutdown", initializer.getActiveExecutor() .isShutdown()); }
.get(); assertEquals("Wrong number of child initializers", count, res .initializerNames().size()); for (int i = 0; i < count; i++) { final String key = CHILD_INIT + i; assertTrue("Name not found: " + key, res.initializerNames() .contains(key)); assertEquals("Wrong result object", Integer.valueOf(1), res
.getResultObject(nameMulti); assertEquals("Wrong number of initializers", count, res2 .initializerNames().size()); for (int i = 0; i < count; i++) { checkChild(res2.getInitializer(CHILD_INIT + i), exec);