1 16 17 package test.types; 18 19 import junit.framework.TestCase; 20 import org.apache.axis.types.UnsignedInt; 21 22 25 public class TestUnsignedInt extends TestCase { 26 27 public TestUnsignedInt(String name) { 28 super(name); 29 } 30 31 34 private void runFailTest(long value) throws Exception { 35 UnsignedInt oUnsignedInt = null; 36 try { 37 oUnsignedInt = new UnsignedInt(value); 38 } 39 catch (Exception e) { } 41 assertNull("validation restriction failed [" + 43 String.valueOf(value) + "]. did not restrict bad value.", oUnsignedInt); 44 } 45 46 49 private void runPassTest(long value) throws Exception { 50 UnsignedInt oUnsignedInt = null; 51 try { 52 oUnsignedInt = new UnsignedInt(value); 53 } 54 catch (Exception e) { } 56 assertEquals("unsigned int not equal" + 57 String.valueOf(value), oUnsignedInt.toString(), String.valueOf(value)); 58 } 59 60 63 public void testPositiveValue() throws Exception { 64 runPassTest(100); 65 } 66 67 70 public void testNegativeValue() throws Exception { 71 runFailTest(-100); 72 } 73 74 75 78 public void testMaxInclusive() throws Exception { 79 runPassTest(4294967295L); 80 } 81 82 85 public void testMaxOver() throws Exception { 86 runFailTest(4294967296L); 87 } 88 89 92 public void testMinExclusive() throws Exception { 93 runPassTest(0L); 94 } 95 96 } 97 | Popular Tags |