1 package info.magnolia.cms.util; 2 3 import junit.framework.TestCase; 4 5 6 11 public class SimpleUrlPatternTest extends TestCase { 12 13 16 public void testNoWildcardsMatch() { 17 assertTrue(new SimpleUrlPattern("/test/url.html").match("/test/url.html")); 18 } 19 20 23 public void testNoWildcardsNoMatch() { 24 assertFalse(new SimpleUrlPattern("/test/url.html").match("/test/secondurl.html")); 25 } 26 27 30 public void testStarMatch() { 31 assertTrue(new SimpleUrlPattern("/test/*.html").match("/test/url.html")); 32 } 33 34 37 public void testStarNoMatch() { 38 assertFalse(new SimpleUrlPattern("/test/*.html").match("/other/url.html")); 39 } 40 41 44 public void testStarMatch2() { 45 assertTrue(new SimpleUrlPattern("/*/*.html").match("/test/url.html")); 46 } 47 48 51 public void testStarNoMatch2() { 52 assertFalse(new SimpleUrlPattern("/*/*.html").match("/test/url.jsp")); 53 } 54 55 58 public void testStarMatch3() { 59 assertTrue(new SimpleUrlPattern("/**/*.html").match("/test/url.html")); 60 } 61 62 65 public void testStarNoMatch3() { 66 assertFalse(new SimpleUrlPattern("/**/*.html").match("/test/url.jsp")); 67 } 68 69 72 public void testStarMatch4() { 73 assertTrue(new SimpleUrlPattern("/**/*.html").match("/test/dir/dir/url.html")); 74 } 75 76 79 public void testStarNoMatch4() { 80 assertFalse(new SimpleUrlPattern("/**/*.html").match("/test/dir/dir/url.jsp")); 81 } 82 83 86 public void testQuestionMarkMatch() { 87 assertTrue(new SimpleUrlPattern("/test/num?page.html").match("/test/num2page.html")); 88 } 89 90 93 public void testWildcardsMatch() { 94 assertTrue(new SimpleUrlPattern("/*/num?page.html").match("/*/num2page.html")); 95 } 96 97 } 98 | Popular Tags |