RecursiveToStringStyleTest now uses correct ToStringStyle in tests.
Thanks to Dominik Stadler for patch.
This commit is contained in:
parent
2d6dea18b0
commit
41bc4cd029
|
@ -35,7 +35,7 @@ public class RecursiveToStringStyleTest {
|
|||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE);
|
||||
ToStringBuilder.setDefaultStyle(new RecursiveToStringStyle());
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -64,14 +64,17 @@ public class RecursiveToStringStyleTest {
|
|||
public void testObject() {
|
||||
final Integer i3 = Integer.valueOf(3);
|
||||
final Integer i4 = Integer.valueOf(4);
|
||||
final ArrayList<Object> emptyList = new ArrayList<>();
|
||||
|
||||
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) null).toString());
|
||||
assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).toString());
|
||||
assertEquals(baseStr + "[a=<null>]", new ToStringBuilder(base).append("a", (Object) null).toString());
|
||||
assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).toString());
|
||||
assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString());
|
||||
assertEquals(baseStr + "[a=<Integer>]", new ToStringBuilder(base).append("a", i3, false).toString());
|
||||
assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString());
|
||||
assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString());
|
||||
assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", emptyList, false).toString());
|
||||
assertEquals(baseStr + "[a=java.util.ArrayList@" + Integer.toHexString(System.identityHashCode(emptyList)) + "{}]",
|
||||
new ToStringBuilder(base).append("a", emptyList, true).toString());
|
||||
assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString());
|
||||
assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString());
|
||||
assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString());
|
||||
|
|
Loading…
Reference in New Issue