added to test class for string to char array char array to string conversion
This commit is contained in:
parent
4018d45a2c
commit
b6bb1e18d4
@ -0,0 +1,25 @@
|
||||
package com.baeldung.java.conversion;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class StringCharArrayConversionTest {
|
||||
|
||||
@Test
|
||||
public void stringToCharArray() throws Exception {
|
||||
String beforeConvCharArr = "Text";
|
||||
char[] afterConvCharArr = {'T','e','x','t'};
|
||||
|
||||
assertArrayEquals(beforeConvCharArr.toCharArray(),afterConvCharArr);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void charArrayToString() throws Exception {
|
||||
char[] beforeConvStr = {'T','e','x','t'};
|
||||
String afterConvStr = "Text";
|
||||
|
||||
assertEquals(String.valueOf(beforeConvStr),afterConvStr);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user