Remove redundant syntax

This commit is contained in:
Gary Gregory 2024-09-12 10:17:40 -04:00
parent a9f02bc64e
commit a2fe02fc0c
1 changed files with 19 additions and 19 deletions

View File

@ -64,31 +64,31 @@ public class ReflectionToStringBuilderIncludeTest extends AbstractLangTest {
public void test_toStringDefaultBehavior() {
final ReflectionToStringBuilder builder = new ReflectionToStringBuilder(new TestFeature());
final String toString = builder.toString();
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
public void test_toStringInclude() {
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), SINGLE_FIELD_TO_SHOW);
this.validateIncludeFieldsPresent(toString, new String[]{ SINGLE_FIELD_TO_SHOW }, new String[]{ SINGLE_FIELD_VALUE_TO_SHOW });
validateIncludeFieldsPresent(toString, new String[]{ SINGLE_FIELD_TO_SHOW }, new String[]{ SINGLE_FIELD_VALUE_TO_SHOW });
}
@Test
public void test_toStringIncludeArray() {
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), FIELDS_TO_SHOW);
this.validateIncludeFieldsPresent(toString, FIELDS_TO_SHOW, FIELDS_VALUES_TO_SHOW);
validateIncludeFieldsPresent(toString, FIELDS_TO_SHOW, FIELDS_VALUES_TO_SHOW);
}
@Test
public void test_toStringIncludeArrayWithNull() {
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), new String[]{null});
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
public void test_toStringIncludeArrayWithNulls() {
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), null, null);
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
@ -96,7 +96,7 @@ public class ReflectionToStringBuilderIncludeTest extends AbstractLangTest {
final List<String> includeList = new ArrayList<>();
includeList.add(SINGLE_FIELD_TO_SHOW);
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), includeList);
this.validateIncludeFieldsPresent(toString, new String[]{ SINGLE_FIELD_TO_SHOW }, new String[]{ SINGLE_FIELD_VALUE_TO_SHOW });
validateIncludeFieldsPresent(toString, new String[]{ SINGLE_FIELD_TO_SHOW }, new String[]{ SINGLE_FIELD_VALUE_TO_SHOW });
}
@Test
@ -104,7 +104,7 @@ public class ReflectionToStringBuilderIncludeTest extends AbstractLangTest {
final List<String> includeList = new ArrayList<>();
includeList.add(null);
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), includeList);
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
@ -113,43 +113,43 @@ public class ReflectionToStringBuilderIncludeTest extends AbstractLangTest {
includeList.add(null);
includeList.add(null);
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), includeList);
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
public void test_toStringIncludeEmptyArray() {
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), ArrayUtils.EMPTY_STRING_ARRAY);
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
public void test_toStringIncludeEmptyCollection() {
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), new ArrayList<>());
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
public void test_toStringIncludeNullArray() {
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), (String[]) null);
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
public void test_toStringIncludeNullArrayMultiplesValues() {
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), null, null, null, null);
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
public void test_toStringIncludeNullCollection() {
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature(), (Collection<String>) null);
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
public void test_toStringIncludeWithoutInformingFields() {
final String toString = ReflectionToStringBuilder.toStringInclude(new TestFeature());
this.validateAllFieldsPresent(toString);
validateAllFieldsPresent(toString);
}
@Test
@ -168,7 +168,7 @@ public class ReflectionToStringBuilderIncludeTest extends AbstractLangTest {
builder.setExcludeFieldNames(FIELDS[1], FIELDS[4]);
builder.setIncludeFieldNames(FIELDS_TO_SHOW);
final String toString = builder.toString();
this.validateIncludeFieldsPresent(toString, FIELDS_TO_SHOW, FIELDS_VALUES_TO_SHOW);
validateIncludeFieldsPresent(toString, FIELDS_TO_SHOW, FIELDS_VALUES_TO_SHOW);
}
@Test
@ -187,7 +187,7 @@ public class ReflectionToStringBuilderIncludeTest extends AbstractLangTest {
builder.setExcludeFieldNames(FIELDS[1], "random1");
builder.setIncludeFieldNames("random2", FIELDS[2]);
final String toString = builder.toString();
this.validateIncludeFieldsPresent(toString, new String[]{FIELDS[2]}, new String[]{VALUES[2]});
validateIncludeFieldsPresent(toString, new String[]{FIELDS[2]}, new String[]{VALUES[2]});
}
@Test
@ -196,7 +196,7 @@ public class ReflectionToStringBuilderIncludeTest extends AbstractLangTest {
builder.setExcludeFieldNames(FIELDS[1], FIELDS[4]);
builder.setIncludeFieldNames(null, null, null);
final String toString = builder.toString();
this.validateIncludeFieldsPresent(toString, new String[]{FIELDS[0], FIELDS[2], FIELDS[3]}, new String[]{VALUES[0], VALUES[2], VALUES[3]});
validateIncludeFieldsPresent(toString, new String[]{FIELDS[0], FIELDS[2], FIELDS[3]}, new String[]{VALUES[0], VALUES[2], VALUES[3]});
}
@Test
@ -205,7 +205,7 @@ public class ReflectionToStringBuilderIncludeTest extends AbstractLangTest {
builder.setExcludeFieldNames(FIELDS[1], FIELDS[4]);
builder.setIncludeFieldNames(null, null, null);
final String toString = builder.toString();
this.validateIncludeFieldsPresent(toString, new String[]{FIELDS[0], FIELDS[2], FIELDS[3]}, new String[]{VALUES[0], VALUES[2], VALUES[3]});
validateIncludeFieldsPresent(toString, new String[]{FIELDS[0], FIELDS[2], FIELDS[3]}, new String[]{VALUES[0], VALUES[2], VALUES[3]});
}
private void validateAllFieldsPresent(final String toString) {
@ -221,7 +221,7 @@ public class ReflectionToStringBuilderIncludeTest extends AbstractLangTest {
assertTrue(toString.indexOf(includeValue) > 0);
}
this.validateNonIncludeFieldsAbsent(toString, fieldsToShow, valuesToShow);
validateNonIncludeFieldsAbsent(toString, fieldsToShow, valuesToShow);
}
private void validateNonIncludeFieldsAbsent(final String toString, final String[] IncludeFields, final String[] IncludeFieldsValues) {