Package org.jsurveylib

Examples of org.jsurveylib.Survey


        }
    }

    @Test
    public void alldefinitions() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typemultichoicefiles\\alldefinitions.xml")));
        m.getQuestionByID("multi").addAnswerListener(this);
        RadioButtonsQuestion multi = (RadioButtonsQuestion) m.getQuestionByID("multi");

        Choice c1 = multi.getChoices().get(0);
        assertEquals("X", c1.getId());
        assertEquals("x", c1.getLabel());
View Full Code Here


        assertTrue(true);
    }

    @Test
    public void dupe() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typemultichoicefiles\\dupe.xml")));
        RadioButtonsQuestion orig = (RadioButtonsQuestion) m.getQuestionByID("cb");
        orig.addAnswerListener(this);
        orig.addEnableListener(this);
        orig.addValidationListener(this);
        orig.addVisibilityListener(this);
View Full Code Here

    private boolean enChanged = false;
    private boolean valChanged = false;

    @Test
    public void defaults() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typetextareafiles\\defaults.xml")));
        m.getQuestionByID("area").addAnswerListener(this);
        TextAreaQuestion area = (TextAreaQuestion) m.getQuestionByID("area");
        assertEquals(5, area.getRows());
        assertFalse(area.isAnswered());
        assertFalse(stateChanged);
        area.setAnswer("");    //no change
        assertFalse(stateChanged);
View Full Code Here

        assertTrue(area.isAnswered());
    }

    @Test
    public void rows() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typetextareafiles\\rows.xml")));
        int rows = ((TextAreaQuestion) m.getQuestionByID("area")).getRows();
        assertEquals(10, rows);
    }
View Full Code Here

        assertEquals(10, rows);
    }

    @Test
    public void dupe() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typetextareafiles\\dupe.xml")));
        TextAreaQuestion orig = (TextAreaQuestion) m.getQuestionByID("cb");
        orig.addAnswerListener(this);
        orig.addEnableListener(this);
        orig.addValidationListener(this);
        orig.addVisibilityListener(this);
View Full Code Here

    private boolean enChanged = false;
    private boolean valChanged = false;

    @Test
    public void defaults() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typetextfieldfiles\\defaults.xml")));
        m.getQuestionByID("field").addAnswerListener(this);
        FreeTextQuestion field = (FreeTextQuestion) m.getQuestionByID("field");
        assertFalse(field.isAnswered());
        assertFalse(stateChanged);
        field.setAnswer("");    //no change
        assertFalse(stateChanged);
        field.setAnswer("blah");
View Full Code Here

        assertTrue(field.isAnswered());
    }

    @Test
    public void dupe() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typetextfieldfiles\\dupe.xml")));
        FreeTextQuestion orig = (FreeTextQuestion) m.getQuestionByID("cb");
        orig.addAnswerListener(this);
        orig.addEnableListener(this);
        orig.addValidationListener(this);
        orig.addVisibilityListener(this);
View Full Code Here

    private boolean ans = false;
    private boolean val = false;

    @Test
    public void addUnnecessaryListener() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\scripthandlerfiles\\standard.xml")));
        Question q = model.getQuestionByID("X");
        q.addEnableListener(this);
        q.addAnswerListener(this);
        q.addValidationListener(this);
        q.addVisibilityListener(this);
        assertFalse(vis);
View Full Code Here

        assertFalse(val);
    }

    @Test
    public void scope() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\scripthandlerfiles\\scope.xml")));
        Question impolite = model.getQuestionByID("impolite");
        impolite.setAnswer("please");
        assertFalse(impolite.isValid());
        assertEquals("You've said 'please' 1 time(s). Stop it!", impolite.getCurrentValidationMessage());

        impolite.setAnswer("");
View Full Code Here

        assertEquals("You've said 'please' 2 time(s). Stop it!", impolite.getCurrentValidationMessage());
    }

    @Test
    public void initHasAccessToQuestions() throws Exception {
        Survey model = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\script\\scripthandlerfiles\\inithasaccesstoquestions.xml")));
        Question q = model.getQuestionByID("Y");
        assertFalse(q.isEnabled());
        assertEquals("no", q.getAnswer());
    }
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.