diff options
author | Pekka Hyvönen <pekka@vaadin.com> | 2015-04-17 09:42:07 +0300 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2015-04-17 09:42:52 +0300 |
commit | 33c61533ad8a3ed8a38ea606aa9e3d5f4da4dae8 (patch) | |
tree | 3d4edf6b9676e0967b7a08e11642c66cf1abfe0c /uitest/src/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionErrorTest.java | |
parent | 6ed28680346c648a6b4e974568a56f6d4d0e000b (diff) | |
parent | 0636e2d177a933dae13e50eb1b1f4609855f735e (diff) | |
download | vaadin-framework-33c61533ad8a3ed8a38ea606aa9e3d5f4da4dae8.tar.gz vaadin-framework-33c61533ad8a3ed8a38ea606aa9e3d5f4da4dae8.zip |
Merge branch 'master' into grid-7.5
Change-Id: I6175398df4c3a07656a2682843615a0d7bd32a45
Diffstat (limited to 'uitest/src/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionErrorTest.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionErrorTest.java | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionErrorTest.java b/uitest/src/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionErrorTest.java new file mode 100644 index 0000000000..f5c751cd49 --- /dev/null +++ b/uitest/src/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionErrorTest.java @@ -0,0 +1,74 @@ +package com.vaadin.tests.fieldgroup; + +import org.junit.Test; + +public class CommitWithValidationOrConversionErrorTest extends + BasicPersonFormTest { + + private static final String UPDATED_BEAN_VALUES = "Person [firstName=John, lastName=Doever, email=john@doe.com, age=123, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]"; + private static final String UPDATED_NAME_BEAN_VALUES = "Person [firstName=John, lastName=Doever, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]"; + + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + } + + @Test + public void testCommitInvalidName() { + getLastNameArea().setValue("Doev"); + assertCommitFails(); + assertBeanValuesUnchanged(); + } + + @Test + public void testCommitInvalidAge() { + // default name invalid, must be fixed or doesn't test the correct error + getLastNameArea().setValue("Doever"); + + getAgeField().setValue("64,2"); + assertCommitFails(); + assertBeanValuesUnchanged(); + } + + @Test + public void testFixValidationError() { + getLastNameArea().setValue("Doev"); + assertCommitFails(); + assertBeanValuesUnchanged(); + + getLastNameArea().setValue("Doever"); + assertCommitSuccessful(); + showBeanValues(); + assertLogText(UPDATED_NAME_BEAN_VALUES); + } + + @Test + public void testFixConversionError() { + // default name invalid, must be fixed as well + getLastNameArea().setValue("Doever"); + + getAgeField().setValue("64,2"); + + assertCommitFails(); + assertBeanValuesUnchanged(); + + getAgeField().setValue("123"); + assertCommitSuccessful(); + + showBeanValues(); + assertLogText(UPDATED_BEAN_VALUES); + } + + @Test + public void testDiscardAfterSuccessfulCommit() { + getLastNameArea().setValue("Doever"); + getAgeField().setValue("123"); + assertCommitSuccessful(); + + discardChanges(); + assertLogText("Discarded changes"); + showBeanValues(); + assertLogText(UPDATED_BEAN_VALUES); + } +} |