Add the error for an empty test.
continuous-integration/drone/tag Build is passing

This commit is contained in:
2023-10-15 12:35:18 +03:00
parent 2e12fdbd34
commit 5c1e69ed32
2 changed files with 24 additions and 0 deletions
@@ -0,0 +1,20 @@
package space.kklochko.simple_jbdd.tests.commands.decorators;
import space.kklochko.simple_jbdd.tests.Test;
import space.kklochko.simple_jbdd.tests.commands.AbstractTestCommand;
public class ErrorDecorator<T extends Test> extends AbstractDecorator<T> {
public ErrorDecorator(String error_label, AbstractTestCommand<T> command, String type) {
super(error_label, command);
setType(type);
}
public boolean test() {
return false;
}
public boolean runMethod() {
return false;
};
}
@@ -8,6 +8,7 @@ import space.kklochko.simple_jbdd.tests.Test;
import space.kklochko.simple_jbdd.tests.commands.AbstractTestCommand; import space.kklochko.simple_jbdd.tests.commands.AbstractTestCommand;
import space.kklochko.simple_jbdd.tests.commands.SimpleTestCommand; import space.kklochko.simple_jbdd.tests.commands.SimpleTestCommand;
import space.kklochko.simple_jbdd.tests.commands.decorators.BlockDecorator; import space.kklochko.simple_jbdd.tests.commands.decorators.BlockDecorator;
import space.kklochko.simple_jbdd.tests.commands.decorators.ErrorDecorator;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@@ -20,6 +21,9 @@ public class TestCommandFactory {
AbstractTestCommand<Test> aTestCommand = createTest(aClass, input); AbstractTestCommand<Test> aTestCommand = createTest(aClass, input);
if(test_methods.size() == 0)
return new ErrorDecorator("ERROR!!! No blocks!!!", aTestCommand, "Error");
if(test_methods.containsKey("Then")) { if(test_methods.containsKey("Then")) {
ArrayList<Method> thens = getMethodsInReverseOrder(test_methods, "Then"); ArrayList<Method> thens = getMethodsInReverseOrder(test_methods, "Then");
for(Method then : thens) { for(Method then : thens) {