1   package com.sourceforge.jpatterns.core;
2   
3   import junit.framework.TestCase;
4   
5   /**
6    * JPConstants Tester.
7    *
8    * $Author:: zmicer             $<br/>
9    * $Rev:: 57                    $<br/> * $Date:: 2007-08-23 09:16:37 #$<br/>
10   * $Date:: 2007-08-23 09:16:37 #$<br/>
11   */
12  public class JPConstantsTest extends TestCase
13  {
14      /**
15       * Default tester constructor
16       * @param name name of the test
17       */
18      public JPConstantsTest(String name)
19      {
20          super(name);
21      }
22  
23      /**
24       * Check the regexp pattern we are using for the
25       */
26      public void testREPattern()
27      {
28          assertFalse(JPConstants.PATTERN.matcher("jpatterns").matches());
29          assertTrue(JPConstants.PATTERN.matcher("jpatterns.xml").matches());
30          assertTrue(JPConstants.PATTERN.matcher("jpatternsfefwfe.xml").matches());
31          assertTrue(JPConstants.PATTERN.matcher("jpatterns_fefwfe.xml").matches());
32          assertTrue(JPConstants.PATTERN.matcher("scsdvjpatterns_fefwfe.xml").matches());
33          assertFalse(JPConstants.PATTERN.matcher("scsdvj_patterns_fefwfe.xml").matches());
34          assertTrue(JPConstants.PATTERN.matcher("scsdv_jpatterns_fefwfe.xml").matches());
35          assertFalse(JPConstants.PATTERN.matcher("jpatternsxml").matches());
36          assertFalse(JPConstants.PATTERN.matcher("jpatterns_config").matches());
37          assertFalse(JPConstants.PATTERN.matcher("jpatterns_config_2").matches());
38          assertTrue(JPConstants.PATTERN.matcher("jpatterns_config.xml").matches());
39          assertTrue(JPConstants.PATTERN.matcher("jpatterns_config_2.xml").matches());
40  
41          // checking the exclude part of the pattern: default configuration
42          assertFalse(JPConstants.PATTERN.matcher("jpatterns_framework.xml").matches());
43          assertTrue(JPConstants.PATTERN.matcher("ddjpatterns_framework.xml").matches());
44          assertTrue(JPConstants.PATTERN.matcher("jpatterns_tframework.xml").matches());
45          assertTrue(JPConstants.PATTERN.matcher("jpatterns_frameworkt.xml").matches());
46  
47          // checking the exclude part of the pattern: custom configuration
48          assertFalse(JPConstants.PATTERN.matcher("jpatterns_framework_custom.xml").matches());
49          assertTrue(JPConstants.PATTERN.matcher("ddjpatterns_framework_custom.xml").matches());
50          assertTrue(JPConstants.PATTERN.matcher("jpatterns_tframework_custom.xml").matches());
51          assertTrue(JPConstants.PATTERN.matcher("jpatterns_frameworkt_custom.xml").matches());
52          assertTrue(JPConstants.PATTERN.matcher("jpatterns_frameworkt_ecustom.xml").matches());
53          assertTrue(JPConstants.PATTERN.matcher("jpatterns_frameworktecustom.xml").matches());
54          assertTrue(JPConstants.PATTERN.matcher("jpatterns_frameworkcustom.xml").matches());
55      }
56  }