Break up testIdentityToStringStringBuilder into multiple test methods.
This commit is contained in:
parent
4f928504ea
commit
22c3047156
|
@ -192,11 +192,27 @@ public class ObjectUtilsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIdentityToStringStringBuilder() {
|
||||
public void testIdentityToStringObjectNull() {
|
||||
assertNull(ObjectUtils.identityToString(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIdentityToStringInteger() {
|
||||
final Integer i = Integer.valueOf(90);
|
||||
final String expected = "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(i));
|
||||
|
||||
assertEquals(expected, ObjectUtils.identityToString(i));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIdentityToStringString() {
|
||||
assertEquals(
|
||||
"java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)),
|
||||
ObjectUtils.identityToString(FOO));
|
||||
"java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)),
|
||||
ObjectUtils.identityToString(FOO));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIdentityToStringStringBuilder() {
|
||||
final Integer i = Integer.valueOf(90);
|
||||
final String expected = "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(i));
|
||||
|
||||
|
@ -205,15 +221,21 @@ public class ObjectUtilsTest {
|
|||
final StringBuilder builder = new StringBuilder();
|
||||
ObjectUtils.identityToString(builder, i);
|
||||
assertEquals(expected, builder.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIdentityToStringStringBuilderNullValue() {
|
||||
try {
|
||||
ObjectUtils.identityToString((StringBuilder)null, "tmp");
|
||||
ObjectUtils.identityToString(new StringBuilder(), null);
|
||||
fail("NullPointerException expected");
|
||||
} catch(final NullPointerException npe) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIdentityToStringStringBuilderNullStringBuilder() {
|
||||
try {
|
||||
ObjectUtils.identityToString(new StringBuilder(), null);
|
||||
ObjectUtils.identityToString((StringBuilder)null, "tmp");
|
||||
fail("NullPointerException expected");
|
||||
} catch(final NullPointerException npe) {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue