change method names, move package

This commit is contained in:
Ricardo Caldas 2020-06-10 08:03:34 -03:00
parent 78d3c27e1f
commit e2fb716010
1 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
package com.baeldung.arraystostring;
package com.baeldung.arrays;
import org.junit.Test;
@ -19,20 +19,20 @@ public class JavaArraysToStringUnitTest {
}
@Test
public void givenInstanceOfArray_useArraysToStringToConvert_thenValueOfObjectsAreShown() {
public void givenInstanceOfArray_whenUsingArraysToStringToConvert_thenValueOfObjectsAreShown() {
Object[] arrayOfObjects = { "John", 2, true };
assertEquals(Arrays.toString(arrayOfObjects), "[John, 2, true]");
}
@Test
public void givenInstanceOfDeepArray_userArraysDeepToStringToConvert_thenValueOfInnerObjectsAreShown() {
public void givenInstanceOfDeepArray_whenUsingArraysDeepToStringToConvert_thenValueOfInnerObjectsAreShown() {
Object[] innerArray = { "We", "Are", "Inside" };
Object[] arrayOfObjects = { "John", 2, innerArray };
assertEquals(Arrays.deepToString(arrayOfObjects), "[John, 2, [We, Are, Inside]]");
}
@Test
public void givenInstanceOfDeepArray_useStreamsToConvert_thenValueOfObjectsAreShown() {
public void givenInstanceOfDeepArray_whenUsingStreamsToConvert_thenValueOfObjectsAreShown() {
Object[] arrayOfObjects = { "John", 2, true };
List<String> listOfString = Stream.of(arrayOfObjects)
.map(Object::toString)