+ * the solution space type
+ * @param
+ * the problem type
+ * @param
+ * the metaheuristic type
+ * @param
+ * the experiment stage type
+ */
+@Ignore
+public abstract class TestExperimentStage,
+ M extends IMetaheuristic,
+ S extends IExperimentStage>
+ extends ObjectTest {
+
+ /** create */
+ protected TestExperimentStage() {
+ super();
+ }
+
+ /**
+ * test the experiment stage via the
+ * {@link IExperimentStage#getProblems()} method
+ */
+ @Test(timeout = 3600000)
+ public void testStage() {
+ final S stage = this.getInstance();
+ Assert.assertNotNull(stage);
+
+ final BlackBoxProcessBuilder builder =
+ new BlackBoxProcessBuilder<>();
+ stage.configureBuilder(builder);
+
+ final Stream> problems = stage.getProblems();
+ Assert.assertNotNull(problems);
+
+ problems.forEach(supplier -> {
+ Assert.assertNotNull(supplier);
+ final P problem = supplier.get();
+ Assert.assertNotNull(problem);
+
+ stage.configureBuilderForProblem(builder, problem);
+
+ TestTools.assertGreater(
+ Experiment.nameFromObjectPrepare(problem).length(), 0);
+ TestTools.assertGreaterOrEqual(problem.upperBound(),
+ problem.lowerBound());
+ final int runs = stage.getRuns(problem);
+ TestTools.assertGreaterOrEqual(runs, 0);
+ if (runs > 0) {
+ final Stream> algorithms =
+ stage.getAlgorithms(problem);
+ Assert.assertNotNull(algorithms);
+ algorithms.forEach((asupplier) -> {
+ Assert.assertNotNull(asupplier);
+ final M algorithm = asupplier.get();
+ Assert.assertNotNull(algorithm);
+ try (final CharArrayWriter caw =
+ new CharArrayWriter()) {
+ algorithm.printSetup(caw);
+ } catch (final Throwable error) {
+ throw new AssertionError(
+ "There should be no error here.", //$NON-NLS-1$
+ error);
+ }
+ });
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void runAllTests() {
+ super.runAllTests();
+ this.testStage();
+ }
+}
diff --git a/src/test/java/aitoa/utils/TestExperimentStages.java b/src/test/java/aitoa/utils/TestExperimentStages.java
new file mode 100644
index 0000000..053b277
--- /dev/null
+++ b/src/test/java/aitoa/utils/TestExperimentStages.java
@@ -0,0 +1,65 @@
+package aitoa.utils;
+
+import java.util.stream.Stream;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import aitoa.ObjectTest;
+import aitoa.structure.IMetaheuristic;
+import aitoa.structure.IObjectiveFunction;
+import aitoa.utils.Experiment.IExperimentStage;
+
+/**
+ * Test a stream of experiment stages
+ *
+ * @param
+ * the search space type
+ * @param
+ * the solution space type
+ * @param
+ * the problem type
+ * @param
+ * the metaheuristic type
+ * @param
+ * the experiment stage type
+ */
+@Ignore
+public abstract class TestExperimentStages,
+ M extends IMetaheuristic,
+ S extends IExperimentStage>
+ extends ObjectTest> {
+
+ /** create */
+ protected TestExperimentStages() {
+ super();
+ }
+
+ /**
+ * test the experiment stage via the
+ * {@link IExperimentStage#getProblems()} method
+ */
+ @Test(timeout = 3600000)
+ public void testStages() {
+ final Stream stages = this.getInstance();
+ Assert.assertNotNull(stages);
+
+ stages.forEach(stage -> {
+ new TestExperimentStage() {
+ @Override
+ protected S getInstance() {
+ return stage;
+ }
+ }.runAllTests();
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void runAllTests() {
+ super.runAllTests();
+ this.testStages();
+ }
+}