1 package org.displaytag.util; 2 3 import junit.framework.TestCase; 4 5 6 11 public class ParamEncoderTest extends TestCase 12 { 13 14 17 public String getName() 18 { 19 return getClass().getName() + "." + super.getName(); 20 } 21 22 25 public void testOptionAndAnswer() 26 { 27 assertFalse("id \"option\" and \"answer\" produce the same parameter", new ParamEncoder("option") 28 .encodeParameterName("x") 29 .equals(new ParamEncoder("answer").encodeParameterName("x"))); 30 } 31 32 35 public void testEquals() 36 { 37 assertEquals("The same parameter should produce equals key.", new ParamEncoder("equals") 38 .encodeParameterName("x"), (new ParamEncoder("equals").encodeParameterName("x"))); 39 } 40 41 44 public void testNotTooLong() 45 { 46 assertTrue(new ParamEncoder("averyveryveryveryveryveryverylongidvalue").encodeParameterName("x").length() < 12); 47 assertTrue(new ParamEncoder("test").encodeParameterName("x").length() < 12); 48 assertTrue(new ParamEncoder("a").encodeParameterName("x").length() < 12); 49 assertTrue(new ParamEncoder("xxxxxxxxxxxx").encodeParameterName("x").length() < 12); 50 assertTrue(new ParamEncoder("xxxxxxxxxxxxxxxxxxxxxxxxxxxx").encodeParameterName("x").length() < 12); 51 } 52 } 53 | Popular Tags |