1 19 20 package org.lucane.common.net; 21 22 import junit.framework.*; 23 24 public class IntToByteTest extends TestCase 25 { 26 public IntToByteTest(String title) 27 { 28 super(title); 29 } 30 31 public void testZero() 32 { 33 int initial = 0; 34 byte[] temp = ObjectConnection.intToBytes(initial); 35 int converted = ObjectConnection.bytesToInt(temp); 36 Assert.assertEquals(initial, converted); 37 } 38 39 public void testMax() 40 { 41 int initial = Integer.MAX_VALUE; 42 byte[] temp = ObjectConnection.intToBytes(initial); 43 int converted = ObjectConnection.bytesToInt(temp); 44 Assert.assertEquals(initial, converted); 45 } 46 47 public void testOther() 48 { 49 int initial = 5635732; 50 byte[] temp = ObjectConnection.intToBytes(initial); 51 int converted = ObjectConnection.bytesToInt(temp); 52 Assert.assertEquals(initial, converted); 53 } 54 } | Popular Tags |