1 21 22 package org.apache.commons.validator; 23 24 import junit.framework.Test; 25 import junit.framework.TestSuite; 26 27 30 public class ShortTest extends TestNumber { 31 32 public ShortTest(String name) { 33 super(name); 34 FORM_KEY = "shortForm"; 35 ACTION = "short"; 36 } 37 38 43 public static void main(String [] theArgs) { 44 junit.awtui.TestRunner.main(new String [] {ShortTest.class.getName()}); 45 } 46 47 51 public static Test suite() { 52 return new TestSuite(ShortTest.class); 54 } 55 56 59 public void testShortMin() throws ValidatorException { 60 ValueBean info = new ValueBean(); 62 info.setValue(new Short (Short.MIN_VALUE).toString()); 63 64 valueTest(info, true); 65 } 66 67 70 public void testShortMax() throws ValidatorException { 71 ValueBean info = new ValueBean(); 73 info.setValue(new Short (Short.MAX_VALUE).toString()); 74 75 valueTest(info, true); 76 } 77 78 81 public void testShortBeyondMin() throws ValidatorException { 82 ValueBean info = new ValueBean(); 84 info.setValue(Short.MIN_VALUE + "1"); 85 86 valueTest(info, false); 87 } 88 89 92 public void testShortBeyondMax() throws ValidatorException { 93 ValueBean info = new ValueBean(); 95 info.setValue(Short.MAX_VALUE + "1"); 96 97 valueTest(info, false); 98 } 99 } | Popular Tags |