Compare commits
1
Commits
0.3.0
..
ca1e3d5670
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca1e3d5670 |
+24
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: gradle
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: gradle:8.3.0-jdk17-graal
|
||||||
|
commands:
|
||||||
|
- gradle assemble
|
||||||
|
- gradle check
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: maven
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: maven:3.9.4-eclipse-temurin-17-alpine
|
||||||
|
commands:
|
||||||
|
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
||||||
|
- mvn test -B
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
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,11 +1,8 @@
|
|||||||
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
@@ -2,12 +2,10 @@ 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,12 +1,10 @@
|
|||||||
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("The sum of 10 and 20 is 30.")
|
@Then
|
||||||
public void check() {
|
public void check() {
|
||||||
assert 30 == 10 + 20;
|
assert 30 == 10 + 20;
|
||||||
}
|
}
|
||||||
|
|||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package space.kklochko.simple_jbdd.tests.commands;
|
|
||||||
|
|
||||||
import space.kklochko.simple_jbdd.tests.Test;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
public abstract class AbstractTestCommand<T extends Test> {
|
|
||||||
protected String type;
|
|
||||||
protected String label;
|
|
||||||
|
|
||||||
public AbstractTestCommand(String label) {
|
|
||||||
setLabel(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract boolean test();
|
|
||||||
|
|
||||||
public Map<String, String> getLabels() {
|
|
||||||
Map<String, String> labels = new TreeMap<String, String>();
|
|
||||||
labels.put(getType(), this.getLabel());
|
|
||||||
return labels;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void setObject(T object);
|
|
||||||
|
|
||||||
public abstract T getObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package space.kklochko.simple_jbdd.tests.commands;
|
|
||||||
|
|
||||||
import space.kklochko.simple_jbdd.tests.Test;
|
|
||||||
|
|
||||||
public class SimpleTestCommand<T extends Test> extends AbstractTestCommand<T> {
|
|
||||||
protected T object;
|
|
||||||
|
|
||||||
public SimpleTestCommand(String label, T object) {
|
|
||||||
super(label);
|
|
||||||
setObject(object);
|
|
||||||
setType("Title");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean test() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setObject(T object) {
|
|
||||||
this.object = object;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T getObject() {
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user