@Test(expected = ServiceConfigurationError.class) public void testCreateBadConfig() { @SuppressWarnings("unchecked") ServiceRegistry registry = new ServiceRegistry(Arrays.asList(BadSPI.class).iterator()); registry.registerApplicationClasspathSPIs(); // DONE: Test non-class // TODO: Test class not implementing SPI category // TODO: Test class that throws exception in constructor // TODO: Test class that has no public no-args constructor // TODO: Test IOException // Some of these can be tested using stubs, via the package protected registerSPIs method }
); testRegistry.registerApplicationClasspathSPIs();
@Test public void testCreateEmptyIterator() { // A completely useless registry... ServiceRegistry registry = new ServiceRegistry(Collections.<Class<?>>emptyList().iterator()); registry.registerApplicationClasspathSPIs(); while (registry.categories().hasNext()) { fail("No categories"); } }
@Test(expected = ServiceConfigurationError.class) public void testCreateBadConfig() { @SuppressWarnings("unchecked") ServiceRegistry registry = new ServiceRegistry(Arrays.asList(BadSPI.class).iterator()); registry.registerApplicationClasspathSPIs(); // DONE: Test non-class // TODO: Test class not implementing SPI category // TODO: Test class that throws exception in constructor // TODO: Test class that has no public no-args constructor // TODO: Test IOException // Some of these can be tested using stubs, via the package protected registerSPIs method }
@Test(expected = ServiceConfigurationError.class) public void testCreateBadConfig() { @SuppressWarnings("unchecked") ServiceRegistry registry = new ServiceRegistry(Arrays.asList(BadSPI.class).iterator()); registry.registerApplicationClasspathSPIs(); // DONE: Test non-class // TODO: Test class not implementing SPI category // TODO: Test class that throws exception in constructor // TODO: Test class that has no public no-args constructor // TODO: Test IOException // Some of these can be tested using stubs, via the package protected registerSPIs method }
); testRegistry.registerApplicationClasspathSPIs();
); testRegistry.registerApplicationClasspathSPIs();
); testRegistry.registerApplicationClasspathSPIs();
@Test public void testCreateEmptyIterator() { // A completely useless registry... ServiceRegistry registry = new ServiceRegistry(Collections.<Class<?>>emptyList().iterator()); registry.registerApplicationClasspathSPIs(); while (registry.categories().hasNext()) { fail("No categories"); } }
@Test public void testCreateEmptyIterator() { // A completely useless registry... ServiceRegistry registry = new ServiceRegistry(Collections.<Class<?>>emptyList().iterator()); registry.registerApplicationClasspathSPIs(); while (registry.categories().hasNext()) { fail("No categories"); } }