Compare commits

...
3 Commits
5 changed files with 34 additions and 1 deletions
@@ -0,0 +1,13 @@
package space.kklochko.simple_jbdd.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Title {
String value() default "Title";
}
@@ -1,8 +1,11 @@
package space.kklochko.simple_jbdd.test_examples.tests; package space.kklochko.simple_jbdd.test_examples.tests;
import space.kklochko.simple_jbdd.annotations.Then; import space.kklochko.simple_jbdd.annotations.Then;
import space.kklochko.simple_jbdd.annotations.Title;
import space.kklochko.simple_jbdd.tests.Test; import space.kklochko.simple_jbdd.tests.Test;
@Title("A Simple Failed GivenWhenTest for Sum")
public class SimpleFailedThenTest extends Test { public class SimpleFailedThenTest extends Test {
@Then @Then
public void check() { public void check() {
@@ -2,10 +2,12 @@ package space.kklochko.simple_jbdd.test_examples.tests;
import space.kklochko.simple_jbdd.annotations.Given; import space.kklochko.simple_jbdd.annotations.Given;
import space.kklochko.simple_jbdd.annotations.Then; import space.kklochko.simple_jbdd.annotations.Then;
import space.kklochko.simple_jbdd.annotations.Title;
import space.kklochko.simple_jbdd.annotations.When; import space.kklochko.simple_jbdd.annotations.When;
import space.kklochko.simple_jbdd.test_examples.samples.Sum; import space.kklochko.simple_jbdd.test_examples.samples.Sum;
import space.kklochko.simple_jbdd.tests.Test; import space.kklochko.simple_jbdd.tests.Test;
@Title("A Simple GivenWhenTest for Sum")
public class SimpleGivenWhenThenTest extends Test { public class SimpleGivenWhenThenTest extends Test {
private Sum sum; private Sum sum;
private int a; private int a;
@@ -1,10 +1,12 @@
package space.kklochko.simple_jbdd.test_examples.tests; package space.kklochko.simple_jbdd.test_examples.tests;
import space.kklochko.simple_jbdd.annotations.Then; import space.kklochko.simple_jbdd.annotations.Then;
import space.kklochko.simple_jbdd.annotations.Title;
import space.kklochko.simple_jbdd.tests.Test; import space.kklochko.simple_jbdd.tests.Test;
@Title("Simple test")
public class SimpleThenTest extends Test { public class SimpleThenTest extends Test {
@Then @Then("The sum of 10 and 20 is 30.")
public void check() { public void check() {
assert 30 == 10 + 20; assert 30 == 10 + 20;
} }
@@ -0,0 +1,13 @@
package space.kklochko.simple_jbdd.test_examples.tests;
import space.kklochko.simple_jbdd.annotations.Then;
import space.kklochko.simple_jbdd.annotations.Title;
import space.kklochko.simple_jbdd.tests.Test;
public class SimpleThenTestWithoutTitle extends Test {
@Then("The sum of 10 and 20 is 30.")
public void check() {
assert 30 == 10 + 20;
}
}