From a6147df13f54ef64118269fdc035aea670e55de8 Mon Sep 17 00:00:00 2001 From: Pekka Hyvönen Date: Tue, 23 Aug 2016 10:40:20 +0300 Subject: Remove duplicate tests and rename tests BinderTest BinderTest had duplicate tests which are now removed. Remaining Binding tests are renamed. Change-Id: I1b572dcdf40a8d6b4e7e0ce8caa943f8aaaf8320 --- .../src/test/java/com/vaadin/data/BinderTest.java | 78 ++-------------------- 1 file changed, 6 insertions(+), 72 deletions(-) diff --git a/server/src/test/java/com/vaadin/data/BinderTest.java b/server/src/test/java/com/vaadin/data/BinderTest.java index f2c166f6ce..a93916f729 100644 --- a/server/src/test/java/com/vaadin/data/BinderTest.java +++ b/server/src/test/java/com/vaadin/data/BinderTest.java @@ -406,7 +406,7 @@ public class BinderTest { } @Test - public void withStatusChangeHandler_handlerGetsEvents() { + public void bindingWithStatusChangeHandler_handlerGetsEvents() { AtomicReference event = new AtomicReference<>(); Binding binding = binder.forField(nameField) .withValidator(notEmpty).withStatusChangeHandler(evt -> { @@ -441,25 +441,6 @@ public class BinderTest { Assert.assertEquals(nameField, evt.getSource()); } - @Test - public void withStatusChangeHandler_defaultStatusChangeHandlerIsReplaced() { - Binding binding = binder.forField(nameField) - .withValidator(notEmpty).withStatusChangeHandler(evt -> { - }); - binding.bind(Person::getFirstName, Person::setLastName); - - Assert.assertNull(nameField.getComponentError()); - - nameField.setValue(""); - - // First validation fails => should be event with ERROR status and - // message - binder.validate(); - - // default behavior should update component error for the nameField - Assert.assertNull(nameField.getComponentError()); - } - @Test public void bindingWithStatusChangeHandler_defaultStatusChangeHandlerIsReplaced() { Binding binding = binder.forField(nameField) @@ -479,33 +460,6 @@ public class BinderTest { Assert.assertNull(nameField.getComponentError()); } - @Test - public void withStatusLabel_labelIsUpdatedAccordingStatus() { - Label label = new Label(); - - Binding binding = binder.forField(nameField) - .withValidator(notEmpty).withStatusLabel(label); - binding.bind(Person::getFirstName, Person::setLastName); - - nameField.setValue(""); - - // First validation fails => should be event with ERROR status and - // message - binder.validate(); - - Assert.assertTrue(label.isVisible()); - Assert.assertEquals("Value cannot be empty", label.getValue()); - - nameField.setValue("foo"); - - // Second validation succeeds => should be event with OK status and - // no message - binder.validate(); - - Assert.assertFalse(label.isVisible()); - Assert.assertEquals("", label.getValue()); - } - @Test public void bindingWithStatusLabel_labelIsUpdatedAccordingStatus() { Label label = new Label(); @@ -533,26 +487,6 @@ public class BinderTest { Assert.assertEquals("", label.getValue()); } - @Test - public void withStatusLabel_defaultStatusChangeHandlerIsReplaced() { - Label label = new Label(); - - Binding binding = binder.forField(nameField) - .withValidator(notEmpty).withStatusLabel(label); - binding.bind(Person::getFirstName, Person::setLastName); - - Assert.assertNull(nameField.getComponentError()); - - nameField.setValue(""); - - // First validation fails => should be event with ERROR status and - // message - binder.validate(); - - // default behavior should update component error for the nameField - Assert.assertNull(nameField.getComponentError()); - } - @Test public void bindingWithStatusLabel_defaultStatusChangeHandlerIsReplaced() { Label label = new Label(); @@ -574,7 +508,7 @@ public class BinderTest { } @Test(expected = IllegalStateException.class) - public void withStatusChangeHandler_addAfterBound() { + public void bindingWithStatusChangeHandler_addAfterBound() { Binding binding = binder.forField(nameField) .withValidator(notEmpty); binding.bind(Person::getFirstName, Person::setLastName); @@ -583,7 +517,7 @@ public class BinderTest { } @Test(expected = IllegalStateException.class) - public void withStatusLabel_addAfterBound() { + public void bindingWithStatusLabel_addAfterBound() { Label label = new Label(); Binding binding = binder.forField(nameField) @@ -594,7 +528,7 @@ public class BinderTest { } @Test(expected = IllegalStateException.class) - public void withStatusLabel_setAfterHandler() { + public void bindingWithStatusLabel_setAfterHandler() { Label label = new Label(); Binding binding = binder.forField(nameField); @@ -607,7 +541,7 @@ public class BinderTest { } @Test(expected = IllegalStateException.class) - public void withStatusChangeHandler_setAfterLabel() { + public void bindingWithStatusChangeHandler_setAfterLabel() { Label label = new Label(); Binding binding = binder.forField(nameField); @@ -620,7 +554,7 @@ public class BinderTest { } @Test(expected = IllegalStateException.class) - public void withStatusChangeHandler_setAfterOtherHandler() { + public void bingingWithStatusChangeHandler_setAfterOtherHandler() { Binding binding = binder.forField(nameField); binding.bind(Person::getFirstName, Person::setLastName); -- cgit v1.2.3