Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions config-model/src/test/java/ConfigModelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ public void testIntValidation() {
assertThat(cm.validate("test", "2"), is(List.of("test has value 2 which greater than the maximum value 1")));
}

@Test
public void testIntPatternValidation() {
ConfigModel cm = new ConfigModel();
cm.setType(Type.INT);
cm.setPattern("1|2|3");
assertThat(cm.validate("test", "1"), is(emptyList()));
assertThat(cm.validate("test", "2"), is(emptyList()));
assertThat(cm.validate("test", "3"), is(emptyList()));
assertThat(cm.validate("test", "4"),
is(List.of("test has value '4' which does not match the required pattern: 1|2|3")));
}

@Test
public void testLongValidation() {
ConfigModel cm = new ConfigModel();
Expand Down