public void testConjunctionVariable() {
    PrologEngine engine = setupConjunction();

    Variable variableX = new Variable("X");
    Variable variableY = new Variable("Y");
    Variable variableZ = new Variable("Z");

    Predicate question = new Predicate("three", 3, variableX, variableY, variableZ);
    Result answer = engine.askQuestion(question);
    assertTrue(answer.hasAnswer());
    assertEquals(new Constant("one"), variableX.getBinding());
    assertEquals(new Constant("two"), variableY.getBinding());
    assertEquals(new Constant("two"), variableZ.getBinding());
    answer.next();
    assertFalse(answer.hasAnswer());
  }
  public void testDisjunctionVariable() {
    PrologEngine engine = setupDisjunction();

    Variable variableY = new Variable("Y");
    Result result3 = engine.askQuestion(new Predicate("hello", 1, variableY));

    assertTrue(result3.hasAnswer());
    assertEquals(new Constant("world"), variableY.getBinding());

    result3.next();
    assertTrue(result3.hasAnswer());
    assertEquals(new Constant("mars"), variableY.getBinding());

    result3.next();
    assertTrue(result3.hasAnswer());
    assertEquals(new Constant("venus"), variableY.getBinding());
  }
  public void testConjunctionBacktrackingVariable() {
    PrologEngine engine = setupConjunctionBacktracking();

    Variable variableX = new Variable("X");

    Predicate question = new Predicate("suitable", 1, variableX);
    Result answer = engine.askQuestion(question);
    assertTrue(answer.hasAnswer());
    assertEquals(new Constant("Eric"), variableX.getBinding());
    answer.next();
    assertFalse("Only one answer expected", answer.hasAnswer());
  }