diff --git a/src/main/java/com/ljunggren/validator/evaluation/ExactMatchesEvaluation.java b/src/main/java/com/ljunggren/validator/evaluation/ExactMatchesEvaluation.java index 97a93f0..c3c9bb7 100644 --- a/src/main/java/com/ljunggren/validator/evaluation/ExactMatchesEvaluation.java +++ b/src/main/java/com/ljunggren/validator/evaluation/ExactMatchesEvaluation.java @@ -26,7 +26,7 @@ @Override public String getErrorMessage() { - return String.format("Value must be on of the following: %s", String.join(", ", matches)); + return String.format("Value must be one of the following: %s", String.join(", ", matches)); } } diff --git a/src/test/java/com/ljunggren/validator/evaluation/AlphaEvaluationTest.java b/src/test/java/com/ljunggren/validator/evaluation/AlphaEvaluationTest.java index 8c745a1..4ece5fe 100644 --- a/src/test/java/com/ljunggren/validator/evaluation/AlphaEvaluationTest.java +++ b/src/test/java/com/ljunggren/validator/evaluation/AlphaEvaluationTest.java @@ -21,7 +21,7 @@ @Test public void errorMessageTest() { - assertTrue(!evaluation.getErrorMessage().isEmpty()); + assertEquals("Must be all letters", evaluation.getErrorMessage()); } } diff --git a/src/test/java/com/ljunggren/validator/evaluation/AlphaNumericEvaluationTest.java b/src/test/java/com/ljunggren/validator/evaluation/AlphaNumericEvaluationTest.java index 5b3eba2..241583b 100644 --- a/src/test/java/com/ljunggren/validator/evaluation/AlphaNumericEvaluationTest.java +++ b/src/test/java/com/ljunggren/validator/evaluation/AlphaNumericEvaluationTest.java @@ -1,5 +1,6 @@ package com.ljunggren.validator.evaluation; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -21,7 +22,7 @@ @Test public void errorMessageTest() { - assertTrue(!evaluation.getErrorMessage().isEmpty()); + assertEquals("Must be alphanumeric", evaluation.getErrorMessage()); } } diff --git a/src/test/java/com/ljunggren/validator/evaluation/EmailEvaluationTest.java b/src/test/java/com/ljunggren/validator/evaluation/EmailEvaluationTest.java index 4387fd8..e91a02b 100644 --- a/src/test/java/com/ljunggren/validator/evaluation/EmailEvaluationTest.java +++ b/src/test/java/com/ljunggren/validator/evaluation/EmailEvaluationTest.java @@ -20,7 +20,7 @@ @Test public void errorMessageTest() { - assertTrue(!evaluation.getErrorMessage().isEmpty()); + assertEquals("Must be a valid email", evaluation.getErrorMessage()); } } diff --git a/src/test/java/com/ljunggren/validator/evaluation/ExactMatchEvaluationTest.java b/src/test/java/com/ljunggren/validator/evaluation/ExactMatchEvaluationTest.java index 2046193..ac08503 100644 --- a/src/test/java/com/ljunggren/validator/evaluation/ExactMatchEvaluationTest.java +++ b/src/test/java/com/ljunggren/validator/evaluation/ExactMatchEvaluationTest.java @@ -28,7 +28,7 @@ @Test public void errorMessageTest() { - assertTrue(!new ExactMatchEvaluation("test", true).getErrorMessage().isEmpty()); + assertEquals("Value must be 'Test'", new ExactMatchEvaluation("Test", false).getErrorMessage()); } } diff --git a/src/test/java/com/ljunggren/validator/evaluation/ExactMatchesEvaluationTest.java b/src/test/java/com/ljunggren/validator/evaluation/ExactMatchesEvaluationTest.java index 8b3beee..2399328 100644 --- a/src/test/java/com/ljunggren/validator/evaluation/ExactMatchesEvaluationTest.java +++ b/src/test/java/com/ljunggren/validator/evaluation/ExactMatchesEvaluationTest.java @@ -1,5 +1,6 @@ package com.ljunggren.validator.evaluation; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -29,6 +30,7 @@ @Test public void errorMessageTest() { - assertTrue(!new ExactMatchesEvaluation(timeZones, true).getErrorMessage().isEmpty()); + assertEquals("Value must be one of the following: PST, MST, CST, EST", new ExactMatchesEvaluation(timeZones, true).getErrorMessage()); + assertEquals("Value must be one of the following: PST, MST, CST, EST", new ExactMatchesEvaluation(timeZones, false).getErrorMessage()); } } diff --git a/src/test/java/com/ljunggren/validator/evaluation/LengthEvaluationTest.java b/src/test/java/com/ljunggren/validator/evaluation/LengthEvaluationTest.java index 0004f4c..0e1c78d 100644 --- a/src/test/java/com/ljunggren/validator/evaluation/LengthEvaluationTest.java +++ b/src/test/java/com/ljunggren/validator/evaluation/LengthEvaluationTest.java @@ -17,7 +17,7 @@ @Test public void errorMessageTest() { - assertTrue(!new LengthEvaluation(4).getErrorMessage().isEmpty()); + assertEquals("Must be of length 4", new LengthEvaluation(4).getErrorMessage()); } }