1 /* 2 * $Header: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/ShortTest.java,v 1.14 2004/02/21 17:10:30 rleland Exp $ 3 * $Revision: 1.14 $ 4 * $Date: 2004/02/21 17:10:30 $ 5 * 6 * ==================================================================== 7 * Copyright 2001-2004 The Apache Software Foundation 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22 package org.apache.commons.validator; 23 24 import junit.framework.Test; 25 import junit.framework.TestSuite; 26 27 /*** 28 * Performs Validation Test for <code>short</code> validations. 29 */ 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 /*** 39 * Start the tests. 40 * 41 * @param theArgs the arguments. Not used 42 */ 43 public static void main(String[] theArgs) { 44 junit.awtui.TestRunner.main(new String[] {ShortTest.class.getName()}); 45 } 46 47 /*** 48 * @return a test suite (<code>TestSuite</code>) that includes all methods 49 * starting with "test" 50 */ 51 public static Test suite() { 52 // All methods starting with "test" will be executed in the test suite. 53 return new TestSuite(ShortTest.class); 54 } 55 56 /*** 57 * Tests the short validation. 58 */ 59 public void testShortMin() throws ValidatorException { 60 // Create bean to run test on. 61 ValueBean info = new ValueBean(); 62 info.setValue(new Short(Short.MIN_VALUE).toString()); 63 64 valueTest(info, true); 65 } 66 67 /*** 68 * Tests the short validation. 69 */ 70 public void testShortMax() throws ValidatorException { 71 // Create bean to run test on. 72 ValueBean info = new ValueBean(); 73 info.setValue(new Short(Short.MAX_VALUE).toString()); 74 75 valueTest(info, true); 76 } 77 78 /*** 79 * Tests the short validation failure. 80 */ 81 public void testShortBeyondMin() throws ValidatorException { 82 // Create bean to run test on. 83 ValueBean info = new ValueBean(); 84 info.setValue(Short.MIN_VALUE + "1"); 85 86 valueTest(info, false); 87 } 88 89 /*** 90 * Tests the short validation failure. 91 */ 92 public void testShortBeyondMax() throws ValidatorException { 93 // Create bean to run test on. 94 ValueBean info = new ValueBean(); 95 info.setValue(Short.MAX_VALUE + "1"); 96 97 valueTest(info, false); 98 } 99 }

This page was automatically generated by Maven