File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
test/src/com/rabbitmq/client/test Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -53,4 +53,10 @@ public interface LongString
53
53
* @return the array of bytes containing the content of the {@link LongString}
54
54
*/
55
55
public byte [] getBytes ();
56
+
57
+ /**
58
+ * Get the content as a String. Uses UTF-8 as encoding.
59
+ * @return he content of the {@link LongString} as a string
60
+ */
61
+ public String toString ();
56
62
}
Original file line number Diff line number Diff
8000
line change @@ -24,6 +24,7 @@ public class ClientTests extends TestCase {
24
24
public static TestSuite suite () {
25
25
TestSuite suite = new TestSuite ("client" );
26
26
suite .addTest (TableTest .suite ());
27
+ suite .addTest (LongStringTest .suite ());
27
28
suite .addTest (BlockingCellTest .suite ());
28
29
suite .addTest (TruncatedInputStreamTest .suite ());
29
30
suite .addTest (AMQConnectionTest .suite ());
Original file line number Diff line number Diff line change
1
+ package com .rabbitmq .client .test ;
2
+
3
+ import com .rabbitmq .client .LongString ;
4
+ import com .rabbitmq .client .impl .LongStringHelper ;
5
+ import junit .framework .TestCase ;
6
+ import junit .framework .TestSuite ;
7
+
8
+ import java .io .UnsupportedEncodingException ;
9
+
10
+ public class LongStringTest extends TestCase {
11
+ public static TestSuite suite ()
12
+ {
13
+ TestSuite suite = new TestSuite ("longString" );
14
+ suite .addTestSuite (LongStringTest .class );
15
+ return suite ;
16
+ }
17
+
18
+ public void testToString () throws UnsupportedEncodingException {
19
+ String s = "abcdef" ;
20
+ LongString ls = LongStringHelper .asLongString (s );
21
+
22
+ assertTrue (ls .toString ().equals (s ));
23
+ assertTrue (ls .toString ().equals (new String (ls .getBytes (), "UTF-8" )));
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments