Package org.jsurveylib.io

Examples of org.jsurveylib.io.XMLSurveyReader


        assertEquals("no", yesNo.getAnswer());
    }

    @Test(expected = java.lang.IllegalArgumentException.class)
    public void notYesNo() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typeyesnofiles\\notyesno.xml")));
        m.getQuestionByID("yesno").addAnswerListener(this);
        RadioButtonsQuestion yesNo = (RadioButtonsQuestion) m.getQuestionByID("yesno");
        yesNo.setAnswer("blah");
    }
View Full Code Here


    private boolean valChanged = false;


    @Test
    public void defaults() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typecheckboxfiles\\defaults.xml")));
        m.getQuestionByID("cb").addAnswerListener(this);
        CheckboxQuestion cb = (CheckboxQuestion) m.getQuestionByID("cb");
        assertEquals("unchecked", cb.getAnswer())//it defaults to unchecked
        assertTrue(cb.isAnswered());
        assertFalse(cb.isChecked());
View Full Code Here

        assertTrue(cb.isCheckboxOnRight());
    }

    @Test
    public void noDefaults() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typecheckboxfiles\\nodefaults.xml")));
        m.getQuestionByID("cb").addAnswerListener(this);
        CheckboxQuestion cb = (CheckboxQuestion) m.getQuestionByID("cb");
        assertTrue(cb.isAnswered());
        assertTrue(cb.isChecked());
        cb.setAnswer("checked");
View Full Code Here

        assertFalse(cb.isCheckboxOnRight());
    }

    @Test
    public void alwaysAnswered() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typecheckboxfiles\\alwaysanswered.xml")));
        CheckboxQuestion cb = (CheckboxQuestion) m.getQuestionByID("cb");
        //even though the checkbox is defined to be mandatory, that doesn't make sense so it should be ignored (mandatory is always false)
        assertTrue(cb.isMandatory());
        assertTrue(cb.isAnswered());    //checkboxes are always answered
    }
View Full Code Here

        assertTrue(cb.isAnswered());    //checkboxes are always answered
    }

    @Test
    public void dupe() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typecheckboxfiles\\dupe.xml")));
        CheckboxQuestion orig = (CheckboxQuestion) 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 standard() throws Exception {
        Survey m = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\model\\question\\typemultichoicefiles\\standard.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

        }
    }

    @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());
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);
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

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.