assertEquals(3, lastRowInserted);
}
@Test
public void valid() throws Exception {
Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\valid.xml")));
model.addInsertQuestionListener(this);
checkQuestionCount(2, model);
Question y = model.getQuestionByID("Y");
y.setAnswer("yes");
Question x = model.getQuestionByID("X");
assertFalse(x.isValid());
checkQuestionCount(3, model);
Question x1 = model.getQuestionByID("X1");
assertFalse(x1.isValid());
assertEquals("blah", x1.getCurrentValidationMessage());
assertEquals("setValid(\"X1\", false, \"blah\");", x1.getOnAnswerChanged());
assertEquals(x1, lastQuestionInserted);
assertEquals(0, lastPageInserted);
assertEquals(2, lastRowInserted);
y.setAnswer("no"); //nothing changes
assertFalse(x.isValid());
assertEquals("blah", x.getCurrentValidationMessage());
assertFalse(x1.isValid());
assertEquals("blah", x1.getCurrentValidationMessage());
assertEquals(x1, lastQuestionInserted);
assertEquals(0, lastPageInserted);
assertEquals(2, lastRowInserted);
y.setAnswer("yes");
checkQuestionCount(4, model);
Question x2 = model.getQuestionByID("X2");
assertFalse(x2.isValid());
assertEquals("blah", x2.getCurrentValidationMessage());
assertFalse(x1.isValid());
assertEquals("blah", x1.getCurrentValidationMessage());
assertFalse(x.isValid());