add test about the byte and the char of return and new line

This commit is contained in:
coderfengyun 2013-12-12 14:14:20 +08:00
parent bb612da6f6
commit 30c658adb8
1 changed files with 12 additions and 3 deletions

View File

@ -6,10 +6,19 @@ import org.junit.Test;
public class byteTest {
@Test
public void testByte() {
public void testByteForNewLine() {
Byte byte1 = Byte.parseByte("10");
assertTrue(byte1.byteValue() == 10);
// char ch = Character.
System.out.println(byte1.byteValue());
char ch = (char) byte1.byteValue();
assertEquals('\n', ch);
System.out.println(ch);
}
@Test
public void testByteForReturn() {
Byte byte2 = Byte.parseByte("13");
char ch = (char) byte2.byteValue();
assertEquals('\r', ch);
System.out.println(ch);
}
}