DefaultPluginContext implements PluginContext { @Override public <T> void addPlugin(T plugin) { Objects.requireNonNull(plugin, "Plugin to register cannot be null"); final String name = AnnotationProcessor.getPluginName(plugin); addPlugin(name, plugin); } DefaultPluginContext();  DefaultPluginContext(Map<String, Object> registry); @Override @Nullable T getPlugin(String pluginName); @Override @Nullable T getPlugin(Class<T> pluginClass); @Override Collection<PluginRef> getAllPlugins(); @Override void addPlugin(T plugin); @Override void addPlugin(String name, T plugin); @Override @Nullable T removePlugin(T plugin); @Override @Nullable T removePlugin(String pluginName); @Override boolean hasPlugin(String pluginName); @Override boolean hasPlugin(Class<T> pluginClass);  }
@Test public void shouldAddAPlugin() { context.addPlugin(plugin); assertTrue(registry.containsKey("test")); final Object test = registry.get("test"); assertEquals(plugin, test); }