@Test
public void testLoad() throws Exception {

    final String PLUGIN_NAME = "plugin-name";
    final String PLUGIN_VERSION = "plugin-version";
    Manifest manifest = createTestLoadManifest(PLUGIN_NAME, PLUGIN_VERSION);
    Path tempDirectory = temporaryDirectory.getDirectory(); //Can't use in-memory filesystems (e.g. Google JimFS) here because they don't support java.net.URL for class loader
    assertNotNull(tempDirectory);
    assertTrue(Files.exists(tempDirectory));
    JarHelper.createTestPluginFile(
            "some-plugin",
            tempDirectory,
            Optional.of(manifest)
    );
    PluginRegistry pluginRegistry = PluginLoader
            .withPluginDirectory(tempDirectory)
            .withExtensionPoints(TestExtensionPoint.class, TestAnnotation.class)
            .withResourcesPatterns("glob:**/*.resource")
            .load();
    assertThat(pluginRegistry.getPluginNames(), hasSize(1));
    assertThat(pluginRegistry.getPluginNames(), contains(PLUGIN_NAME));
    assertTrue(pluginRegistry.getPlugin(PLUGIN_NAME).isPresent());
    assertThat(pluginRegistry.getPlugin(PLUGIN_NAME).get().getVersion(), equalTo(PLUGIN_VERSION));
    assertThat(pluginRegistry.getExtensionPoints(), hasSize(2));
    assertThat(pluginRegistry.getExtensionPoints(), containsInAnyOrder(TestExtensionPoint.class, TestAnnotation.class));
    assertThat(pluginRegistry.getImplementations(TestAnnotation.class), hasSize(1));
    assertThat(pluginRegistry.getImplementations(TestAnnotation.class), contains(AnnotatedImpl.class));
    assertThat(pluginRegistry.getImplementations(TestExtensionPoint.class), hasSize(1));
    assertThat(pluginRegistry.getImplementations(TestExtensionPoint.class), contains(TestExtensionPointImpl.class));
    assertThat(pluginRegistry.getResources(), hasSize(1));
    assertThat(pluginRegistry.getResources("missing-plugin"), hasSize(0));
    assertThat(pluginRegistry.getResources(PLUGIN_NAME), hasSize(1));
    Path resourcePath = pluginRegistry.getResources(PLUGIN_NAME).get(0);
    assertTrue(resourcePath.endsWith(JarHelper.TEST_RESOURCE_NAME));
    assertTrue(pluginRegistry.getClassLoader(PLUGIN_NAME).isPresent());
    assertFalse(pluginRegistry.getClassLoader("missing-plugin").isPresent());
    try (InputStream inputStream = Files.newInputStream(resourcePath)) {
        assertNotNull(inputStream); //We should be able to open resource
    }
}