Package org.jsurveylib.io

Examples of org.jsurveylib.io.XMLSurveyReader


        assertTrue(survey.isLastPageAndComplete());
    }

    @Test
    public void goToFirstPage() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\gotofirstpage.xml")));
        assertEquals("1", survey.getCurrentPage().getLabel());
        survey.goToFirstPage();
        assertTrue(survey.isNextPageAvailable());
        assertFalse(survey.isPreviousPageAvailable());
        assertEquals("1", survey.getCurrentPage().getLabel());
View Full Code Here


        assertEquals("1", survey.getCurrentPage().getLabel());
    }

    @Test
    public void goToLastPage() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\gotolastpage.xml")));
        survey.goToLastPage();
        assertFalse(survey.isNextPageAvailable());
        assertTrue(survey.isPreviousPageAvailable());
        assertEquals("3", survey.getCurrentPage().getLabel());
        survey.goToLastPage();
View Full Code Here

        assertEquals("4", survey.getCurrentPage().getLabel());
    }

    @Test
    public void insertQuestionCorrectlyPageNum() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\insertquestioncorrectly.xml")));
        survey.addInsertQuestionListener(this);
        Question z = survey.getQuestionByID("Y").populateTemplate("Z", null, false, "");
        survey.insertQuestion(z, 0, 2);
        checkQuestionInserted(z, 0, 2);
        assertEquals(z, survey.getPages().get(0).getQuestions().get(2));
View Full Code Here

        assertEquals(survey.getQuestionByID("L"), survey.getPages().get(1).getQuestions().get(2));
    }

    @Test
    public void insertQuestionCorrectlyPageObject() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\insertquestioncorrectly.xml")));
        survey.addInsertQuestionListener(this);
        Question y = survey.getQuestionByID("Y");
        Question z = y.populateTemplate("Z", null, false, "");
        survey.insertQuestion(z, survey.pageOf(y.getId()), 2);
        checkQuestionInserted(z, 0, 2);
View Full Code Here

        assertEquals(row, lastRowInserted);
    }

    @Test(expected = IllegalArgumentException.class)
    public void insertQuestionTooHigh() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\insertquestiontoohigh.xml")));
        survey.insertQuestion(survey.getQuestionByID("Y").populateTemplate("Z", null, false, ""), 2, 0);
    }
View Full Code Here

        survey.insertQuestion(survey.getQuestionByID("Y").populateTemplate("Z", null, false, ""), 2, 0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void insertQuestionTooLow() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\insertquestiontoolow.xml")));
        survey.insertQuestion(survey.getQuestionByID("Y").populateTemplate("Z", null, false, ""), -1, 0);
    }
View Full Code Here

        survey.insertQuestion(survey.getQuestionByID("Y").populateTemplate("Z", null, false, ""), -1, 0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void insertQuestionImitate() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\insertquestionduplicate.xml")));
        survey.insertQuestion(survey.getQuestionByID("Y").populateTemplate("Y", null, false, ""), 1, 0);
    }
View Full Code Here

        survey.insertQuestion(survey.getQuestionByID("Y").populateTemplate("Y", null, false, ""), 1, 0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void insertQuestionImitateImitate() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\insertquestionduplicate.xml")));
        survey.insertQuestion(survey.getQuestionByID("Y").populateTemplate("W", null, false, ""), 1, 0);
        survey.insertQuestion(survey.getQuestionByID("Y").populateTemplate("W", null, false, ""), 1, 0);
    }
View Full Code Here

        survey.insertQuestion(survey.getQuestionByID("Y").populateTemplate("W", null, false, ""), 1, 0);
    }

    @Test
    public void template() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\template.xml")));
        for (int i = 0; i < 5; ++i) {
            checkAgreementTemplate(survey, "a" + i);
        }
        for (int i = 0; i < 3; ++i) {
            checkCheckTemplate(survey, "c" + i);
View Full Code Here

        assertNotNull(survey.getTemplateMap().get("e"));
    }

    @Test
    public void pageOf() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\pageof.xml")));
        Page p2 = survey.pageOf("task_comprehension1");
        checkPageNum(2, p2, survey);
        p2 = survey.pageOf("task_easyness3");
        checkPageNum(2, p2, survey);
View Full Code Here

TOP

Related Classes of org.jsurveylib.io.XMLSurveyReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.