1 package org.apache.maven.surefire.util.internal;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.framework.TestCase;
23
24
25
26
27 public class StringUtilsTest
28 extends TestCase
29 {
30
31 public void testUnescape()
32 {
33 byte[] buffer = new byte[80];
34 final int abc = StringUtils.unescapeJava( buffer, "ABC" );
35 assertEquals( 3, abc );
36 }
37
38 public void testUnescapeWithEscape()
39 {
40 byte[] buffer = new byte[80];
41 final int abc = StringUtils.unescapeJava( buffer, "AB\tC" );
42 assertEquals( 4, abc );
43 }
44
45 public void testEscape()
46 {
47 ByteBuffer buffer = new ByteBuffer( 80 );
48 StringUtils.escapeJavaStyleString( buffer, "AB\tC".getBytes(), 0, 4 );
49 assertEquals( 5, buffer.getlength() );
50 String temp = buffer.toString();
51 assertEquals( "AB\\tC", temp );
52
53 }
54
55 }