Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Spotbugs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vigyasharma committed Jul 29, 2020
1 parent 7b6e95f commit 4070fb3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public PluginController(PluginControllerConfig pluginConfig, Publisher publisher
this.pluginControllerConfig = pluginConfig;
this.publisher = publisher;
this.plugins = new ArrayList<>();
}

public void initPlugins() {
loadFrameworkPlugins();
registerActionListeners();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public void construct() {
// TODO: Refactor using DI to move out of construct method
PluginControllerConfig pluginControllerConfig = new PluginControllerConfig();
PluginController pluginController = new PluginController(pluginControllerConfig, publisher);
pluginController.initPlugins();
}

private void constructShardResourceUsageGraph() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void testInit() {
Mockito.when(pluginControllerConfig.getFrameworkPlugins()).thenReturn(frameworkPlugins);
Publisher publisher = Mockito.mock(Publisher.class);
PluginController pluginController = new PluginController(pluginControllerConfig, publisher);
pluginController.initPlugins();

List<Plugin> plugins = pluginController.getPlugins();
assertEquals(2, plugins.size());
Expand All @@ -58,6 +59,7 @@ public void testPrivateConstructorPlugin() {
Mockito.when(pluginControllerConfig.getFrameworkPlugins()).thenReturn(frameworkPlugins);
Publisher publisher = Mockito.mock(Publisher.class);
PluginController pluginController = new PluginController(pluginControllerConfig, publisher);
pluginController.initPlugins();
}

@Test(expected = IllegalStateException.class)
Expand All @@ -69,6 +71,7 @@ public void testMultiConstructorPlugin() {
Mockito.when(pluginControllerConfig.getFrameworkPlugins()).thenReturn(frameworkPlugins);
Publisher publisher = Mockito.mock(Publisher.class);
PluginController pluginController = new PluginController(pluginControllerConfig, publisher);
pluginController.initPlugins();
}

@Test(expected = IllegalStateException.class)
Expand All @@ -80,6 +83,7 @@ public void testNonDefaultConstructorPlugin() {
Mockito.when(pluginControllerConfig.getFrameworkPlugins()).thenReturn(frameworkPlugins);
Publisher publisher = Mockito.mock(Publisher.class);
PluginController pluginController = new PluginController(pluginControllerConfig, publisher);
pluginController.initPlugins();
}

public static class TestActionListener extends Plugin implements ActionListener {
Expand Down

0 comments on commit 4070fb3

Please sign in to comment.