Package org.jsurveylib

Examples of org.jsurveylib.Survey


        assertFalse(model.isLastPageAndComplete());
    }

    @Test(expected = EvaluationException.class)
    public void skipCurrentPage() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\skippagefiles\\skipcurrentpage.xml")));
        model.getQuestionByID("page0").setAnswer("yes");    //skip the page we're on
    }
View Full Code Here


        model.getQuestionByID("page0").setAnswer("yes");    //skip the page we're on
    }

    @Test
    public void initSkip() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\skippagefiles\\initskip.xml")));
        assertFalse(model.isNextPageAvailable());
        assertFalse(model.isPreviousPageAvailable());
        assertTrue(model.isLastPageAndComplete());
    }
View Full Code Here

        assertTrue(model.isLastPageAndComplete());
    }

    @Test
    public void toggleOnAnswerChanged() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\skippagefiles\\toggleonanswerchanged.xml")));
       
        assertTrue(model.isNextPageAvailable());
        assertFalse(model.isPreviousPageAvailable());
        assertFalse(model.isLastPageAndComplete());

        model.setAnswer("toggle", "checked");

        assertFalse(model.isNextPageAvailable());
        assertFalse(model.isPreviousPageAvailable());
        assertTrue(model.isLastPageAndComplete());

        model.setAnswer("toggle", "unchecked");

        assertTrue(model.isNextPageAvailable());
        assertFalse(model.isPreviousPageAvailable());
        assertFalse(model.isLastPageAndComplete());
    }
View Full Code Here

*/
public class OnAnswerChangedTest {

    @Test
    public void standard() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\onanswerchangedfiles\\standard.xml")));
        Question x = model.getQuestionByID("X");
        assertTrue(x.isVisible());
        x.setAnswer("yes");
        assertFalse(x.isVisible());

        Question y = model.getQuestionByID("Y");
        assertTrue(y.isEnabled());
        y.setAnswer("yes");
        assertFalse(y.isEnabled());

        Question z = model.getQuestionByID("Z");
        assertTrue(z.isValid());
        z.setAnswer("yes");
        assertFalse(z.isValid());
    }
View Full Code Here

        assertFalse(z.isValid());
    }

    @Test
    public void modifyingOthers() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\onanswerchangedfiles\\modifyingothers.xml")));
        Question modifyee = model.getQuestionByID("modifyee");
        Question x = model.getQuestionByID("X");
        assertTrue(modifyee.isVisible());
        x.setAnswer("yes");
        assertFalse(modifyee.isVisible());

        Question y = model.getQuestionByID("Y");
        assertTrue(modifyee.isEnabled());
        y.setAnswer("yes");
        assertFalse(modifyee.isEnabled());

        Question z = model.getQuestionByID("Z");
        assertTrue(modifyee.isValid());
        z.setAnswer("yes");
        assertFalse(modifyee.isValid());
    }
View Full Code Here

        assertFalse(modifyee.isValid());
    }

    @Test
    public void defaults() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\onanswerchangedfiles\\defaults.xml")));
        Question modifyee = model.getQuestionByID("modifyee");
        assertTrue(modifyee.isVisible());
        assertTrue(modifyee.isEnabled());
        assertTrue(modifyee.isValid());
        assertEquals("1", model.getAnswer("scriptsRun"));
    }
View Full Code Here

        assertEquals("1", model.getAnswer("scriptsRun"));
    }

    @Test
    public void loadXMLAnswers() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\onanswerchangedfiles\\loadxmlanswers.xml")));
        model.loadXMLAnswers("src\\test\\org\\jsurveylib\\model\\script\\onanswerchangedfiles\\loadxmlanswersresult.xml");
        Question modifyee = model.getQuestionByID("modifyee");
        assertFalse(modifyee.isVisible());
        assertFalse(modifyee.isEnabled());
        assertFalse(modifyee.isValid());
        assertEquals("4", model.getAnswer("scriptsRun"));
    }
View Full Code Here

public class ScriptInterpreterTest {

    @Test
    public void overwriteScope() throws Exception {

        ScriptInterpreter vsi = new ScriptInterpreter(new Survey("src\\test\\org\\jsurveylib\\model\\script\\interpreter\\interpreterfiles\\empty.xml"), "", "");
        String expression = "boolean returnTrue() { return true; } returnTrue()";
        assertTrue((Boolean) vsi.eval(expression));
        assertTrue((Boolean) vsi.eval(expression));
    }
View Full Code Here

*/
public class GoToPageTest {

    @Test
    public void goToPage() throws Exception {
        Survey survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\gotopagefiles\\gotopage.xml")));
        goToPageTest(survey);
    }
View Full Code Here

        goToPageTest(survey);
    }

    @Test
    public void goToPageReset() throws Exception {
        Survey survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\gotopagefiles\\gotopage.xml")));
        goToPageTest(survey);
        survey.reset();
        goToPageTest(survey);
    }
View Full Code Here

TOP

Related Classes of org.jsurveylib.Survey

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.