Exemplo n.º 1
0
  // Test unrelated to application, testing xwork package against suspected issue
  // tests all passed, there is no issue
  @Test
  public void testMatch() {
    WildcardHelper wild = new WildcardHelper();
    HashMap<String, String> matchedPatterns = new HashMap<String, String>();
    int[] pattern = wild.compilePattern("*b*");
    assertEquals(wild.match(matchedPatterns, "b", pattern), true);
    assertEquals(wild.match(matchedPatterns, "abc", pattern), true);
    assertEquals(wild.match(matchedPatterns, "xxx", pattern), false);

    pattern = wild.compilePattern("*_*");
    assertEquals(wild.match(matchedPatterns, "a_a", pattern), true);
    assertEquals(wild.match(matchedPatterns, "a", pattern), false);
  }
 public boolean find() {
   found = wh.match(resultMap, matchStr, compiledPattern);
   return found;
 }
 public WildcardMatcher(WildcardHelper wh, String patternStr, String matchStr) {
   this.wh = wh;
   this.compiledPattern = wh.compilePattern(patternStr);
   this.matchStr = matchStr;
 }