diff --git a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPBooleanCheckTest.java b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPBooleanCheckTest.java index f105859..a267376 100644 --- a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPBooleanCheckTest.java +++ b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPBooleanCheckTest.java @@ -46,6 +46,32 @@ public void failWithBoolNotNull() { softAssert.assertAll(); } + @Test(groups = unitTest) + public void passWithBoolNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":null}"); + TMJPBooleanCheck check = new TMJPBooleanCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") + public void failWithBoolNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":true}"); + TMJPBooleanCheck check = new TMJPBooleanCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + @Test(groups = unitTest) public void passWithCorrectValueCheck() { @@ -110,6 +136,22 @@ public void kotlinThinModelExportCheck() { MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPBooleanCheck().isEqualTo(true)"))); } + @Test(groups = unitTest) + public void thinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPBooleanCheck().checkIsNull(true).isEqualTo(true); + String serialized = serializer.getJavaStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("new JPBooleanCheck().isEqualTo(true).checkIsNull(true)"))); + } + + @Test(groups = unitTest) + public void kotlinThinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPBooleanCheck().checkIsNull(true).isEqualTo(true); + String serialized = serializer.getKotlinStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPBooleanCheck().isEqualTo(true).checkIsNull(true)"))); + } + @Test(groups = unitTest) public void convertDefaultJPBooleanCheckToTMJPBooleanCheck() { @@ -117,15 +159,18 @@ public void convertDefaultJPBooleanCheckToTMJPBooleanCheck() { TMJPBooleanCheck clone = new TMJPBooleanCheck(original); assertThat("Clone MUST have equal check field set to null.", clone.getExpectedValue(), is(nullValue())); + assertThat("Clone MUST have null check set to expected.", clone.isNullExpected(), is(equalTo(false))); } @Test(groups = unitTest) public void convertJPBooleanCheckToTMJPBooleanCheck() { JPBooleanCheck original = new JPBooleanCheck().isEqualTo(true); + original.checkIsNull(true); TMJPBooleanCheck clone = new TMJPBooleanCheck(original); assertThat("Clone MUST have equal check field set to expected.", clone.getExpectedValue(), is(equalTo(true))); + assertThat("Clone MUST have null check set to expected.", clone.isNullExpected(), is(equalTo(true))); } @Test(groups = unitTest) diff --git a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPDoubleCheckTest.java b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPDoubleCheckTest.java index 9aa1091..65cdd3b 100644 --- a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPDoubleCheckTest.java +++ b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPDoubleCheckTest.java @@ -46,6 +46,32 @@ public void failWithDoubleNull() { softAssert.assertAll(); } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") + public void failWithDoubleNotNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":2.0}"); + TMJPDoubleCheck check = new TMJPDoubleCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + + @Test(groups = "unitTest") + public void passWithDoubleNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":null}"); + TMJPDoubleCheck check = new TMJPDoubleCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + @Test(groups = unitTest) public void passWithValueMatch() { @@ -122,6 +148,22 @@ public void kotlinThinModelExportCheck() { MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPDoubleCheck().isEqualTo(3.014159)"))); } + @Test(groups = unitTest) + public void thinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPDoubleCheck().checkIsNull(true).isEqualTo(3.014159000); + String serialized = serializer.getJavaStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("new JPDoubleCheck().isEqualTo(3.014159).checkIsNull(true)"))); + } + + @Test(groups = unitTest) + public void kotlinThinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPDoubleCheck().checkIsNull(true).isEqualTo(3.014159000); + String serialized = serializer.getKotlinStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPDoubleCheck().isEqualTo(3.014159).checkIsNull(true)"))); + } + @Test(groups = unitTest) public void convertDefaultJPDoubleCheckToTMJPDoubleCheck() { @@ -129,15 +171,17 @@ public void convertDefaultJPDoubleCheckToTMJPDoubleCheck() { TMJPDoubleCheck clone = new TMJPDoubleCheck(original); assertThat("Clone MUST have equal check field set to null.", clone.getExpectedValue(), is(nullValue())); + assertThat("Clone MUST have equal null check set to expected.", clone.isNullExpected(), is(equalTo(false))); } @Test(groups = unitTest) public void convertJPDoubleCheckToTMJPDoubleCheck() { - JPDoubleCheck original = new JPDoubleCheck().isEqualTo(5.5); + JPDoubleCheck original = new JPDoubleCheck().checkIsNull(true).isEqualTo(5.5); TMJPDoubleCheck clone = new TMJPDoubleCheck(original); assertThat("Clone MUST have equal check field set to expected.", clone.getExpectedValue(), is(equalTo(5.5))); + assertThat("Clone MUST have equal null check set to expected.", clone.isNullExpected(), is(equalTo(true))); } @Test(groups = unitTest) diff --git a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPIntegerCheckTest.java b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPIntegerCheckTest.java index 08e2b54..671f393 100644 --- a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPIntegerCheckTest.java +++ b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPIntegerCheckTest.java @@ -46,6 +46,32 @@ public void passWithIntegerNotNull() { softAssert.assertAll(); } + @Test(groups = "unitTest") + public void passWithIntegerNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":null}"); + TMJPIntegerCheck check = new TMJPIntegerCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") + public void failWithIntegerNotNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":2}"); + TMJPIntegerCheck check = new TMJPIntegerCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") public void failWithIntegerMismatch() { @@ -110,6 +136,22 @@ public void kotlinThinModelExportCheck() { MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPIntegerCheck().isEqualTo(42)"))); } + @Test(groups = unitTest) + public void thinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPIntegerCheck().checkIsNull(true).isEqualTo(42); + String serialized = serializer.getJavaStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("new JPIntegerCheck().isEqualTo(42).checkIsNull(true)"))); + } + + @Test(groups = unitTest) + public void kotlinThinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPIntegerCheck().checkIsNull(true).isEqualTo(42); + String serialized = serializer.getKotlinStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPIntegerCheck().isEqualTo(42).checkIsNull(true)"))); + } + @Test(groups = unitTest) public void convertDefaultJPIntegerCheckToTMJPIntegerCheck() { @@ -117,15 +159,17 @@ public void convertDefaultJPIntegerCheckToTMJPIntegerCheck() { TMJPIntegerCheck clone = new TMJPIntegerCheck(original); assertThat("Clone MUST have equal check field set to null.", clone.getExpectedValue(), is(nullValue())); + assertThat("Clone MUST have null check set to false.", clone.isNullExpected(), is(equalTo(false))); } @Test(groups = unitTest) public void convertJPIntegerCheckToTMJPIntegerCheck() { - JPIntegerCheck original = new JPIntegerCheck().isEqualTo(5); + JPIntegerCheck original = new JPIntegerCheck().checkIsNull(true).isEqualTo(5); TMJPIntegerCheck clone = new TMJPIntegerCheck(original); assertThat("Clone MUST have equal check field set to expected.", clone.getExpectedValue(), is(equalTo(5))); + assertThat("Clone MUST have null check set to true.", clone.isNullExpected(), is(equalTo(true))); } @Test(groups = unitTest) diff --git a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPJsonArrayCheckTest.java b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPJsonArrayCheckTest.java index d01027e..adbe8c7 100644 --- a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPJsonArrayCheckTest.java +++ b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPJsonArrayCheckTest.java @@ -45,6 +45,32 @@ public void failWithNullArray() { softAssert.assertAll(); } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") + public void failWithNonNullArray() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":[{\"bar\":\"A\"}]}"); + TMJPJsonArrayCheck check = new TMJPJsonArrayCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + + @Test(groups = "unitTest") + public void passWithNullArray() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":null}"); + TMJPJsonArrayCheck check = new TMJPJsonArrayCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") public void failWithClassCastException() { @@ -181,6 +207,22 @@ public void kotlinThinModelExportCheck() { MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPJsonArrayCheck().hasLength(3).hasMinLength(1).hasMaxLength(4)"))); } + @Test(groups = unitTest) + public void thinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPJsonArrayCheck().checkIsNull(true).hasLength(3).hasMinLength(1).hasMaxLength(4); + String serialized = serializer.getJavaStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("new JPJsonArrayCheck().hasLength(3).hasMinLength(1).hasMaxLength(4).checkIsNull(true)"))); + } + + @Test(groups = unitTest) + public void kotlinThinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPJsonArrayCheck().checkIsNull(true).hasLength(3).hasMinLength(1).hasMaxLength(4); + String serialized = serializer.getKotlinStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPJsonArrayCheck().hasLength(3).hasMinLength(1).hasMaxLength(4).checkIsNull(true)"))); + } + @Test(groups = unitTest) public void convertDefaultJPJsonArrayCheckToTMJPJsonArrayCheck() { @@ -190,16 +232,18 @@ public void convertDefaultJPJsonArrayCheckToTMJPJsonArrayCheck() { assertThat("Clone MUST have expected length set to null.", clone.getExpectedLength(), is(nullValue())); assertThat("Clone MUST have max length set to null.", clone.getMaxLength(), is(nullValue())); assertThat("Clone MUST have min length set to null.", clone.getMinLength(), is(nullValue())); + assertThat("Clone MUST have null check set to false.", clone.isNullExpected(), is(equalTo(false))); } @Test(groups = unitTest) public void convertJPJsonArrayCheckToTMJPJsonArrayCheck() { - JPJsonArrayCheck original = new JPJsonArrayCheck().hasLength(3).hasMaxLength(5).hasMinLength(1); + JPJsonArrayCheck original = new JPJsonArrayCheck().checkIsNull(true).hasLength(3).hasMaxLength(5).hasMinLength(1); TMJPJsonArrayCheck clone = new TMJPJsonArrayCheck(original); assertThat("Clone MUST have expected length set to expected.", clone.getExpectedLength(), is(equalTo(3))); assertThat("Clone MUST have max length set to expected.", clone.getMaxLength(), is(equalTo(5))); assertThat("Clone MUST have min length set to expected.", clone.getMinLength(), is(equalTo(1))); + assertThat("Clone MUST have null check set to true.", clone.isNullExpected(), is(equalTo(true))); } } diff --git a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPJsonObjectCheckTest.java b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPJsonObjectCheckTest.java index 22ddea0..86d8aad 100644 --- a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPJsonObjectCheckTest.java +++ b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPJsonObjectCheckTest.java @@ -50,6 +50,32 @@ public void failWithNullObject() { softAssert.assertAll(); } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") + public void failWithNonNullObject() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":{\"first\":\"A\",\"second\":2,\"third\":true}}"); + TMJPJsonObjectCheck check = new TMJPJsonObjectCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + + @Test(groups = "unitTest") + public void passWithNullObject() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":null}"); + TMJPJsonObjectCheck check = new TMJPJsonObjectCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") public void failWithClassCastException() { @@ -228,6 +254,22 @@ public void kotlinThinModelExportCheck() { MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPJsonObjectCheck()"))); } + @Test(groups = unitTest) + public void thinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPJsonObjectCheck().checkIsNull(true); + String serialized = serializer.getJavaStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("new JPJsonObjectCheck().checkIsNull(true)"))); + } + + @Test(groups = unitTest) + public void kotlinThinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPJsonObjectCheck().checkIsNull(true); + String serialized = serializer.getKotlinStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPJsonObjectCheck().checkIsNull(true)"))); + } + @Test(groups = unitTest) public void convertDefaultJPJsonObjectCheckToTMJPJsonObjectCheck() { @@ -239,6 +281,7 @@ public void convertDefaultJPJsonObjectCheckToTMJPJsonObjectCheck() { assertThat("Clone MUST have contains keys set to null.", clone.getContainsKeys(), is(nullValue())); assertThat("Clone MUST have expected map set to null.", clone.getExpectedMap(), is(nullValue())); assertThat("Clone MUST have contains map set to null.", clone.getContainsMap(), is(nullValue())); + assertThat("Clone MUST have null check set to false.", clone.isNullExpected(), is(equalTo(false))); } @Test(groups = unitTest) @@ -252,7 +295,7 @@ public void convertJPJsonObjectCheckToTMJPJsonObjectCheck() { HashMap containsMap = new HashMap<>(); containsMap.put("CONTAINS", "VALUE"); - JPJsonObjectCheck original = new JPJsonObjectCheck().hasNumberOfKeys(3).keysAreEqualTo(expectedKeys).keysContain(containsKeys).isEqualTo(expectedMap).contains(containsMap); + JPJsonObjectCheck original = new JPJsonObjectCheck().checkIsNull(true).hasNumberOfKeys(3).keysAreEqualTo(expectedKeys).keysContain(containsKeys).isEqualTo(expectedMap).contains(containsMap); TMJPJsonObjectCheck clone = new TMJPJsonObjectCheck(original); assertThat("Clone MUST have expected number of keys set to expected.", clone.getExpectedNumberOfKeys(), is(equalTo(3))); @@ -260,5 +303,6 @@ public void convertJPJsonObjectCheckToTMJPJsonObjectCheck() { assertThat("Clone MUST have contains keys set to expected.", clone.getContainsKeys(), is(equalTo(containsKeys))); assertThat("Clone MUST have expected map set to expected.", clone.getExpectedMap(), is(equalTo(expectedMap))); assertThat("Clone MUST have contains map set to expected.", clone.getContainsMap(), is(equalTo(containsMap))); + assertThat("Clone MUST have null check set to true.", clone.isNullExpected(), is(equalTo(true))); } } diff --git a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfBooleanCheckTest.java b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfBooleanCheckTest.java index bafe079..15d4936 100644 --- a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfBooleanCheckTest.java +++ b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfBooleanCheckTest.java @@ -49,6 +49,32 @@ public void failNotNull() { softAssert.assertAll(); } + @Test(expectedExceptions = AssertionError.class, groups = unitTest) + public void failNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":[{\"bar\":true},{\"bar\":false},{\"bar\":true}]}"); + TMJPListOfBooleanCheck check = new TMJPListOfBooleanCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo[*].bar", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + + @Test(groups = "unitTest") + public void passNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":[{\"bar\":null},{\"bar\":null},{\"bar\":null}]}"); + TMJPListOfBooleanCheck check = new TMJPListOfBooleanCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo[*].bar", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") public void failPathNotFoundException() { @@ -269,6 +295,22 @@ public void kotlinThinModelExportCheck() { MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPListOfBooleanCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(listOf(true,false)).contains(listOf(true)).hasAllValuesEqualTo(false)"))); } + @Test(groups = unitTest) + public void thinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPListOfBooleanCheck().checkIsNull(true).hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList(true,false)).contains(Arrays.asList(true)).hasAllValuesEqualTo(false); + String serialized = serializer.getJavaStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("new JPListOfBooleanCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList(true,false)).contains(Arrays.asList(true)).hasAllValuesEqualTo(false).checkIsNull(true)"))); + } + + @Test(groups = unitTest) + public void kotlinThinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPListOfBooleanCheck().checkIsNull(true).hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList(true,false)).contains(Arrays.asList(true)).hasAllValuesEqualTo(false); + String serialized = serializer.getKotlinStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPListOfBooleanCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(listOf(true,false)).contains(listOf(true)).hasAllValuesEqualTo(false).checkIsNull(true)"))); + } + @Test(groups = unitTest) public void convertDefaultJPListOfBooleanCheckToTMJPListOfBooleanCheck() { @@ -281,6 +323,7 @@ public void convertDefaultJPListOfBooleanCheckToTMJPListOfBooleanCheck() { assertThat("Clone MUST have contains values set to null.", clone.getContainsValues(), is(nullValue())); assertThat("Clone MUST have is equal to values set to null.", clone.getIsEqualToValues(), is(nullValue())); assertThat("Clone MUST have all expected value set to null.", clone.getAllExpectedValue(), is(nullValue())); + assertThat("Clone MUST have null check set to false.", clone.isNullExpected(), is(equalTo(false))); } @Test(groups = unitTest) @@ -293,7 +336,7 @@ public void convertJPListOfBooleanCheckToTMJPListOfBooleanCheck() { List equalToValues = Arrays.asList(true, true, true, false, false); boolean allSetTo = false; - JPListOfBooleanCheck original = new JPListOfBooleanCheck().hasLength(hasLength).hasMaxLength(maxLength).hasMinLength(minLength).contains(containsValues).isEqualTo(equalToValues).hasAllValuesEqualTo(allSetTo); + JPListOfBooleanCheck original = new JPListOfBooleanCheck().checkIsNull(true).hasLength(hasLength).hasMaxLength(maxLength).hasMinLength(minLength).contains(containsValues).isEqualTo(equalToValues).hasAllValuesEqualTo(allSetTo); TMJPListOfBooleanCheck clone = new TMJPListOfBooleanCheck(original); assertThat("Clone MUST have length set to expected.", clone.getHasLength(), is(equalTo(hasLength))); @@ -302,6 +345,7 @@ public void convertJPListOfBooleanCheckToTMJPListOfBooleanCheck() { assertThat("Clone MUST have contains values set to expected.", clone.getContainsValues(), is(equalTo(containsValues))); assertThat("Clone MUST have is equal to values set to expected.", clone.getIsEqualToValues(), is(equalTo(equalToValues))); assertThat("Clone MUST have all expected value set to expected.", clone.getAllExpectedValue(), is(equalTo(allSetTo))); + assertThat("Clone MUST have null check set to true.", clone.isNullExpected(), is(equalTo(true))); } @Test(groups = unitTest) diff --git a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfDoubleCheckTest.java b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfDoubleCheckTest.java index 9a52813..35754e0 100644 --- a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfDoubleCheckTest.java +++ b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfDoubleCheckTest.java @@ -49,6 +49,32 @@ public void failNotNull() { softAssert.assertAll(); } + @Test(groups = unitTest) + public void passNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":[{\"bar\":null},{\"bar\":null},{\"bar\":null}]}"); + TMJPListOfDoubleCheck check = new TMJPListOfDoubleCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo[*].bar", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") + public void failNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":[{\"bar\":null},{\"bar\":2.5},{\"bar\":3.14}]}"); + TMJPListOfDoubleCheck check = new TMJPListOfDoubleCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo[*].bar", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") public void failPathNotFoundException() { @@ -305,6 +331,22 @@ public void kotlinThinModelExportCheck() { MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPListOfDoubleCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(listOf(3.1415926535,2.0)).contains(listOf(1.0)).hasAllValuesEqualTo(4.0001)"))); } + @Test(groups = unitTest) + public void thinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPListOfDoubleCheck().checkIsNull(true).hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList(3.1415926535,2.00000)).contains(Arrays.asList(1.0000)).hasAllValuesEqualTo(4.0001); + String serialized = serializer.getJavaStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("new JPListOfDoubleCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList(3.1415926535,2.0)).contains(Arrays.asList(1.0)).hasAllValuesEqualTo(4.0001).checkIsNull(true)"))); + } + + @Test(groups = unitTest) + public void kotlinThinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPListOfDoubleCheck().checkIsNull(true).hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList(3.1415926535,2.00000)).contains(Arrays.asList(1.0000)).hasAllValuesEqualTo(4.0001); + String serialized = serializer.getKotlinStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPListOfDoubleCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(listOf(3.1415926535,2.0)).contains(listOf(1.0)).hasAllValuesEqualTo(4.0001).checkIsNull(true)"))); + } + @Test(groups = unitTest) public void convertDefaultJPListOfDoubleCheckToTMJPListOfDoubleCheck() { @@ -317,6 +359,7 @@ public void convertDefaultJPListOfDoubleCheckToTMJPListOfDoubleCheck() { assertThat("Clone MUST have contains values set to null.", clone.getContainsValues(), is(nullValue())); assertThat("Clone MUST have is equal to values set to null.", clone.getIsEqualToValues(), is(nullValue())); assertThat("Clone MUST have all expected value set to null.", clone.getAllExpectedValue(), is(nullValue())); + assertThat("Clone MUST have null check set to false.", clone.isNullExpected(), is(equalTo(false))); } @Test(groups = unitTest) @@ -329,7 +372,7 @@ public void convertJPListOfDoubleCheckToTMJPListOfDoubleCheck() { List equalToValues = Arrays.asList(1.0, 2.0, 3.0, 5.9); double allSetTo = 3.5; - JPListOfDoubleCheck original = new JPListOfDoubleCheck().hasLength(hasLength).hasMaxLength(maxLength).hasMinLength(minLength).contains(containsValues).isEqualTo(equalToValues).hasAllValuesEqualTo(allSetTo); + JPListOfDoubleCheck original = new JPListOfDoubleCheck().checkIsNull(true).hasLength(hasLength).hasMaxLength(maxLength).hasMinLength(minLength).contains(containsValues).isEqualTo(equalToValues).hasAllValuesEqualTo(allSetTo); TMJPListOfDoubleCheck clone = new TMJPListOfDoubleCheck(original); assertThat("Clone MUST have length set to expected.", clone.getHasLength(), is(equalTo(hasLength))); @@ -338,6 +381,7 @@ public void convertJPListOfDoubleCheckToTMJPListOfDoubleCheck() { assertThat("Clone MUST have contains values set to expected.", clone.getContainsValues(), is(equalTo(containsValues))); assertThat("Clone MUST have is equal to values set to expected.", clone.getIsEqualToValues(), is(equalTo(equalToValues))); assertThat("Clone MUST have all expected value set to expected.", clone.getAllExpectedValue(), is(equalTo(allSetTo))); + assertThat("Clone MUST have null check set to true.", clone.isNullExpected(), is(equalTo(true))); } @Test(groups = unitTest) diff --git a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfIntegerCheckTest.java b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfIntegerCheckTest.java index bb806d5..dcc2c99 100644 --- a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfIntegerCheckTest.java +++ b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfIntegerCheckTest.java @@ -49,6 +49,32 @@ public void failNotNull() { softAssert.assertAll(); } + @Test(groups = unitTest) + public void passNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":[{\"bar\":null},{\"bar\":null},{\"bar\":null}]}"); + TMJPListOfIntegerCheck check = new TMJPListOfIntegerCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo[*].bar", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") + public void failNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":[{\"bar\":null},{\"bar\":2},{\"bar\":3}]}"); + TMJPListOfIntegerCheck check = new TMJPListOfIntegerCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo[*].bar", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") public void failPathNotFoundException() { @@ -269,6 +295,22 @@ public void kotlinThinModelExportCheck() { MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPListOfIntegerCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(listOf(1,2)).contains(listOf(1)).hasAllValuesEqualTo(4)"))); } + @Test(groups = unitTest) + public void thinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPListOfIntegerCheck().checkIsNull(true).hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList(1,2)).contains(Arrays.asList(1)).hasAllValuesEqualTo(4); + String serialized = serializer.getJavaStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("new JPListOfIntegerCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList(1,2)).contains(Arrays.asList(1)).hasAllValuesEqualTo(4).checkIsNull(true)"))); + } + + @Test(groups = unitTest) + public void kotlinThinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPListOfIntegerCheck().checkIsNull(true).hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList(1,2)).contains(Arrays.asList(1)).hasAllValuesEqualTo(4); + String serialized = serializer.getKotlinStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPListOfIntegerCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(listOf(1,2)).contains(listOf(1)).hasAllValuesEqualTo(4).checkIsNull(true)"))); + } + @Test(groups = unitTest) public void convertDefaultJPListOfIntegerCheckToTMJPListOfIntegerCheck() { @@ -281,6 +323,7 @@ public void convertDefaultJPListOfIntegerCheckToTMJPListOfIntegerCheck() { assertThat("Clone MUST have contains values set to null.", clone.getContainsValues(), is(nullValue())); assertThat("Clone MUST have is equal to values set to null.", clone.getIsEqualToValues(), is(nullValue())); assertThat("Clone MUST have all expected value set to null.", clone.getAllExpectedValue(), is(nullValue())); + assertThat("Clone MUST have null check set to false.", clone.isNullExpected(), is(equalTo(false))); } @Test(groups = unitTest) @@ -293,7 +336,7 @@ public void convertJPListOfIntegerCheckToTMJPListOfIntegerCheck() { List equalToValues = Arrays.asList(1, 2, 3, 5); int allSetTo = 3; - JPListOfIntegerCheck original = new JPListOfIntegerCheck().hasLength(hasLength).hasMaxLength(maxLength).hasMinLength(minLength).contains(containsValues).isEqualTo(equalToValues).hasAllValuesEqualTo(allSetTo); + JPListOfIntegerCheck original = new JPListOfIntegerCheck().checkIsNull(true).hasLength(hasLength).hasMaxLength(maxLength).hasMinLength(minLength).contains(containsValues).isEqualTo(equalToValues).hasAllValuesEqualTo(allSetTo); TMJPListOfIntegerCheck clone = new TMJPListOfIntegerCheck(original); assertThat("Clone MUST have length set to expected.", clone.getHasLength(), is(equalTo(hasLength))); @@ -302,6 +345,7 @@ public void convertJPListOfIntegerCheckToTMJPListOfIntegerCheck() { assertThat("Clone MUST have contains values set to expected.", clone.getContainsValues(), is(equalTo(containsValues))); assertThat("Clone MUST have is equal to values set to expected.", clone.getIsEqualToValues(), is(equalTo(equalToValues))); assertThat("Clone MUST have all expected value set to expected.", clone.getAllExpectedValue(), is(equalTo(allSetTo))); + assertThat("Clone MUST have null check set to true.", clone.isNullExpected(), is(equalTo(true))); } @Test(groups = unitTest) diff --git a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfStringCheckTest.java b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfStringCheckTest.java index 156cd7a..3be7f81 100644 --- a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfStringCheckTest.java +++ b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPListOfStringCheckTest.java @@ -38,7 +38,7 @@ public void passNonNullValue() { } @Test(expectedExceptions = AssertionError.class, groups = "unitTest") - public void failNullValue() { + public void failNonNullValue() { SoftAssert softAssert = new SoftAssert(); @@ -49,6 +49,32 @@ public void failNullValue() { softAssert.assertAll(); } + @Test(groups = unitTest) + public void passNullValue() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":[{\"text\":null}]}"); + TMJPListOfStringCheck check = new TMJPListOfStringCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo[*].text", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") + public void failNullValue() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":[{\"text\":\"A\"},{\"text\":\"B\"},{\"text\":\"C\"}]}"); + TMJPListOfStringCheck check = new TMJPListOfStringCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo[*].text", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") public void failNullMissingNode() { @@ -332,6 +358,22 @@ public void kotlinThinModelExportCheck() { MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPListOfStringCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(listOf(\"one\",\"two\")).contains(listOf(\"one\")).hasAllValuesEqualTo(\"three\").isLimitedToValues(listOf(\"one\",\"two\"))"))); } + @Test(groups = unitTest) + public void thinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPListOfStringCheck().checkIsNull(true).hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList("one","two")).contains(Arrays.asList("one")).hasAllValuesEqualTo("three").isLimitedToValues(Arrays.asList("one","two")); + String serialized = serializer.getJavaStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("new JPListOfStringCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList(\"one\",\"two\")).contains(Arrays.asList(\"one\")).hasAllValuesEqualTo(\"three\").isLimitedToValues(Arrays.asList(\"one\",\"two\")).checkIsNull(true)"))); + } + + @Test(groups = unitTest) + public void kotlinThinModelExportCheckNull() { + + ThinModelSerializer serializer = new TMJPListOfStringCheck().checkIsNull(true).hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(Arrays.asList("one","two")).contains(Arrays.asList("one")).hasAllValuesEqualTo("three").isLimitedToValues(Arrays.asList("one","two")); + String serialized = serializer.getKotlinStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPListOfStringCheck().hasLength(2).hasMinLength(1).hasMaxLength(3).isEqualTo(listOf(\"one\",\"two\")).contains(listOf(\"one\")).hasAllValuesEqualTo(\"three\").isLimitedToValues(listOf(\"one\",\"two\")).checkIsNull(true)"))); + } + @Test(groups = unitTest) public void convertDefaultJPListOfStringCheckToTMJPListOfStringCheck() { @@ -345,6 +387,7 @@ public void convertDefaultJPListOfStringCheckToTMJPListOfStringCheck() { assertThat("Clone MUST have is equal to values set to null.", clone.getIsEqualToValues(), is(nullValue())); assertThat("Clone MUST have all expected value set to null.", clone.getAllExpectedValue(), is(nullValue())); assertThat("Clone MUST have all limited to values set to null.", clone.getLimitedToValues(), is(nullValue())); + assertThat("Clone MUST have null check set to false.", clone.isNullExpected(), is(equalTo(false))); } @Test(groups = unitTest) @@ -358,7 +401,7 @@ public void convertJPListOfStringCheckToTMJPListOfStringCheck() { String allSetTo = "MONSTOR"; List limitedToValues = Arrays.asList("green", "red"); - JPListOfStringCheck original = new JPListOfStringCheck().hasLength(hasLength).hasMaxLength(maxLength).hasMinLength(minLength).contains(containsValues).isEqualTo(equalToValues).hasAllValuesEqualTo(allSetTo).isLimitedToValues(limitedToValues); + JPListOfStringCheck original = new JPListOfStringCheck().checkIsNull(true).hasLength(hasLength).hasMaxLength(maxLength).hasMinLength(minLength).contains(containsValues).isEqualTo(equalToValues).hasAllValuesEqualTo(allSetTo).isLimitedToValues(limitedToValues); TMJPListOfStringCheck clone = new TMJPListOfStringCheck(original); assertThat("Clone MUST have length set to expected.", clone.getHasLengthValue(), is(equalTo(hasLength))); @@ -368,6 +411,7 @@ public void convertJPListOfStringCheckToTMJPListOfStringCheck() { assertThat("Clone MUST have is equal to values set to expected.", clone.getIsEqualToValues(), is(equalTo(equalToValues))); assertThat("Clone MUST have all expected value set to expected.", clone.getAllExpectedValue(), is(equalTo(allSetTo))); assertThat("Clone MUST have all limited to values set to null.", clone.getLimitedToValues(), is(equalTo(limitedToValues))); + assertThat("Clone MUST have null check set to true.", clone.isNullExpected(), is(equalTo(true))); } @Test(groups = unitTest) diff --git a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPStringCheckTest.java b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPStringCheckTest.java index 69937e4..0df297d 100644 --- a/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPStringCheckTest.java +++ b/TMBuilder/src/test/java/com/ebay/jsonpath/TMJPStringCheckTest.java @@ -49,6 +49,32 @@ public void failNotNull() { softAssert.assertAll(); } + @Test(groups = unitTest) + public void passNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":null}"); + TMJPStringCheck check = new TMJPStringCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") + public void failNull() { + + SoftAssert softAssert = new SoftAssert(); + + DocumentContext jsonPathDocument = JsonPath.using(config).parse("{\"foo\":\"value\"}"); + TMJPStringCheck check = new TMJPStringCheck(); + check.checkIsNull(true); + check.processJsonPath("$.foo", softAssert, jsonPathDocument); + + softAssert.assertAll(); + } + @Test(expectedExceptions = AssertionError.class, groups = "unitTest") public void failClassCastException() { @@ -233,6 +259,22 @@ public void kotlinThinModelExportCheck() { MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPStringCheck().hasLength(3).isEqualTo(\"one\").contains(\"on\").hasMinimumNumberOfCharacters(1).hasMaximumNumberOfCharacters(3)"))); } + @Test(groups = unitTest) + public void thinModelExportCheckWithNullCheck() { + + ThinModelSerializer serializer = new TMJPStringCheck().checkIsNull(true).hasLength(3).isEqualTo("one").contains("on").hasMinimumNumberOfCharacters(1).hasMaximumNumberOfCharacters(3); + String serialized = serializer.getJavaStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("new JPStringCheck().hasLength(3).isEqualTo(\"one\").contains(\"on\").hasMinimumNumberOfCharacters(1).hasMaximumNumberOfCharacters(3).checkIsNull(true)"))); + } + + @Test(groups = unitTest) + public void kotlinThinModelExportCheckWithNullCheck() { + + ThinModelSerializer serializer = new TMJPStringCheck().checkIsNull(true).hasLength(3).isEqualTo("one").contains("on").hasMinimumNumberOfCharacters(1).hasMaximumNumberOfCharacters(3); + String serialized = serializer.getKotlinStatements(); + MatcherAssert.assertThat("Serialized variant must match expected.", serialized, Matchers.is(Matchers.equalTo("JPStringCheck().hasLength(3).isEqualTo(\"one\").contains(\"on\").hasMinimumNumberOfCharacters(1).hasMaximumNumberOfCharacters(3).checkIsNull(true)"))); + } + @Test(groups = unitTest) public void convertDefaultJPStringCheckToTMJPStringCheck() { @@ -245,6 +287,7 @@ public void convertDefaultJPStringCheckToTMJPStringCheck() { assertThat("Clone MUST have length set to null.", clone.getHasLengthExpectedValue(), is(nullValue())); assertThat("Clone MUST have maximum number of characters set to null.", clone.getMaximumNumberOfCharacters(), is(nullValue())); assertThat("Clone MUST have minimum number of characters set to null.", clone.getMinimumNumberOfCharacters(), is(nullValue())); + assertThat("Clone MUST have null check set to false.", clone.isNullExpected(), is(equalTo(false))); } @Test(groups = unitTest) @@ -257,7 +300,7 @@ public void convertJPStringCheckToTMJPStringCheck() { int maximumNumberOfCharacters = 10; int minimumNumberOfCharacters = 1; - JPStringCheck original = new JPStringCheck().isEqualTo(isEqualToExpected).isEqualToOneOf(isEqualToOneOf).contains(containsValue).hasLength(hasLength).hasMaximumNumberOfCharacters(maximumNumberOfCharacters).hasMinimumNumberOfCharacters(minimumNumberOfCharacters); + JPStringCheck original = new JPStringCheck().checkIsNull(true).isEqualTo(isEqualToExpected).isEqualToOneOf(isEqualToOneOf).contains(containsValue).hasLength(hasLength).hasMaximumNumberOfCharacters(maximumNumberOfCharacters).hasMinimumNumberOfCharacters(minimumNumberOfCharacters); TMJPStringCheck clone = new TMJPStringCheck(original); assertThat("Clone MUST have equal to expected value set to null.", clone.getIsEqualToExpectedValue(), is(equalTo(isEqualToExpected))); @@ -266,6 +309,7 @@ public void convertJPStringCheckToTMJPStringCheck() { assertThat("Clone MUST have length set to null.", clone.getHasLengthExpectedValue(), is(equalTo(hasLength))); assertThat("Clone MUST have maximum number of characters set to null.", clone.getMaximumNumberOfCharacters(), is(equalTo(maximumNumberOfCharacters))); assertThat("Clone MUST have minimum number of characters set to null.", clone.getMinimumNumberOfCharacters(), is(equalTo(minimumNumberOfCharacters))); + assertThat("Clone MUST have null check set to true.", clone.isNullExpected(), is(equalTo(true))); } @Test(groups = unitTest)