-
-
Notifications
You must be signed in to change notification settings - Fork 171
/
VerifyFailOnTypeTest.java
62 lines (48 loc) · 1.94 KB
/
VerifyFailOnTypeTest.java
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
56
57
58
59
60
61
62
package sortpom.parameter;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.NullAndEmptySource;
import org.junit.jupiter.params.provider.ValueSource;
import sortpom.exception.FailureException;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
*
*/
class VerifyFailOnTypeTest {
@Test
void xmlElementsIgnoreCaseValueIsOk() {
PluginParameters pluginParameters = PluginParameters.builder()
.setVerifyFail("STOP", "XMLElements")
.build();
assertEquals(VerifyFailOnType.XMLELEMENTS, pluginParameters.verifyFailOn);
}
@Test
void linesIgnoreCaseValueIsOk() {
PluginParameters pluginParameters = PluginParameters.builder()
.setVerifyFail("STOP", "liNES")
.build();
assertEquals(VerifyFailOnType.LINES, pluginParameters.verifyFailOn);
}
@Test
void strictIgnoreCaseValueIsOk() {
PluginParameters pluginParameters = PluginParameters.builder()
.setVerifyFail("STOP", "stRIct")
.build();
assertEquals(VerifyFailOnType.STRICT, pluginParameters.verifyFailOn);
}
@ParameterizedTest
@NullAndEmptySource
@ValueSource(strings = "gurka")
void verifyFailFaultyValues(String value) {
final Executable testMethod = () -> PluginParameters.builder()
.setVerifyFail("STOP", value)
.build();
final FailureException thrown = assertThrows(FailureException.class, testMethod);
assertThat(thrown.getMessage(), is(equalTo("verifyFailOn must be either xmlElements, lines or strict. Was: " + value)));
}
}