@Test
@SuppressWarnings({"squid:S2112", "unchecked"})

public void testUpdate() {
    // Mock class loader
    final Set<URL> resources = new HashSet<>();
    final URLClassLoader classLoader = new URLClassLoader(new URL[0]) {
        @Override
        public Enumeration<URL> findResources(final String name) {
            return Collections.enumeration(resources);
        }
    };
    // Test with no services
    final IsolatedServiceLoader<FileSystem> loader = new IsolatedServiceLoader<>(FileSystem.class, classLoader);
    boolean result = loader.update();
    Assert.assertFalse(result);
    Assert.assertEquals(0, Iterables.size(loader));
    // Test with new services
    resources.add(getClass().getResource("file-system-services-1.txt"));
    result = loader.update();
    Assert.assertTrue(result);
    Assert.assertEquals(1, Iterables.size(loader));
    Assert.assertThat(loader, CoreMatchers.hasItem(CoreMatchers.<FileSystem>instanceOf(MockFileSystem.class)));
    // Test with existing services
    result = loader.update();
    Assert.assertFalse(result);
    Assert.assertEquals(1, Iterables.size(loader));
    Assert.assertThat(loader, CoreMatchers.hasItem(CoreMatchers.<FileSystem>instanceOf(MockFileSystem.class)));
    // Test with adding services
    resources.add(getClass().getResource("file-system-services-2.txt"));
    result = loader.update();
    Assert.assertTrue(result);
    Assert.assertEquals(2, Iterables.size(loader));
    Matcher[] matchers = new Matcher[] {CoreMatchers.instanceOf(MockFileSystem.class), CoreMatchers.instanceOf(LocalFileSystem.class)};
    Assert.assertThat(loader, CoreMatchers.hasItems(matchers));
}