use of com.yahoo.athenz.zpe.ZpeUpdPolLoader in project athenz by yahoo.
the class TestZpeMatch method testGetMatchAll.
@Test
public void testGetMatchAll() {
try (ZpeUpdPolLoader loader = new ZpeUpdPolLoader(null)) {
ZpeMatch matchObject = loader.getMatchObject("*");
assertTrue(matchObject instanceof ZpeMatchAll);
assertTrue(matchObject.matches("abc"));
assertTrue(matchObject.matches("false"));
assertTrue(matchObject.matches("whatever"));
}
}
use of com.yahoo.athenz.zpe.ZpeUpdPolLoader in project athenz by yahoo.
the class TestZpeMatch method testGetMatchEqual.
@Test
public void testGetMatchEqual() {
try (ZpeUpdPolLoader loader = new ZpeUpdPolLoader(null)) {
ZpeMatch matchObject = loader.getMatchObject("coretech");
assertTrue(matchObject instanceof ZpeMatchEqual);
assertTrue(matchObject.matches("coretech"));
// failures
// random data
assertFalse(matchObject.matches("whatever"));
// extra A
assertFalse(matchObject.matches("coretechA"));
// missing h
assertFalse(matchObject.matches("coretec"));
}
}
use of com.yahoo.athenz.zpe.ZpeUpdPolLoader in project athenz by yahoo.
the class TestZpeMatch method testGetMatchStartsWith.
@Test
public void testGetMatchStartsWith() {
try (ZpeUpdPolLoader loader = new ZpeUpdPolLoader(null)) {
ZpeMatch matchObject = loader.getMatchObject("coretech*");
assertTrue(matchObject instanceof ZpeMatchStartsWith);
assertTrue(matchObject.matches("coretech"));
assertTrue(matchObject.matches("coretechtest"));
assertTrue(matchObject.matches("coretechtesttest"));
// failures
// random data
assertFalse(matchObject.matches("whatever"));
// missing h
assertFalse(matchObject.matches("coretec"));
// missing h + extra A
assertFalse(matchObject.matches("coretecA"));
}
}
use of com.yahoo.athenz.zpe.ZpeUpdPolLoader in project athenz by yahoo.
the class TestZpeMatch method testGetMatchRegex.
@Test
public void testGetMatchRegex() {
try (ZpeUpdPolLoader loader = new ZpeUpdPolLoader(null)) {
ZpeMatch matchObject = loader.getMatchObject("coretech?test*");
assertTrue(matchObject instanceof ZpeMatchRegex);
assertTrue(matchObject.matches("coretechAtest"));
assertTrue(matchObject.matches("coretechbtestgreat"));
// failures
// random data
assertFalse(matchObject.matches("whatever"));
// missing ?
assertFalse(matchObject.matches("coretechtestgreat"));
}
}
Aggregations