@Test
public void insertQuestionCorrectly() throws Exception {
Survey survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\pagefiles\\insertquestioncorrectly.xml")));
Page p = survey.getPages().get(0);
Question z = survey.getQuestionByID("Y").populateTemplate("Z", null, false, "");
p.insertQuestion(z, 2);
assertEquals(z, p.getQuestions().get(2));
assertEquals(survey.getQuestionByID("X"), p.getQuestions().get(1));
Question a = z.populateTemplate("A", null, false, "");
p.insertQuestion(a, 0);
assertEquals(a, p.getQuestions().get(0));
assertEquals(survey.getQuestionByID("Y"), p.getQuestions().get(1));
Question m = z.populateTemplate("A", null, false, "");
p.insertQuestion(m, 1);
assertEquals(m, p.getQuestions().get(1));
assertEquals(a, p.getQuestions().get(0));
assertEquals(survey.getQuestionByID("Y"), p.getQuestions().get(2));
}