KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > util > HexFormatterTest


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: HexFormatterTest.java,v 1.12 2006/10/30 21:14:53 bostic Exp $
7  */

8
9 package com.sleepycat.je.util;
10
11 import junit.framework.TestCase;
12
13 import com.sleepycat.je.utilint.HexFormatter;
14
15 /**
16  * Trivial formatting class that sticks leading 0's on the front of a hex
17  * number.
18  */

19 public class HexFormatterTest extends TestCase {
20     public void testFormatLong() {
21     assertTrue(HexFormatter.formatLong(0).equals("0x0000000000000000"));
22     assertTrue(HexFormatter.formatLong(1).equals("0x0000000000000001"));
23     assertTrue(HexFormatter.formatLong(0x1234567890ABCDEFL).equals("0x1234567890abcdef"));
24     assertTrue(HexFormatter.formatLong(0x1234567890L).equals("0x0000001234567890"));
25     assertTrue(HexFormatter.formatLong(0xffffffffffffffffL).equals("0xffffffffffffffff"));
26     }
27 }
28
Popular Tags