This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 40d59120f29fb5a2509be5a2762f176b88b41925 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue Nov 5 09:49:23 2024 -0500 Sort methods --- .../lang3/builder/ReflectionDiffBuilderTest.java | 118 ++++++++++----------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionDiffBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionDiffBuilderTest.java index e34bc50f5..127ff9a23 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ReflectionDiffBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionDiffBuilderTest.java @@ -99,6 +99,65 @@ public class ReflectionDiffBuilderTest extends AbstractLangTest { assertEquals(1, list.getNumberOfDiffs()); } + @Test + public void testGetExcludeFieldNamesWithNullExcludedFieldNames() { + // @formatter:off + final ReflectionDiffBuilder<TypeTestClass> reflectionDiffBuilder = ReflectionDiffBuilder.<TypeTestClass>builder() + .setDiffBuilder(DiffBuilder.<TypeTestClass>builder() + .setLeft(new TypeTestClass()) + .setRight(new TypeTestChildClass()) + .setStyle(SHORT_STYLE) + .build()) + .build(); + // @formatter:on + final String[] excludeFieldNames = reflectionDiffBuilder.getExcludeFieldNames(); + assertNotNull(excludeFieldNames); + assertEquals(0, excludeFieldNames.length); + } + + @Test + public void testGetExcludeFieldNamesWithNullExcludedFieldNamesCtor() { + // @formatter:off + final ReflectionDiffBuilder<TypeTestClass> reflectionDiffBuilder = + new ReflectionDiffBuilder<>(new TypeTestClass(), new TypeTestChildClass(), SHORT_STYLE); + // @formatter:on + reflectionDiffBuilder.setExcludeFieldNames(null); + final String[] excludeFieldNames = reflectionDiffBuilder.getExcludeFieldNames(); + assertNotNull(excludeFieldNames); + assertEquals(0, excludeFieldNames.length); + } + + @Test + public void testGetExcludeFieldNamesWithNullValuesInExcludedFieldNames() { + // @formatter:off + final ReflectionDiffBuilder<TypeTestClass> reflectionDiffBuilder = ReflectionDiffBuilder.<TypeTestClass>builder() + .setDiffBuilder(DiffBuilder.<TypeTestClass>builder() + .setLeft(new TypeTestClass()) + .setRight(new TypeTestChildClass()) + .setStyle(SHORT_STYLE) + .build()) + .setExcludeFieldNames("charField", null) + .build(); + // @formatter:on + final String[] excludeFieldNames = reflectionDiffBuilder.getExcludeFieldNames(); + assertNotNull(excludeFieldNames); + assertEquals(1, excludeFieldNames.length); + assertEquals("charField", excludeFieldNames[0]); + } + + @Test + public void testGetExcludeFieldNamesWithNullValuesInExcludedFieldNamesCtor() { + // @formatter:off + final ReflectionDiffBuilder<TypeTestClass> reflectionDiffBuilder = + new ReflectionDiffBuilder<>(new TypeTestClass(), new TypeTestChildClass(), SHORT_STYLE); + // @formatter:on + reflectionDiffBuilder.setExcludeFieldNames("charField", null); + final String[] excludeFieldNames = reflectionDiffBuilder.getExcludeFieldNames(); + assertNotNull(excludeFieldNames); + assertEquals(1, excludeFieldNames.length); + assertEquals("charField", excludeFieldNames[0]); + } + @Test public void testNoDifferences() { final TypeTestClass firstObject = new TypeTestClass(); @@ -169,63 +228,4 @@ public class ReflectionDiffBuilderTest extends AbstractLangTest { assertEquals(0, list.getNumberOfDiffs()); } - @Test - public void testGetExcludeFieldNamesWithNullExcludedFieldNames() { - // @formatter:off - final ReflectionDiffBuilder<TypeTestClass> reflectionDiffBuilder = ReflectionDiffBuilder.<TypeTestClass>builder() - .setDiffBuilder(DiffBuilder.<TypeTestClass>builder() - .setLeft(new TypeTestClass()) - .setRight(new TypeTestChildClass()) - .setStyle(SHORT_STYLE) - .build()) - .build(); - // @formatter:on - final String[] excludeFieldNames = reflectionDiffBuilder.getExcludeFieldNames(); - assertNotNull(excludeFieldNames); - assertEquals(0, excludeFieldNames.length); - } - - @Test - public void testGetExcludeFieldNamesWithNullExcludedFieldNamesCtor() { - // @formatter:off - final ReflectionDiffBuilder<TypeTestClass> reflectionDiffBuilder = - new ReflectionDiffBuilder<>(new TypeTestClass(), new TypeTestChildClass(), SHORT_STYLE); - // @formatter:on - reflectionDiffBuilder.setExcludeFieldNames(null); - final String[] excludeFieldNames = reflectionDiffBuilder.getExcludeFieldNames(); - assertNotNull(excludeFieldNames); - assertEquals(0, excludeFieldNames.length); - } - - @Test - public void testGetExcludeFieldNamesWithNullValuesInExcludedFieldNames() { - // @formatter:off - final ReflectionDiffBuilder<TypeTestClass> reflectionDiffBuilder = ReflectionDiffBuilder.<TypeTestClass>builder() - .setDiffBuilder(DiffBuilder.<TypeTestClass>builder() - .setLeft(new TypeTestClass()) - .setRight(new TypeTestChildClass()) - .setStyle(SHORT_STYLE) - .build()) - .setExcludeFieldNames("charField", null) - .build(); - // @formatter:on - final String[] excludeFieldNames = reflectionDiffBuilder.getExcludeFieldNames(); - assertNotNull(excludeFieldNames); - assertEquals(1, excludeFieldNames.length); - assertEquals("charField", excludeFieldNames[0]); - } - - @Test - public void testGetExcludeFieldNamesWithNullValuesInExcludedFieldNamesCtor() { - // @formatter:off - final ReflectionDiffBuilder<TypeTestClass> reflectionDiffBuilder = - new ReflectionDiffBuilder<>(new TypeTestClass(), new TypeTestChildClass(), SHORT_STYLE); - // @formatter:on - reflectionDiffBuilder.setExcludeFieldNames("charField", null); - final String[] excludeFieldNames = reflectionDiffBuilder.getExcludeFieldNames(); - assertNotNull(excludeFieldNames); - assertEquals(1, excludeFieldNames.length); - assertEquals("charField", excludeFieldNames[0]); - } - }