Package org.apache.wicket.util.parse.metapattern

Examples of org.apache.wicket.util.parse.metapattern.MetaPattern.matcher()


  @Test
  public void testStandardUrlSegmentPattern()
  {
    MetaPattern pattern = new MetaPattern(AbstractURLSegment.SEGMENT_PARAMETER);

    Matcher matcher = pattern.matcher("");
    assertFalse(matcher.matches());

    matcher = pattern.matcher("seg&ment");
    assertFalse(matcher.matches());
View Full Code Here


    MetaPattern pattern = new MetaPattern(AbstractURLSegment.SEGMENT_PARAMETER);

    Matcher matcher = pattern.matcher("");
    assertFalse(matcher.matches());

    matcher = pattern.matcher("seg&ment");
    assertFalse(matcher.matches());

    matcher = pattern.matcher("segment:");
    assertFalse(matcher.matches());
View Full Code Here

    assertFalse(matcher.matches());

    matcher = pattern.matcher("seg&ment");
    assertFalse(matcher.matches());

    matcher = pattern.matcher("segment:");
    assertFalse(matcher.matches());

    matcher = pattern.matcher("{*}");
    assertFalse(matcher.matches());

 
View Full Code Here

    assertFalse(matcher.matches());

    matcher = pattern.matcher("segment:");
    assertFalse(matcher.matches());

    matcher = pattern.matcher("{*}");
    assertFalse(matcher.matches());

    matcher = pattern.matcher("{segment}");
    assertTrue(matcher.matches());

View Full Code Here

    assertFalse(matcher.matches());

    matcher = pattern.matcher("{*}");
    assertFalse(matcher.matches());

    matcher = pattern.matcher("{segment}");
    assertTrue(matcher.matches());

    matcher = pattern.matcher("{segment0} a segment {segment1} another segment {segment2}");
    assertTrue(matcher.find());

View Full Code Here

    assertFalse(matcher.matches());

    matcher = pattern.matcher("{segment}");
    assertTrue(matcher.matches());

    matcher = pattern.matcher("{segment0} a segment {segment1} another segment {segment2}");
    assertTrue(matcher.find());

    matcher.reset();
    assertFalse(matcher.matches());
View Full Code Here

    assertTrue(matcher.find());

    matcher.reset();
    assertFalse(matcher.matches());

    matcher = pattern.matcher("{117}");
    assertFalse(matcher.matches());

    pattern = new MetaPattern(AbstractURLSegment.REGEXP_BODY);
    matcher = pattern.matcher("[0-9]*:abba");
    assertTrue(matcher.matches());
 
View Full Code Here

    matcher = pattern.matcher("{117}");
    assertFalse(matcher.matches());

    pattern = new MetaPattern(AbstractURLSegment.REGEXP_BODY);
    matcher = pattern.matcher("[0-9]*:abba");
    assertTrue(matcher.matches());

    matcher = pattern.matcher("^\\(?\\d{3}\\)?[ -]?\\d{3}[ -]?\\d{4}$anotherseg");
    assertTrue(matcher.matches());
  }
View Full Code Here

    pattern = new MetaPattern(AbstractURLSegment.REGEXP_BODY);
    matcher = pattern.matcher("[0-9]*:abba");
    assertTrue(matcher.matches());

    matcher = pattern.matcher("^\\(?\\d{3}\\)?[ -]?\\d{3}[ -]?\\d{4}$anotherseg");
    assertTrue(matcher.matches());
  }

  @Test
  public void testMatrixParameters()
View Full Code Here

    assertEquals(paramSegment.getParamName(), "id");
    assertEquals(paramSegment.getMetaPattern().toString(), "[0-9]*:abba");

    MetaPattern metaPattern = paramSegment.getMetaPattern();

    assertTrue(metaPattern.matcher("1:abba").matches());
    assertTrue(metaPattern.matcher("1234521:abba").matches());
    assertTrue(metaPattern.matcher(":abba").matches());

    String segmentMultiParam = "{segment0}asegment{segment1:^\\(?\\d{3}\\)?[ -]?\\d{3}[ -]?\\d{4}$}anotherseg";
    segment = AbstractURLSegment.newSegment(segmentMultiParam);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.