}
private void answerOfTest(Survey model) {
model.addInsertQuestionListener(this);
checkQuestionCount(3, model);
Question y = model.getQuestionByID("Y");
Question a = model.getQuestionByID("A");
y.setAnswer("yes");
Question x = model.getQuestionByID("X");
assertTrue(a.isEnabled());
assertFalse(x.isVisible());
checkQuestionCount(4, model);
Question x1 = model.getQuestionByID("X1");
assertTrue(x1.isVisible());
assertTrue(a.isEnabled());
assertEquals("setVisible(\"X1\", true);", x1.getOnAnswerChanged());
assertEquals(x1, lastQuestionInserted);
assertEquals(0, lastPageInserted);
assertEquals(2, lastRowInserted);
y.setAnswer("no"); //nothing changes
assertFalse(x.isVisible());
assertTrue(x1.isVisible());
assertEquals(x1, lastQuestionInserted);
assertEquals(0, lastPageInserted);
assertEquals(2, lastRowInserted);
x1.setAnswer("no");
assertFalse(a.isEnabled());
y.setAnswer("yes");
checkQuestionCount(5, model);
Question x2 = model.getQuestionByID("X2");
assertTrue(x2.isVisible());
assertTrue(x1.isVisible());
assertFalse(x.isVisible());
assertTrue(a.isEnabled());
assertEquals("setVisible(\"X2\", true);", x2.getOnAnswerChanged());
assertEquals(x2, lastQuestionInserted);
assertEquals(0, lastPageInserted);
assertEquals(3, lastRowInserted);
}