Skip to content

Commit

Permalink
Minor refactors (#27)
Browse files Browse the repository at this point in the history
* removed TestReportItemOutputConsumer added incomplete test for ReportsTestPluginFactory

* Completed test of ReportsTestPluginFactory

* Completed test of ReportsTestPluginFactory

* Documented test of ReportsTestPluginFactory

---------

Co-authored-by: Shawn <[email protected]>
  • Loading branch information
shawnhatch and humbledaisy authored Feb 5, 2023
1 parent 0e9ae8d commit 425b29e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 233 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package plugins.reports.testsupport;

import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.function.Consumer;

import org.junit.jupiter.api.Test;

import nucleus.Plugin;
import nucleus.Simulation;
import tools.annotations.UnitTestMethod;
import util.wrappers.MutableBoolean;

public class AT_ReportsTestPluginFactory {

@Test
@UnitTestMethod(target = ReportsTestPluginFactory.class, name = "getPluginFromReport", args = { Consumer.class })
public void testGetPluginFromReport() {

/*
* Create a boolean defaulted to false.
*/
MutableBoolean executed = new MutableBoolean();

/*
* Create a report and get the corresponding plugin. if the report was
* added then it should get executed by a simulation and the boolean
* will be set to true.
*/
Plugin plugin = ReportsTestPluginFactory.getPluginFromReport((c) -> executed.setValue(true));

/*
* Execute a simulation with the plugin.
*/
Simulation.builder().addPlugin(plugin).build().execute();

/*
* Show that the report executed and thus must have been properly added
* to the plugin.
*/
assertTrue(executed.getValue());
}

}

This file was deleted.

0 comments on commit 425b29e

Please sign in to comment.