Example #1
0
  @Test
  public void RegexToLike() {
    assertEquals("%", like(ConstantImpl.create(".*")));
    assertEquals("_", like(ConstantImpl.create(".")));

    StringPath path = new StringPath("path");
    assertEquals("path + %", like(path.append(".*")));
    assertEquals("% + path", like(path.prepend(".*")));
    assertEquals("path + _", like(path.append(".")));
    assertEquals("_ + path", like(path.prepend(".")));
  }
Example #2
0
  @Test
  public void LikeToRegex() {
    assertEquals(".*", regex(ConstantImpl.create("%")));
    assertEquals(".", regex(ConstantImpl.create("_")));

    StringPath path = new StringPath("path");
    assertEquals("path + .*", regex(path.append("%")));
    assertEquals(".* + path", regex(path.prepend("%")));
    assertEquals("path + .", regex(path.append("_")));
    assertEquals(". + path", regex(path.prepend("_")));
  }