Пример #1
0
  public void testSingleTerm() {
    Parser p = new Parser();
    Node n = p.parse("class foo");

    Evaluator ev = ((NodeImpl) n).getEvaluator();
    ClassNameEvaluator cne = (ClassNameEvaluator) ev;

    assertEquals("foo", cne.getClassName());
  }
Пример #2
0
  public void testOr() {
    Parser p = new Parser();

    NodeImpl n = (NodeImpl) p.parse("property foo or class bar");

    assertTrue(n.getEvaluator() instanceof OrEvaluator);

    NodeImpl n2 = (NodeImpl) n.getLeft();
    PropertyEvaluator ev1 = (PropertyEvaluator) n2.getEvaluator();

    assertEquals("foo", ev1.getPropertyName());

    NodeImpl n3 = (NodeImpl) n.getRight();
    ClassNameEvaluator ev2 = (ClassNameEvaluator) n3.getEvaluator();

    assertEquals("bar", ev2.getClassName());
  }