1 20 21 package com.tonicsystems.jarjar; 22 23 import junit.framework.*; 24 25 public class WildcardTest 26 extends TestCase 27 { 28 public void testWildcards() { 29 identifier("net.sf.cglib.**", "foo.@1", "net.sf.cglib.Bar", "foo.Bar"); 30 identifier("net.sf.cglib.**", "foo.@1", "net.sf.cglib.", "foo."); 31 identifier("net.sf.cglib.**", "foo.@1", "net.sf.cglib.!", null); 32 } 33 34 private void identifier(String pattern, String result, String value, String expect) { 35 helper(pattern, result, value, expect, Wildcard.STYLE_IDENTIFIER); 36 } 37 38 private void descriptor(String pattern, String result, String value, String expect) { 39 helper(pattern, result, value, expect, Wildcard.STYLE_DESC); 40 } 41 42 private void helper(String pattern, String result, String value, String expect, int style) { 43 Wildcard wc = new Wildcard(pattern, result); 44 assertEquals(expect, wc.replace(value, style)); 46 } 47 48 public WildcardTest(String name) { 49 super(name); 50 } 51 52 public static Test suite() { 53 return new TestSuite(WildcardTest.class); 54 } 55 } 56 | Popular Tags |