ConditionalTest: helper methods to 'asserThat...'
This commit is contained in:
parent
3e86a62de1
commit
fd947df855
1 changed files with 37 additions and 37 deletions
|
@ -29,7 +29,7 @@ public class ConditionalTest {
|
||||||
//when
|
//when
|
||||||
when(true);
|
when(true);
|
||||||
//then
|
//then
|
||||||
thenTheThenResponseRuns();
|
assertThatTheThenResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -37,7 +37,7 @@ public class ConditionalTest {
|
||||||
//when
|
//when
|
||||||
when(false);
|
when(false);
|
||||||
//then
|
//then
|
||||||
thenTheOtherwiseResponseRuns();
|
assertThatTheOtherwiseResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -45,7 +45,7 @@ public class ConditionalTest {
|
||||||
//when
|
//when
|
||||||
when(true, true);
|
when(true, true);
|
||||||
//then
|
//then
|
||||||
thenTheThenResponseRuns();
|
assertThatTheThenResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -53,7 +53,7 @@ public class ConditionalTest {
|
||||||
//when
|
//when
|
||||||
when(true, false);
|
when(true, false);
|
||||||
//then
|
//then
|
||||||
thenTheOtherwiseResponseRuns();
|
assertThatTheOtherwiseResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -61,7 +61,7 @@ public class ConditionalTest {
|
||||||
//when
|
//when
|
||||||
when(false, true);
|
when(false, true);
|
||||||
//then
|
//then
|
||||||
thenTheOtherwiseResponseRuns();
|
assertThatTheOtherwiseResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -69,7 +69,7 @@ public class ConditionalTest {
|
||||||
//when
|
//when
|
||||||
when(false, false);
|
when(false, false);
|
||||||
//then
|
//then
|
||||||
thenTheOtherwiseResponseRuns();
|
assertThatTheOtherwiseResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -80,7 +80,7 @@ public class ConditionalTest {
|
||||||
.and(true)
|
.and(true)
|
||||||
.then(otherwiseResponse);
|
.then(otherwiseResponse);
|
||||||
//then
|
//then
|
||||||
thenBothResponsesRun();
|
assertThatBothResponsesRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -88,7 +88,7 @@ public class ConditionalTest {
|
||||||
//when
|
//when
|
||||||
whenOr(true, true);
|
whenOr(true, true);
|
||||||
//then
|
//then
|
||||||
thenTheThenResponseRuns();
|
assertThatTheThenResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -96,7 +96,7 @@ public class ConditionalTest {
|
||||||
//when
|
//when
|
||||||
whenOr(true, false);
|
whenOr(true, false);
|
||||||
//then
|
//then
|
||||||
thenTheThenResponseRuns();
|
assertThatTheThenResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -104,7 +104,7 @@ public class ConditionalTest {
|
||||||
//when
|
//when
|
||||||
whenOr(false, true);
|
whenOr(false, true);
|
||||||
//then
|
//then
|
||||||
thenTheThenResponseRuns();
|
assertThatTheThenResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -112,7 +112,7 @@ public class ConditionalTest {
|
||||||
//when
|
//when
|
||||||
whenOr(false, false);
|
whenOr(false, false);
|
||||||
//then
|
//then
|
||||||
thenTheOtherwiseResponseRuns();
|
assertThatTheOtherwiseResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -121,7 +121,7 @@ public class ConditionalTest {
|
||||||
Condition.whereNot(false)
|
Condition.whereNot(false)
|
||||||
.then(thenResponse);
|
.then(thenResponse);
|
||||||
//then
|
//then
|
||||||
thenTheThenResponseRuns();
|
assertThatTheThenResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -131,7 +131,7 @@ public class ConditionalTest {
|
||||||
.then(thenResponse)
|
.then(thenResponse)
|
||||||
.otherwise(otherwiseResponse);
|
.otherwise(otherwiseResponse);
|
||||||
//then
|
//then
|
||||||
thenTheOtherwiseResponseRuns();
|
assertThatTheOtherwiseResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -141,7 +141,7 @@ public class ConditionalTest {
|
||||||
.andNot(false)
|
.andNot(false)
|
||||||
.then(thenResponse);
|
.then(thenResponse);
|
||||||
//then
|
//then
|
||||||
thenTheThenResponseRuns();
|
assertThatTheThenResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -152,7 +152,7 @@ public class ConditionalTest {
|
||||||
.then(thenResponse)
|
.then(thenResponse)
|
||||||
.otherwise(otherwiseResponse);
|
.otherwise(otherwiseResponse);
|
||||||
//then
|
//then
|
||||||
thenTheOtherwiseResponseRuns();
|
assertThatTheOtherwiseResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -162,7 +162,7 @@ public class ConditionalTest {
|
||||||
.orNot(false)
|
.orNot(false)
|
||||||
.then(thenResponse);
|
.then(thenResponse);
|
||||||
//then
|
//then
|
||||||
thenTheThenResponseRuns();
|
assertThatTheThenResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -173,7 +173,7 @@ public class ConditionalTest {
|
||||||
.then(thenResponse)
|
.then(thenResponse)
|
||||||
.otherwise(otherwiseResponse);
|
.otherwise(otherwiseResponse);
|
||||||
//then
|
//then
|
||||||
thenTheOtherwiseResponseRuns();
|
assertThatTheOtherwiseResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -184,7 +184,7 @@ public class ConditionalTest {
|
||||||
.otherwise(true)
|
.otherwise(true)
|
||||||
.then(otherwiseResponse);
|
.then(otherwiseResponse);
|
||||||
//then
|
//then
|
||||||
thenTheOtherwiseResponseRuns();
|
assertThatTheOtherwiseResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -195,7 +195,7 @@ public class ConditionalTest {
|
||||||
.otherwise(false)
|
.otherwise(false)
|
||||||
.then(otherwiseResponse);
|
.then(otherwiseResponse);
|
||||||
//then
|
//then
|
||||||
thenNoResponseRuns();
|
assertThatNoResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -205,7 +205,7 @@ public class ConditionalTest {
|
||||||
.then(thenResponse)
|
.then(thenResponse)
|
||||||
.then(otherwiseResponse);
|
.then(otherwiseResponse);
|
||||||
//then
|
//then
|
||||||
thenBothResponsesRun();
|
assertThatBothResponsesRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -215,7 +215,7 @@ public class ConditionalTest {
|
||||||
.then(thenResponse)
|
.then(thenResponse)
|
||||||
.then(otherwiseResponse);
|
.then(otherwiseResponse);
|
||||||
//then
|
//then
|
||||||
thenNoResponseRuns();
|
assertThatNoResponseRuns();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void whenOr(final boolean firstClause, final boolean secondClause) {
|
private void whenOr(final boolean firstClause, final boolean secondClause) {
|
||||||
|
@ -231,44 +231,44 @@ public class ConditionalTest {
|
||||||
.otherwise(otherwiseResponse);
|
.otherwise(otherwiseResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void thenBothResponsesRun() {
|
private void assertThatBothResponsesRun() {
|
||||||
theThenResponseRan();
|
assertThatTheThenResponseRan();
|
||||||
theOtherwiseResponseRan();
|
assertThatTheOtherwiseResponseRan();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void thenTheThenResponseRuns() {
|
private void assertThatTheThenResponseRuns() {
|
||||||
theThenResponseRan();
|
assertThatTheThenResponseRan();
|
||||||
theOtherwiseResponseDidNotRun();
|
assertThatTheOtherwiseResponseDidNotRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void thenTheOtherwiseResponseRuns() {
|
private void assertThatTheOtherwiseResponseRuns() {
|
||||||
theThenResponseDidNotRun();
|
assertThatTheThenResponseDidNotRun();
|
||||||
theOtherwiseResponseRan();
|
assertThatTheOtherwiseResponseRan();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void theOtherwiseResponseRan() {
|
private void assertThatTheOtherwiseResponseRan() {
|
||||||
assertThat(otherwiseFlag).as("otherwise response runs")
|
assertThat(otherwiseFlag).as("otherwise response runs")
|
||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void theThenResponseRan() {
|
private void assertThatTheThenResponseRan() {
|
||||||
assertThat(thenFlag).as("then response runs")
|
assertThat(thenFlag).as("then response runs")
|
||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void theOtherwiseResponseDidNotRun() {
|
private void assertThatTheOtherwiseResponseDidNotRun() {
|
||||||
assertThat(otherwiseFlag).as("otherwise response does not run")
|
assertThat(otherwiseFlag).as("otherwise response does not run")
|
||||||
.isFalse();
|
.isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void theThenResponseDidNotRun() {
|
private void assertThatTheThenResponseDidNotRun() {
|
||||||
assertThat(thenFlag).as("then response does not run")
|
assertThat(thenFlag).as("then response does not run")
|
||||||
.isFalse();
|
.isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void thenNoResponseRuns() {
|
private void assertThatNoResponseRuns() {
|
||||||
theThenResponseDidNotRun();
|
assertThatTheThenResponseDidNotRun();
|
||||||
theOtherwiseResponseDidNotRun();
|
assertThatTheOtherwiseResponseDidNotRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void when(final boolean firstClause, final boolean secondClause) {
|
private void when(final boolean firstClause, final boolean secondClause) {
|
||||||
|
|
Loading…
Reference in a new issue