1 package org.sapia.validator.rules; 2 3 import org.sapia.validator.*; 4 5 import junit.framework.TestCase; 6 7 15 public class MaxLongTest extends TestCase{ 16 17 20 public MaxLongTest(String name) { 21 super(name); 22 } 23 24 public void testMaxLong() 25 throws Exception { 26 Vlad v = new Vlad(); 27 RuleSet rs = new RuleSet(); 28 29 rs.setId("max"); 30 31 MaxLong m = new MaxLong(); 32 33 m.setValue(5); 34 rs.addValidatable(m); 35 v.addRuleSet(rs); 36 37 Status st = v.validate("max", new Long (6), java.util.Locale.getDefault()); 38 super.assertTrue("Check failed", st.isError()); 39 40 st = v.validate("max", new Long (5), java.util.Locale.getDefault()); 41 super.assertTrue("Check failed", !st.isError()); 42 43 st = v.validate("max", new Long (4), java.util.Locale.getDefault()); 44 super.assertTrue("Check failed", !st.isError()); 45 } 46 47 } 48 | Popular Tags |