1 package org.jacorb.test.notification.util.regexp; 2 3 22 23 import junit.framework.TestCase; 24 import org.jacorb.notification.util.PatternWrapper; 25 26 30 31 public abstract class AbstractPatternWrapperTest extends TestCase 32 { 33 protected PatternWrapper objectUnderTest_; 34 35 public AbstractPatternWrapperTest(String name) 36 { 37 super(name); 38 } 39 40 public final void setUp() 41 { 42 objectUnderTest_ = newPattern(); 43 } 44 45 protected abstract PatternWrapper newPattern(); 46 47 public void testNoMatch() 48 { 49 objectUnderTest_.compile("abc*d"); 50 51 String test = "xyzdef"; 52 53 assertEquals(0, objectUnderTest_.match(test)); 54 } 55 56 public void testMatch() 57 { 58 objectUnderTest_.compile("abc*d"); 59 60 String test = "abcccccccd"; 61 62 int i = objectUnderTest_.match(test); 63 64 assertEquals(10, i); 65 } 66 67 public void testToString() 68 { 69 String pattern = "a*b*d"; 70 71 objectUnderTest_.compile(pattern); 72 73 assertEquals(pattern, objectUnderTest_.toString()); 74 } 75 } 76 | Popular Tags |