Make the var a constant, and add comments

This commit is contained in:
Bruno P. Kinoshita 2017-06-07 19:24:52 +12:00
parent 0344ca3f2d
commit c68285bb33
1 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,8 @@ import org.junit.Test;
*/
public class ToStringBuilderTest {
private final Integer arraylistInitialCapacity = Integer.valueOf(10);
// See LANG-1337 for more.
private static final int ARRAYLIST_INITIAL_CAPACITY = 10;
private final Integer base = Integer.valueOf(5);
private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
@ -317,7 +318,8 @@ public class ToStringBuilderTest {
// representation different for IBM JDK 1.6.0, LANG-727
assumeFalse("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION));
assumeFalse("Oracle Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".compareTo(SystemUtils.JAVA_SPECIFICATION_VERSION) < 0);
final List<Object> list = new ArrayList<>(arraylistInitialCapacity);
// LANG-1337 without this, the generated string can differ depending on the JVM version/vendor
final List<Object> list = new ArrayList<>(ARRAYLIST_INITIAL_CAPACITY);
final String baseString = this.toBaseString(list);
final String expectedWithTransients = baseString + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]";
final String toStringWithTransients = ToStringBuilder.reflectionToString(list, null, true);