Package org.jsurveylib.io

Examples of org.jsurveylib.io.XMLSurveyReader


        assertEquals(2, lastRowInserted);
    }

    @Test
    public void enabled() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\enabled.xml")));
        model.addInsertQuestionListener(this);
        checkQuestionCount(2, model);
        Question y = model.getQuestionByID("Y");
        y.setAnswer("yes");
        Question x = model.getQuestionByID("X");
View Full Code Here


        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");
View Full Code Here

        assertEquals(3, lastRowInserted);
    }

    @Test
    public void newScript() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\newscript.xml")));
        model.addInsertQuestionListener(this);
        checkQuestionCount(2, model);
        Question y = model.getQuestionByID("Y");
        y.setAnswer("yes");
        Question x = model.getQuestionByID("X");
View Full Code Here

        assertEquals(3, lastRowInserted);
    }

    @Test
    public void populateTemplateAfter() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\populatetemplateafter.xml")));
        assertEquals(2, model.getPages().get(0).getQuestions().size());
        assertEquals(model.getQuestionByID("X1"), model.getPages().get(0).getQuestions().get(1));

        model.setAnswer("Y", "no");
        assertEquals(3, model.getPages().get(0).getQuestions().size());
View Full Code Here

        assertEquals(model.getQuestionByID("X1"), model.getPages().get(0).getQuestions().get(2));
    }

    @Test(expected = Exception.class)
    public void populateTemplateAfterIncorrect() throws Exception {
        new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\populatetemplateafterincorrect.xml")));
    }
View Full Code Here

        new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\populatetemplateafterincorrect.xml")));
    }

    @Test
    public void populateTemplateBefore() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\populatetemplatebefore.xml")));
        assertEquals(2, model.getPages().get(0).getQuestions().size());
        assertEquals(model.getQuestionByID("X1"), model.getPages().get(0).getQuestions().get(0));

        model.setAnswer("Y", "no");
        assertEquals(3, model.getPages().get(0).getQuestions().size());
View Full Code Here

        assertEquals(model.getQuestionByID("Y"), model.getPages().get(0).getQuestions().get(2));
    }

    @Test(expected = Exception.class)
    public void populateTemplateBeforeIncorrect() throws Exception {
        new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\populatetemplatebeforeincorrect.xml")));
    }
View Full Code Here

        new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\populatetemplatebeforeincorrect.xml")));
    }

    @Test
    public void loadXMLAnswersAfter() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\loadxmlanswersafter.xml")));
        model.loadXMLAnswers("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\loadxmlanswersafterresult.xml");
        //every time you answer a question, the populateTemplate adds a new one AFTER what already exists
        assertEquals(10, model.getPages().get(0).getQuestions().size());
        assertEquals("first", model.getPages().get(0).getQuestions().get(0).getAnswer());
        assertEquals("first", model.getPages().get(0).getQuestions().get(1).getAnswer());
View Full Code Here

        assertEquals("", model.getPages().get(0).getQuestions().get(9).getAnswer());
    }

    @Test
    public void loadXMLAnswersBefore() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\loadxmlanswersbefore.xml")));
        model.loadXMLAnswers("src\\test\\org\\jsurveylib\\model\\script\\populatetemplatefiles\\loadxmlanswersbeforeresult.xml");
        //every time you answer a question, the populateTemplate adds a new one AFTER what already exists
        assertEquals(10, model.getPages().get(0).getQuestions().size());
        assertEquals("first", model.getPages().get(0).getQuestions().get(9).getAnswer());
        assertEquals("first", model.getPages().get(0).getQuestions().get(8).getAnswer());
View Full Code Here

    private Boolean newStatus;
    private String errorMessage;

    @Test
    public void orderOfMessages() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\validationhandlerfiles\\orderofmessages.xml")));
        Question q = m.getQuestionByID("blah");
        q.addValidationListener(this);
        assertFalse(q.isValid());

        assertNull(newStatus);
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.