KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > test > common > HexTestCase


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Forums JBoss Portlet *
6  * *
7  * Distributable under LGPL license. *
8  * See terms of license at gnu.org. *
9  * *
10  *****************************************/

11 package org.jboss.portal.test.common;
12
13 import junit.framework.TestCase;
14 import org.jboss.portal.common.util.Tools;
15
16 import java.util.Arrays JavaDoc;
17
18 /**
19  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
20  * @version $Revision: 1.1 $
21  */

22 public class HexTestCase extends TestCase
23 {
24    public HexTestCase(String JavaDoc s)
25    {
26       super(s);
27    }
28
29    public void testBasic()
30    {
31       byte[] original = new byte[]{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
32       String JavaDoc hex = Tools.toHexString(original);
33       assertEquals("000102030405060708090a0b0c0d0e0f1011121314", hex);
34       byte[] copy = Tools.fromHexString(hex);
35       assertTrue(Arrays.equals(original, copy));
36    }
37 }
38
Popular Tags