Fix the given-when-then tests to have public methods.
This commit is contained in:
+6
-6
@@ -17,34 +17,34 @@ public class SimpleGivenGivenWhenWhenThenThenTest extends Test {
|
|||||||
private int resultCB;
|
private int resultCB;
|
||||||
|
|
||||||
@Given("Create the Sum object")
|
@Given("Create the Sum object")
|
||||||
void setup() {
|
public void setup() {
|
||||||
sum = new Sum();
|
sum = new Sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Given("Setup the arguments")
|
@Given("Setup the arguments")
|
||||||
void setupArgs() {
|
public void setupArgs() {
|
||||||
a = 10;
|
a = 10;
|
||||||
b = 20;
|
b = 20;
|
||||||
c = 30;
|
c = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
@When("Call the .sum(10, 20)")
|
@When("Call the .sum(10, 20)")
|
||||||
void triggerAB() {
|
public void triggerAB() {
|
||||||
resultAB = sum.sum(a, b);
|
resultAB = sum.sum(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@When("Call the .sum(30, 20)")
|
@When("Call the .sum(30, 20)")
|
||||||
void triggerCB() {
|
public void triggerCB() {
|
||||||
resultCB = sum.sum(c, b);
|
resultCB = sum.sum(c, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Then("10 + 20 is 30")
|
@Then("10 + 20 is 30")
|
||||||
void checkAB() {
|
public void checkAB() {
|
||||||
assert 30 == resultAB;
|
assert 30 == resultAB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Then("30 + 20 is 50")
|
@Then("30 + 20 is 50")
|
||||||
void checkCB() {
|
public void checkCB() {
|
||||||
assert 50 == resultCB;
|
assert 50 == resultCB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -14,18 +14,18 @@ public class SimpleGivenWhenThenTest extends Test {
|
|||||||
private int b;
|
private int b;
|
||||||
|
|
||||||
@Given
|
@Given
|
||||||
void setup() {
|
public void setup() {
|
||||||
sum = new Sum();
|
sum = new Sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@When
|
@When
|
||||||
void trigger() {
|
public void trigger() {
|
||||||
a = 10;
|
a = 10;
|
||||||
b = 20;
|
b = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Then
|
@Then
|
||||||
void check() {
|
public void check() {
|
||||||
assert 30 == sum.sum(a, b);
|
assert 30 == sum.sum(a, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user