assertTrue(page.rowOf("NONE") < 0);
}
@Test
public void skipped() throws Exception {
Survey survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\pagefiles\\skipped.xml")));
assertFalse(survey.getPages().get(0).isSkipped());
assertTrue(survey.getPages().get(1).isSkipped());
assertEquals(3, survey.getPages().size());
assertEquals(2, survey.getTotalPagesExcludingSkipped());
assertEquals(0, survey.getCurrentPageNumber());
assertEquals(0, survey.getCurrentPageNumberExcludingSkipped());
survey.goToNextPage();
assertEquals(2, survey.getCurrentPageNumber()); //we skipped a page
assertEquals(1, survey.getCurrentPageNumberExcludingSkipped());
assertTrue(survey.isLastPageAndComplete());
survey.goToPreviousPage();
assertEquals(0, survey.getCurrentPageNumber());
assertEquals(0, survey.getCurrentPageNumberExcludingSkipped());
assertFalse(survey.isLastPageAndComplete());
//we have mandatory / invalid questions on a skipped page but we should still be allowed to finish
Question mandatory = survey.getQuestionByID("mandatory");
assertTrue(mandatory.isMandatory() && !mandatory.isAnswered());
Question invalid = survey.getQuestionByID("invalid");
assertFalse(invalid.isValid());
assertTrue(survey.getPages().get(1).areRequirementsMet());
survey.goToNextPage(); //last page
assertTrue(survey.isLastPageAndComplete());
}