Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestConditionTest.java
More file actions
Latest commit
55 lines (47 loc) · 1.51 KB
/
Copy pathTestConditionTest.java
File metadata and controls
55 lines (47 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
packagevalidation;
importorg.junit.Test;
importorg.junit.runner.RunWith;
importorg.junit.runners.Parameterized;
importjava.util.Collection;
importjava.util.UUID;
importstaticjava.util.Arrays.asList;
importstaticorg.junit.Assert.assertEquals;
importstaticvalidation.TestCondition.hasText;
importstaticvalidation.TestCondition.isUuidNull;
@RunWith(Parameterized.class)
publicclassTestConditionTest {
privatefinalTestConditionisUuidNull;
privatefinalTestConditionhasText;
privatefinalbooleanexpectation;
publicTestConditionTest(TestConditionisUuidNull,
TestConditionhasText,
booleanexpectation) {
this.isUuidNull = isUuidNull;
this.hasText = hasText;
this.expectation = expectation;
}
@Parameterized.Parameters
publicstaticCollection<Object[]> data() {
returnasList(newObject[][] {
{
isUuidNull(UUID.randomUUID()),
hasText(null),
false
},
{
isUuidNull(UUID.randomUUID()),
hasText(" "),
false
},
{
isUuidNull(null),
hasText("Yes"),
true
}
});
}
@Test
publicvoidtestConditions() {
assertEquals(isUuidNull.and(hasText).isTrue(), expectation);
}
}