Hello,
I'm using 1.3.2 version, I have form with several required elements:
        private TextField getSubjectTF(final Form form) {
                TextField subject = new TextField(SUBJECT);
                subject.setRequired(true);
                return subject;
        }

        private DropDownChoice getConditionDDC(Form form) {
                DropDownChoice _conditionDDC = new DropDownChoice(CONDITION,
Arrays.asList(Condition.values()));
                _conditionDDC.setChoiceRenderer(new IChoiceRenderer() {
            public Object getDisplayValue(Object o) {
                Condition condition = (Condition) o;
                return getString(Condition.getKey(condition));
            }

            public String getIdValue(Object o, int i) {
                Condition condition = (Condition) o;
                return condition.toString();
            }
        });
                _conditionDDC.setRequired(true);
                return _conditionDDC;
        }

I have tests for this page:
        @Test public void testRequiredFieldsSubmit() {
                PageParameters parameters = new PageParameters();
                parameters.put("category", "1000");
                getTester().startPage(AddAdvertisement.class, parameters);
                FormTester form = 
getTester().newFormTester(AddAdvertisement.ADD_ADVERT);
                form.submit();
                getTester().assertNoInfoMessage();
                getTester().assertErrorMessages( new String[] {
                                
getComponentErrorMessage(AddAdvertisement.ADD_ADVERT + ":subject",
"add_advert.subject.Required", "add_advert.subject"),
                                
getComponentErrorMessage(AddAdvertisement.ADD_ADVERT +
":condition", "add_advert.condition.Required", "add_advert.condition")
                });
        }

When launching this test I got all message errors for DropDownChoice
elements which are required, but not for any element which is
TextField. Strange because on live page the errors are also for
TextField as it should be done.
Anybody can explain this?

Best regards,
Adr

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to