1 16 17 package test.types; 18 19 import junit.framework.TestCase; 20 import org.apache.axis.types.UnsignedLong; 21 22 25 public class TestUnsignedLong extends TestCase { 26 27 public TestUnsignedLong(String name) { 28 super(name); 29 } 30 31 34 private void runFailTest(double value) throws Exception { 35 UnsignedLong oUnsignedLong = null; 36 try { 37 oUnsignedLong = new UnsignedLong(value); 38 } 39 catch (Exception e) { } 41 assertNull("validation restriction failed [" + 43 String.valueOf(value) + "]. did not restrict bad value.", oUnsignedLong); 44 } 45 46 50 private void runPassTest(double value, String strValue) throws Exception { 51 UnsignedLong oUnsignedLong = null; 52 try { 53 oUnsignedLong = new UnsignedLong(value); 54 } 55 catch (Exception e) { assertTrue("validation error thrown and it shouldn't be", false); 58 } 59 assertEquals("unsigned long not equal: " + 60 String.valueOf(value), strValue, oUnsignedLong.toString()); 61 } 62 63 66 public void testPositiveValue() throws Exception { 67 runPassTest(100, "100"); 68 } 69 70 73 public void testNegativeValue() throws Exception { 74 runFailTest(-100); 75 } 76 77 80 public void testMaxInclusive() throws Exception { 81 runPassTest(123456789, "123456789"); 82 } 83 84 89 94 95 98 public void testMinExclusive() throws Exception { 99 runPassTest(0L, "0"); 100 } 101 102 103 } 104 | Popular Tags |