1 package org.sapia.validator; 2 3 import java.util.HashMap ; 4 import java.util.Locale ; 5 import java.util.Map ; 6 7 import junit.framework.TestCase; 8 9 public class ValidationContextTest extends TestCase{ 10 11 public ValidationContextTest(String name) { 12 super(name); 13 } 14 15 public void testGetLocals(){ 16 Map globals = new HashMap (); 17 Map locals = new HashMap (); 18 ValidationContext ctx = new ValidationContext( 19 globals, 20 "toValidate", 21 null, 22 Locale.ENGLISH, 23 locals); 24 25 super.assertTrue(ctx.get("test") == null); 26 globals.put("test", "value"); 27 super.assertTrue(ctx.get("test").equals("value")); 28 globals.put("test", "null"); 29 locals.put("test", "value"); 30 31 ctx = new ValidationContext( 32 globals, 33 "toValidate", 34 null, 35 Locale.ENGLISH, 36 locals); 37 super.assertTrue(ctx.get("test").equals("value")); 38 } 39 } 40 | Popular Tags |