1 package org.apache.velocity.test; 2 3 18 19 import junit.framework.TestCase; 20 import junit.framework.Test; 21 22 import org.apache.velocity.util.StringUtils; 23 24 31 public class MiscTestCase extends BaseTestCase 32 { 33 public MiscTestCase() 34 { 35 super("MiscTestCase"); 36 } 37 38 public MiscTestCase (String name) 39 { 40 super(name); 41 } 42 43 public static Test suite () 44 { 45 return new MiscTestCase(); 46 } 47 48 public void runTest() 49 { 50 53 54 String eol = "XY"; 55 56 String arg = "XY"; 57 String res = StringUtils.chop(arg, 1, eol ); 58 assertTrue( "Test 1", res.equals("") ); 59 60 arg = "X"; 61 res = StringUtils.chop( arg, 1, eol ); 62 assertTrue( "Test 2", res.equals("") ); 63 64 arg = "ZXY"; 65 res = StringUtils.chop( arg, 1, eol ); 66 assertTrue( "Test 3", res.equals("Z") ); 67 68 69 arg = "Hello!"; 70 res = StringUtils.chop( arg, 2, eol ); 71 assertTrue( "Test 4", res.equals("Hell")); 72 73 } 74 75 } 76 | Popular Tags |