diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-03 12:56:25 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-10-03 13:56:25 +0300 |
commit | ccad305464af83826de4a4bd25a383360fb356d0 (patch) | |
tree | d399448d2910c4cf373e64c690b053740dff43ba /uitest/src | |
parent | 28b52d687dade66154a4fcd545415bf0d01b0a53 (diff) | |
download | vaadin-framework-ccad305464af83826de4a4bd25a383360fb356d0.tar.gz vaadin-framework-ccad305464af83826de4a4bd25a383360fb356d0.zip |
Use static import of Assert in tests (#10126)
Also removes dependency on junit.framework.TestCase .
Diffstat (limited to 'uitest/src')
431 files changed, 2743 insertions, 2376 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/CurrentTimeMillisTest.java b/uitest/src/test/java/com/vaadin/tests/CurrentTimeMillisTest.java index 2bfa1f9ad4..a604756d94 100644 --- a/uitest/src/test/java/com/vaadin/tests/CurrentTimeMillisTest.java +++ b/uitest/src/test/java/com/vaadin/tests/CurrentTimeMillisTest.java @@ -15,9 +15,12 @@ */ package com.vaadin.tests; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -46,7 +49,7 @@ public class CurrentTimeMillisTest extends MultiBrowserTest { && !BrowserUtil.isSafari(getDesiredCapabilities()); String time = getJsonParsingTime(); - Assert.assertNotNull("JSON parsing time is not found", time); + assertNotNull("JSON parsing time is not found", time); time = time.trim(); if (time.endsWith("ms")) { time = time.substring(0, time.length() - 2); @@ -56,19 +59,19 @@ public class CurrentTimeMillisTest extends MultiBrowserTest { || BrowserUtil.isFirefox(getDesiredCapabilities())) { // Chrome (version 33 at least) sometimes doesn't use high res // time for very short times - Assert.assertTrue( + assertTrue( "High resolution time is not used in " + "JSON parsing mesurement. Time=" + time, time.equals("0") || time.equals("1") || time.indexOf('.') > 0); } else { - Assert.assertTrue( + assertTrue( "High resolution time is not used in " + "JSON parsing mesurement. Time=" + time, time.indexOf('.') > 0); } } else { - Assert.assertFalse("Unexpected dot is detected in browser " + assertFalse("Unexpected dot is detected in browser " + "that doesn't support high resolution time and " + "should report time as integer number. Time=" + time, time.indexOf('.') > 0); diff --git a/uitest/src/test/java/com/vaadin/tests/VerifyAssertionsEnabledTest.java b/uitest/src/test/java/com/vaadin/tests/VerifyAssertionsEnabledTest.java index 1180cc8332..a34d2b4d7f 100644 --- a/uitest/src/test/java/com/vaadin/tests/VerifyAssertionsEnabledTest.java +++ b/uitest/src/test/java/com/vaadin/tests/VerifyAssertionsEnabledTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -9,6 +10,6 @@ public class VerifyAssertionsEnabledTest extends SingleBrowserTest { @Test public void verifyServerAssertions() throws Exception { openTestURL(); - Assert.assertEquals("1. Assertions are enabled", getLogRow(0)); + assertEquals("1. Assertions are enabled", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/accessibility/WindowWaiAriaRolesTest.java b/uitest/src/test/java/com/vaadin/tests/accessibility/WindowWaiAriaRolesTest.java index 6162136aa1..c7a41761dc 100644 --- a/uitest/src/test/java/com/vaadin/tests/accessibility/WindowWaiAriaRolesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/accessibility/WindowWaiAriaRolesTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.accessibility; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -35,7 +36,7 @@ public class WindowWaiAriaRolesTest extends MultiBrowserTest { $(ButtonElement.class).caption("Regular").first().click(); String role = getWindowRole(); - Assert.assertTrue( + assertTrue( "Dialog has incorrect role '" + role + "', expected 'dialog'", "dialog".equals(role)); } @@ -45,7 +46,7 @@ public class WindowWaiAriaRolesTest extends MultiBrowserTest { openTestURL(); $(ButtonElement.class).caption("Alert").first().click(); String role = getWindowRole(); - Assert.assertTrue( + assertTrue( "Dialog has incorrect role '" + role + "', expected 'alertdialog'", "alertdialog".equals(role)); diff --git a/uitest/src/test/java/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java index a1b36d0b0e..b171d3d1ff 100644 --- a/uitest/src/test/java/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.actions; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.remote.DesiredCapabilities; @@ -22,13 +23,13 @@ public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest { @Test public void testShortcutsOnInvisibleDisabledButtons() { openTestURL(); - Assert.assertEquals(LAST_INIT_LOG, getLogRow(0)); + assertEquals(LAST_INIT_LOG, getLogRow(0)); invokeShortcut("A"); - Assert.assertEquals(LAST_INIT_LOG, getLogRow(0)); + assertEquals(LAST_INIT_LOG, getLogRow(0)); invokeShortcut("B"); - Assert.assertEquals(LAST_INIT_LOG, getLogRow(0)); + assertEquals(LAST_INIT_LOG, getLogRow(0)); invokeShortcut("C"); - Assert.assertEquals("4. Click event for enabled button", getLogRow(0)); + assertEquals("4. Click event for enabled button", getLogRow(0)); } private void invokeShortcut(CharSequence key) { diff --git a/uitest/src/test/java/com/vaadin/tests/application/ConnectorBundleStatusTest.java b/uitest/src/test/java/com/vaadin/tests/application/ConnectorBundleStatusTest.java index 58419bf43f..2a03d3d9b4 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/ConnectorBundleStatusTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/ConnectorBundleStatusTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.application; +import static org.junit.Assert.assertEquals; + import java.util.Arrays; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.By; @@ -45,7 +46,6 @@ public class ConnectorBundleStatusTest extends SingleBrowserTest { private void assertLoaded(String... expectedNames) { String bundleStatus = findElement(By.id("bundleStatus")).getText(); - Assert.assertEquals(Arrays.asList(expectedNames).toString(), - bundleStatus); + assertEquals(Arrays.asList(expectedNames).toString(), bundleStatus); } } diff --git a/uitest/src/test/java/com/vaadin/tests/application/InitiallyDeferredLoadingTest.java b/uitest/src/test/java/com/vaadin/tests/application/InitiallyDeferredLoadingTest.java index c61b12fbb1..74d3eec47f 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/InitiallyDeferredLoadingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/InitiallyDeferredLoadingTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -29,6 +30,6 @@ public class InitiallyDeferredLoadingTest extends SingleBrowserTest { WebElement deferredComponent = findElement(By.id("deferred")); - Assert.assertEquals("DeferredConnector", deferredComponent.getText()); + assertEquals("DeferredConnector", deferredComponent.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/application/MissingHierarchyDetectionTest.java b/uitest/src/test/java/com/vaadin/tests/application/MissingHierarchyDetectionTest.java index 64b999b7d5..a5fe6e96f3 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/MissingHierarchyDetectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/MissingHierarchyDetectionTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; @@ -28,18 +30,18 @@ public class MissingHierarchyDetectionTest extends SingleBrowserTest { public void testMissingHierarchyDetection() { openTestURL(); - Assert.assertTrue(isElementPresent(By.id("label"))); + assertTrue(isElementPresent(By.id("label"))); ButtonElement toggleProperly = $(ButtonElement.class) .caption("Toggle properly").first(); toggleProperly.click(); assertNoSystemNotifications(); - Assert.assertFalse(isElementPresent(By.id("label"))); + assertFalse(isElementPresent(By.id("label"))); toggleProperly.click(); assertNoSystemNotifications(); - Assert.assertTrue(isElementPresent(LabelElement.class)); + assertTrue(isElementPresent(LabelElement.class)); ButtonElement toggleImproperly = $(ButtonElement.class) .caption("Toggle improperly").first(); diff --git a/uitest/src/test/java/com/vaadin/tests/application/PreserveWithExpiredHeartbeatTest.java b/uitest/src/test/java/com/vaadin/tests/application/PreserveWithExpiredHeartbeatTest.java index af39d1e625..c9e4597b18 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/PreserveWithExpiredHeartbeatTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/PreserveWithExpiredHeartbeatTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.LabelElement; @@ -43,7 +44,7 @@ public class PreserveWithExpiredHeartbeatTest extends SingleBrowserTest { openTestURL(); // Verify that that we still get the same UI - Assert.assertEquals("Original UI has been closed", originalId, + assertEquals("Original UI has been closed", originalId, getUiIdentification()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/application/ReconnectDialogThemeTest.java b/uitest/src/test/java/com/vaadin/tests/application/ReconnectDialogThemeTest.java index 49dabf467c..121abd505e 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/ReconnectDialogThemeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/ReconnectDialogThemeTest.java @@ -15,13 +15,15 @@ */ package com.vaadin.tests.application; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import javax.imageio.ImageIO; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.OutputType; @@ -46,7 +48,7 @@ public class ReconnectDialogThemeTest extends MultiBrowserThemeTestWithProxy { ButtonElement helloButton = $(ButtonElement.class).caption("Say hello") .first(); helloButton.click(); - Assert.assertEquals("1. Hello from the server", getLogRow(0)); + assertEquals("1. Hello from the server", getLogRow(0)); disconnectProxy(); helloButton.click(); testBench().disableWaitForVaadin(); @@ -130,7 +132,7 @@ public class ReconnectDialogThemeTest extends MultiBrowserThemeTestWithProxy { } } } - Assert.fail(message); + fail(message); } diff --git a/uitest/src/test/java/com/vaadin/tests/application/ReconnectDialogUITest.java b/uitest/src/test/java/com/vaadin/tests/application/ReconnectDialogUITest.java index 3cbf8c38c7..ffbdf0dc0d 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/ReconnectDialogUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/ReconnectDialogUITest.java @@ -15,7 +15,10 @@ */ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; @@ -38,12 +41,11 @@ public class ReconnectDialogUITest extends MultiBrowserTestWithProxy { getButton().click(); waitForReconnectDialogPresent(); WebElement body = findElement(By.xpath("//body")); - Assert.assertTrue("Body should have a style name when reconnecting", + assertTrue("Body should have a style name when reconnecting", hasCssClass(body, "v-reconnecting")); connectProxy(); waitForReconnectDialogToDisappear(); - Assert.assertFalse( - "Body should no longer have a style name when reconnected", + assertFalse("Body should no longer have a style name when reconnected", hasCssClass(body, "v-reconnecting")); } @@ -51,14 +53,14 @@ public class ReconnectDialogUITest extends MultiBrowserTestWithProxy { public void reconnectDialogShownAndDisappears() throws JSchException { openTestURL(); getButton().click(); - Assert.assertEquals("1. Hello from the server", getLogRow(0)); + assertEquals("1. Hello from the server", getLogRow(0)); disconnectProxy(); getButton().click(); waitForReconnectDialogWithText( "Server connection lost, trying to reconnect..."); connectProxy(); waitForReconnectDialogToDisappear(); - Assert.assertEquals("2. Hello from the server", getLogRow(0)); + assertEquals("2. Hello from the server", getLogRow(0)); } private void waitForReconnectDialogWithText(final String text) { diff --git a/uitest/src/test/java/com/vaadin/tests/application/RefreshFragmentChangeTest.java b/uitest/src/test/java/com/vaadin/tests/application/RefreshFragmentChangeTest.java index ea415bcaae..acbd022be4 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/RefreshFragmentChangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/RefreshFragmentChangeTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.By; @@ -24,6 +25,6 @@ public class RefreshFragmentChangeTest extends MultiBrowserTest { private void assertLogText(String expected) { waitForElementPresent(By.className("v-label")); - Assert.assertEquals("Incorrect log text,", expected, getLogRow(0)); + assertEquals("Incorrect log text,", expected, getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/application/RefreshStatePreserveTest.java b/uitest/src/test/java/com/vaadin/tests/application/RefreshStatePreserveTest.java index 3257e3429f..3211c15633 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/RefreshStatePreserveTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/RefreshStatePreserveTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.By; @@ -24,7 +25,6 @@ public class RefreshStatePreserveTest extends MultiBrowserTest { private void assertCorrectState() { waitForElementPresent(By.className("v-label")); LabelElement uiIdLabel = $(LabelElement.class).get(7); - Assert.assertEquals("Incorrect UI id,", UI_ID_TEXT, - uiIdLabel.getText()); + assertEquals("Incorrect UI id,", UI_ID_TEXT, uiIdLabel.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/application/RefreshStatePreserveTitleTest.java b/uitest/src/test/java/com/vaadin/tests/application/RefreshStatePreserveTitleTest.java index e2740f9537..48ff4c0844 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/RefreshStatePreserveTitleTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/RefreshStatePreserveTitleTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -15,6 +16,6 @@ public class RefreshStatePreserveTitleTest extends MultiBrowserTest { } private void assertTitleText() { - Assert.assertEquals("Incorrect page title,", "TEST", driver.getTitle()); + assertEquals("Incorrect page title,", "TEST", driver.getTitle()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/application/ResynchronizeUITest.java b/uitest/src/test/java/com/vaadin/tests/application/ResynchronizeUITest.java index 63f1e4566d..f92b1271dd 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/ResynchronizeUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/ResynchronizeUITest.java @@ -15,10 +15,11 @@ */ package com.vaadin.tests.application; +import static org.junit.Assert.fail; + import java.util.Collections; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.remote.DesiredCapabilities; @@ -47,8 +48,7 @@ public class ResynchronizeUITest extends SingleBrowserTest { waitForThemeToChange("runo"); try { button.click(); - Assert.fail( - "The old button element should have been removed by the click and replaced by a new one."); + fail("The old button element should have been removed by the click and replaced by a new one."); } catch (StaleElementReferenceException e) { // This is what should happen } diff --git a/uitest/src/test/java/com/vaadin/tests/application/TerminalErrorNotificationTest.java b/uitest/src/test/java/com/vaadin/tests/application/TerminalErrorNotificationTest.java index 8d55ee74d7..d01aef95e0 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/TerminalErrorNotificationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/TerminalErrorNotificationTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -12,8 +14,8 @@ public class TerminalErrorNotificationTest extends MultiBrowserTest { public void tb2test() throws Exception { openTestURL(); $(ButtonElement.class).first().click(); - Assert.assertTrue(isElementPresent(NotificationElement.class)); - Assert.assertEquals("Got an exception: You asked for it", + assertTrue(isElementPresent(NotificationElement.class)); + assertEquals("Got an exception: You asked for it", $(NotificationElement.class).first().getCaption()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/application/ThreadLocalInstancesTest.java b/uitest/src/test/java/com/vaadin/tests/application/ThreadLocalInstancesTest.java index 4600e89862..b8afba529d 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/ThreadLocalInstancesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/ThreadLocalInstancesTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -30,6 +31,6 @@ public class ThreadLocalInstancesTest extends MultiBrowserTest { } private void assertLogText(String expected, int index) { - Assert.assertEquals("Incorrect log text,", expected, getLogRow(index)); + assertEquals("Incorrect log text,", expected, getLogRow(index)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/application/TimingInfoReportedTest.java b/uitest/src/test/java/com/vaadin/tests/application/TimingInfoReportedTest.java index 559da03366..e5964d95a6 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/TimingInfoReportedTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/TimingInfoReportedTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -26,8 +27,8 @@ public class TimingInfoReportedTest extends SingleBrowserTestPhantomJS2 { @Test public void ensureTimingsAvailable() { openTestURL(); - Assert.assertEquals("2. Timings ok", getLogRow(0)); + assertEquals("2. Timings ok", getLogRow(0)); $(ButtonElement.class).first().click(); - Assert.assertEquals("4. Timings ok", getLogRow(0)); + assertEquals("4. Timings ok", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/application/WebBrowserTimeZoneTest.java b/uitest/src/test/java/com/vaadin/tests/application/WebBrowserTimeZoneTest.java index 10b6dfb7a9..bc74927ee1 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/WebBrowserTimeZoneTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/WebBrowserTimeZoneTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.application; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -20,8 +21,7 @@ public class WebBrowserTimeZoneTest extends MultiBrowserTest { private void assertLabelText(String caption, String expected) { String actual = $(LabelElement.class).caption(caption).first() .getText(); - Assert.assertEquals( - String.format("Unexpected text in label '%s',", caption), + assertEquals(String.format("Unexpected text in label '%s',", caption), expected, actual); } } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationcontext/ChangeSessionIdTest.java b/uitest/src/test/java/com/vaadin/tests/applicationcontext/ChangeSessionIdTest.java index ec1479ce15..e7563fa5b6 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationcontext/ChangeSessionIdTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationcontext/ChangeSessionIdTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.applicationcontext; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -20,7 +21,7 @@ public class ChangeSessionIdTest extends MultiBrowserTest { private void checkLogMatches(String expected) { String actual = getLogRow(0); - Assert.assertTrue(String.format( + assertTrue(String.format( "Unexpected log row.\n expected format: '%s'\n was: '%s'", expected, actual), actual.matches(expected)); } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationcontext/CleanupBrokenUITest.java b/uitest/src/test/java/com/vaadin/tests/applicationcontext/CleanupBrokenUITest.java index a25b6c1abd..48800e37fb 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationcontext/CleanupBrokenUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationcontext/CleanupBrokenUITest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.applicationcontext; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -26,19 +27,19 @@ public class CleanupBrokenUITest extends SingleBrowserTest { public void ensureUIDetached() { openTestURL(); // UI 1 has not yet been added in UI.init where logging takes place - Assert.assertEquals("1. UIs in session: 0", getLogRow(0)); + assertEquals("1. UIs in session: 0", getLogRow(0)); String url = getTestURL(getUIClass()).replace("restartApplication", "1"); driver.get(url); // UI 1 remains in session during UI2 init where logging takes place - Assert.assertEquals("1. UIs in session: 1", getLogRow(0)); + assertEquals("1. UIs in session: 1", getLogRow(0)); // At this point UI1 should be removed from the session driver.get(url); // UI 2 remains in session during UI3 init where logging takes place // UI 1 should have been removed - Assert.assertEquals("1. UIs in session: 1", getLogRow(0)); + assertEquals("1. UIs in session: 1", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationcontext/CloseSessionTest.java b/uitest/src/test/java/com/vaadin/tests/applicationcontext/CloseSessionTest.java index 5a6657801d..c58f51373b 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationcontext/CloseSessionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationcontext/CloseSessionTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.applicationcontext; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.By; @@ -47,8 +48,7 @@ public class CloseSessionTest extends MultiBrowserTest { @Test public void testCloseVaadinServiceAndRedirect() { clickButton("Close VaadinServiceSession and redirect elsewhere"); - Assert.assertEquals("Unexpected page contents,", - "This is a static file", + assertEquals("Unexpected page contents,", "This is a static file", findElement(By.xpath("//h1")).getText()); } @@ -91,13 +91,13 @@ public class CloseSessionTest extends MultiBrowserTest { } private void assertLogText(int index, String expected) { - Assert.assertEquals("Unexpected log text,", expected, getLogRow(index)); + assertEquals("Unexpected log text,", expected, getLogRow(index)); } private void assertSessionExpired() { String expected = "Session Expired"; String actual = $(NotificationElement.class).first().getCaption(); - Assert.assertEquals("Unexpected notification,", actual, expected); + assertEquals("Unexpected notification,", actual, expected); } public void clickButton(String caption) { diff --git a/uitest/src/test/java/com/vaadin/tests/applicationcontext/RpcForClosedUITest.java b/uitest/src/test/java/com/vaadin/tests/applicationcontext/RpcForClosedUITest.java index d2818205df..499bc0a7fe 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationcontext/RpcForClosedUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationcontext/RpcForClosedUITest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.applicationcontext; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -21,7 +23,7 @@ public class RpcForClosedUITest extends MultiBrowserTest { clickButton("Log 'hello'"); /* Ensure 'hello' was not logged */ checkLogMatches("2. Current WrappedSession id: .*"); - Assert.assertFalse("Page contains word 'Hello'", + assertFalse("Page contains word 'Hello'", driver.getPageSource().contains("Hello")); } @@ -31,7 +33,7 @@ public class RpcForClosedUITest extends MultiBrowserTest { private void checkLogMatches(String expected) { String actual = getLogRow(0); - Assert.assertTrue(String.format( + assertTrue(String.format( "Unexpected log row.\n expected format: '%s'\n was: '%s'", expected, actual), actual.matches(expected)); } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationservlet/ContextProtocolTest.java b/uitest/src/test/java/com/vaadin/tests/applicationservlet/ContextProtocolTest.java index a4bd0b5f85..186523545d 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationservlet/ContextProtocolTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationservlet/ContextProtocolTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.applicationservlet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.By; @@ -27,9 +28,9 @@ public class ContextProtocolTest extends SingleBrowserTest { public void contextPathCorrect() { openTestURL(); // Added by bootstrap - Assert.assertEquals("said", executeScript("return window.hello")); + assertEquals("said", executeScript("return window.hello")); // Added by client side - Assert.assertEquals(getBaseURL() + "/statictestfiles/image.png", + assertEquals(getBaseURL() + "/statictestfiles/image.png", findElement(By.id("image")).getAttribute("src")); } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationservlet/CustomDeploymentConfTest.java b/uitest/src/test/java/com/vaadin/tests/applicationservlet/CustomDeploymentConfTest.java index 7c4788a4d5..d22e9687b7 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationservlet/CustomDeploymentConfTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationservlet/CustomDeploymentConfTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.applicationservlet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.LabelElement; @@ -33,9 +34,8 @@ public class CustomDeploymentConfTest extends MultiBrowserTest { LabelElement customParamLabel = $$(VerticalLayoutElement.class) .$$(VerticalLayoutElement.class).$$(LabelElement.class).get(1); - Assert.assertEquals("Resource cache time: 3599", - cacheTimeLabel.getText()); - Assert.assertEquals("Custom config param: customValue", + assertEquals("Resource cache time: 3599", cacheTimeLabel.getText()); + assertEquals("Custom config param: customValue", customParamLabel.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationservlet/DisableSendUrlAsParametersTest.java b/uitest/src/test/java/com/vaadin/tests/applicationservlet/DisableSendUrlAsParametersTest.java index 4c0fc483a9..7ce9781629 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationservlet/DisableSendUrlAsParametersTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationservlet/DisableSendUrlAsParametersTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.applicationservlet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -28,7 +29,7 @@ public class DisableSendUrlAsParametersTest extends SingleBrowserTest { String logRow = getLogRow(0); - Assert.assertEquals( + assertEquals( "1. Init location exception: Location is not available as the sendUrlsAsParameters parameter is configured as false", logRow); } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationservlet/MultipleServletConfigurationTest.java b/uitest/src/test/java/com/vaadin/tests/applicationservlet/MultipleServletConfigurationTest.java index 5e835d219b..76055be44d 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationservlet/MultipleServletConfigurationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationservlet/MultipleServletConfigurationTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.applicationservlet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.LabelElement; @@ -24,7 +25,7 @@ public class MultipleServletConfigurationTest extends MultiBrowserTest { } private void assertLabelText(String expected) { - Assert.assertEquals("Unexpected label text,", expected, + assertEquals("Unexpected label text,", expected, $(LabelElement.class).first().getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationservlet/NoApplicationClassTest.java b/uitest/src/test/java/com/vaadin/tests/applicationservlet/NoApplicationClassTest.java index 50667b7449..6661a6a231 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationservlet/NoApplicationClassTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationservlet/NoApplicationClassTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.applicationservlet; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; @@ -29,10 +30,9 @@ public class NoApplicationClassTest extends SingleBrowserTest { String exceptionMessage = getDriver().findElement(By.xpath("//pre[2]")) .getText(); String expected = "ServletException: java.lang.ClassNotFoundException: ClassThatIsNotPresent"; - Assert.assertTrue( - String.format( - "Unexpected error message.\n expected to contain: '%s'\n was: %s", - expected, exceptionMessage), + assertTrue(String.format( + "Unexpected error message.\n expected to contain: '%s'\n was: %s", + expected, exceptionMessage), exceptionMessage.contains(expected)); } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServiceInitListenersTest.java b/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServiceInitListenersTest.java index a23a6f1a1f..4b1f3c5a7b 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServiceInitListenersTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServiceInitListenersTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.applicationservlet; -import org.junit.Assert; +import static org.junit.Assert.assertNotEquals; + import org.junit.Test; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -26,9 +27,9 @@ public class ServiceInitListenersTest extends SingleBrowserTest { public void testServiceInitListenerTriggered() { openTestURL(); - Assert.assertNotEquals(getLogRow(0), 0, extractCount(getLogRow(0))); - Assert.assertNotEquals(getLogRow(1), 0, extractCount(getLogRow(1))); - Assert.assertNotEquals(getLogRow(2), 0, extractCount(getLogRow(2))); + assertNotEquals(getLogRow(0), 0, extractCount(getLogRow(0))); + assertNotEquals(getLogRow(1), 0, extractCount(getLogRow(1))); + assertNotEquals(getLogRow(2), 0, extractCount(getLogRow(2))); } private int extractCount(String logRow) { diff --git a/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServletWithResourcesTest.java b/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServletWithResourcesTest.java index 92d5795eee..fa539e0c0b 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServletWithResourcesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServletWithResourcesTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.applicationservlet; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -42,24 +44,21 @@ public class ServletWithResourcesTest extends SingleBrowserTest { @Test public void servletServesResources() { openTestURL(); - Assert.assertEquals("Enabled", - $(CheckBoxElement.class).first().getCaption()); + assertEquals("Enabled", $(CheckBoxElement.class).first().getCaption()); List<WebElement> links = findElements(By.xpath("//head/link")); for (WebElement link : links) { String href = link.getAttribute("href"); - Assert.assertTrue( - "href '" + href - + "' should contain '/servlet-with-resources/VAADIN'", + assertTrue("href '" + href + + "' should contain '/servlet-with-resources/VAADIN'", href.contains("/servlet-with-resources/VAADIN")); } List<WebElement> scripts = findElements(By.xpath("//head/script")); for (WebElement script : scripts) { String src = script.getAttribute("src"); - Assert.assertTrue( - "src '" + src - + "' should contain '/servlet-with-resources/VAADIN'", + assertTrue("src '" + src + + "' should contain '/servlet-with-resources/VAADIN'", src.contains("/servlet-with-resources/VAADIN")); } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationservlet/SystemMessagesTest.java b/uitest/src/test/java/com/vaadin/tests/applicationservlet/SystemMessagesTest.java index dd5248ce76..bd0920c56a 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationservlet/SystemMessagesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationservlet/SystemMessagesTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.applicationservlet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -26,9 +27,9 @@ public class SystemMessagesTest extends MultiBrowserTest { private void verifyError(String locale) { $(ButtonElement.class).first().click(); NotificationElement notification = $(NotificationElement.class).first(); - Assert.assertEquals("Incorrect notification caption,", + assertEquals("Incorrect notification caption,", notification.getCaption(), "Internal error"); - Assert.assertEquals("Incorrect notification description,", + assertEquals("Incorrect notification description,", notification.getDescription(), "MessagesInfo locale: " + locale); } diff --git a/uitest/src/test/java/com/vaadin/tests/applicationservlet/VaadinRefreshServletTest.java b/uitest/src/test/java/com/vaadin/tests/applicationservlet/VaadinRefreshServletTest.java index 06911b909f..0930663925 100644 --- a/uitest/src/test/java/com/vaadin/tests/applicationservlet/VaadinRefreshServletTest.java +++ b/uitest/src/test/java/com/vaadin/tests/applicationservlet/VaadinRefreshServletTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.applicationservlet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; @@ -29,7 +30,7 @@ public class VaadinRefreshServletTest extends SingleBrowserTest { getDriver().get(getBaseURL() + "/vaadinrefresh/"); waitUntil((WebDriver d) -> "Please login" .equals(findElement(By.tagName("body")).getText())); - Assert.assertEquals(getBaseURL() + "/statictestfiles/login.html", + assertEquals(getBaseURL() + "/statictestfiles/login.html", getDriver().getCurrentUrl()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/componentlocator/ComponentLocatorInheritedClassesTest.java b/uitest/src/test/java/com/vaadin/tests/componentlocator/ComponentLocatorInheritedClassesTest.java index 4d8449fa38..d108d70af3 100644 --- a/uitest/src/test/java/com/vaadin/tests/componentlocator/ComponentLocatorInheritedClassesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/componentlocator/ComponentLocatorInheritedClassesTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.componentlocator; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.LabelElement; @@ -20,18 +21,18 @@ public class ComponentLocatorInheritedClassesTest extends SingleBrowserTest { @Test public void label_finds_all_three() { openTestURL(); - Assert.assertEquals(3, $(LabelElement.class).all().size()); + assertEquals(3, $(LabelElement.class).all().size()); } @Test public void defaultlabel_finds_two() { openTestURL(); - Assert.assertEquals(2, $(DefaultLabelElement.class).all().size()); + assertEquals(2, $(DefaultLabelElement.class).all().size()); } @Test public void mycustomlabel_finds_one() { openTestURL(); - Assert.assertEquals(1, $(MyCustomLabelElement.class).all().size()); + assertEquals(1, $(MyCustomLabelElement.class).all().size()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/componentlocator/ComponentLocatorOldClassesTest.java b/uitest/src/test/java/com/vaadin/tests/componentlocator/ComponentLocatorOldClassesTest.java index eb465f2c51..a282385d2b 100644 --- a/uitest/src/test/java/com/vaadin/tests/componentlocator/ComponentLocatorOldClassesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/componentlocator/ComponentLocatorOldClassesTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.componentlocator; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.TextFieldElement; @@ -11,8 +12,7 @@ public class ComponentLocatorOldClassesTest extends SingleBrowserTest { @Test public void testTestBenchFindsBothTextFields() { openTestURL(); - Assert.assertEquals( - "ComponentLocator did not find elements as expected.", 2, + assertEquals("ComponentLocator did not find elements as expected.", 2, $(TextFieldElement.class).all().size()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java b/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java index 750545ce89..2dc9e02914 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java @@ -1,11 +1,12 @@ package com.vaadin.tests.components; +import static org.junit.Assert.assertTrue; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; @@ -115,7 +116,7 @@ public class ErrorLevelsTest extends SingleBrowserTest { private void assertHasRightClassNames(WebElement element, String prefix, ErrorLevel errorLevel) { - Assert.assertTrue("Element must have only one error level class name", + assertTrue("Element must have only one error level class name", containsCorrectErrorLevelClassNameOnly(element, prefix, errorLevel)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/HasValueRequiredIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/HasValueRequiredIndicatorTest.java index 09c4572526..689fe719e5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/HasValueRequiredIndicatorTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/HasValueRequiredIndicatorTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Point; @@ -35,21 +36,21 @@ public abstract class HasValueRequiredIndicatorTest extends MultiBrowserTest { public void requiredIndicatorVisible() { openTestURL(); List<WebElement> layouts = findElements(By.className("vaadin-layout")); - Assert.assertTrue(layouts.size() > 0); + assertTrue(layouts.size() > 0); layouts.stream().forEach(this::checkRequiredIndicator); } protected void checkRequiredIndicator(WebElement layout) { WebElement caption = layout.findElement(By.className("v-caption")); - Assert.assertTrue(caption.isDisplayed()); + assertTrue(caption.isDisplayed()); WebElement indicator = caption .findElement(By.className("v-required-field-indicator")); - Assert.assertTrue(indicator.isDisplayed()); + assertTrue(indicator.isDisplayed()); Point layoutLocation = layout.getLocation(); Point indicatorLocation = indicator.getLocation(); - Assert.assertTrue("Indicator x-axis location is not inside layout", + assertTrue("Indicator x-axis location is not inside layout", indicatorLocation.getX() >= layoutLocation.getX()); - Assert.assertTrue("Indicator y-axis location is not inside layout", + assertTrue("Indicator y-axis location is not inside layout", indicatorLocation.getY() >= layoutLocation.getY()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/SaneErrorsTest.java b/uitest/src/test/java/com/vaadin/tests/components/SaneErrorsTest.java index 34bf03aecd..c3478c99cd 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/SaneErrorsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/SaneErrorsTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -54,7 +55,7 @@ public class SaneErrorsTest extends MultiBrowserTest { .findElements(By.className("v-label")); for (WebElement webElement : errorMessages) { String text = webElement.getText(); - Assert.assertEquals("java.lang.NullPointerException", text); + assertEquals("java.lang.NullPointerException", text); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/TooltipPositionTest.java b/uitest/src/test/java/com/vaadin/tests/components/TooltipPositionTest.java index 64fa0442d7..7c28fa1aae 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/TooltipPositionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/TooltipPositionTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; @@ -47,7 +48,7 @@ public class TooltipPositionTest extends MultiBrowserTest { waitForElementPresent(By.cssSelector(".v-tooltip")); WebElement tooltip = driver.findElement(By.cssSelector(".v-tooltip")); - Assert.assertTrue( + assertTrue( "This init tooltip with text ' ' is present in the DOM and should be entirely outside the browser window", isOutsideOfWindow(tooltip)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java index 45d7941c58..37b25090bd 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java @@ -1,13 +1,17 @@ package com.vaadin.tests.components.absolutelayout; -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.MultiBrowserTest; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Optional; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import java.util.Optional; +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; /** * Tests for component positioning after width changes from defined to relative @@ -23,16 +27,16 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest { Optional<WebElement> panelWrapper = getComponentWrapper(componentId); - Assert.assertTrue("No wrapper element found for expanding panel [ID: " + assertTrue("No wrapper element found for expanding panel [ID: " + componentId + "]", panelWrapper.isPresent()); String left = panelWrapper.get().getCssValue("left"); - Assert.assertEquals( + assertEquals( "Component wrapper was missing left:0; from its css positioning", "0px", left); WebElement panelComponent = findElement(By.id(componentId)); - Assert.assertEquals("Panel is not on the left side of the screen", 0, + assertEquals("Panel is not on the left side of the screen", 0, panelComponent.getLocation().getX()); // Click button to change component size @@ -42,11 +46,11 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest { // version 40 which calculates the actual left value, testing width // instead of the wrapper instead String width = panelWrapper.get().getCssValue("width"); - Assert.assertEquals("Width was more that it should have been.", "250px", + assertEquals("Width was more that it should have been.", "250px", width); - Assert.assertNotEquals("Panel is still on the left side of the screen", - 0, panelComponent.getLocation().getX()); + assertNotEquals("Panel is still on the left side of the screen", 0, + panelComponent.getLocation().getX()); } @Test @@ -57,32 +61,31 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest { Optional<WebElement> panelWrapper = getComponentWrapper(componentId); - Assert.assertTrue( + assertTrue( "No wrapper element found for panel [ID: " + componentId + "]", panelWrapper.isPresent()); String width = panelWrapper.get().getCssValue("width"); - Assert.assertEquals("Width was more that it should have been.", "250px", + assertEquals("Width was more that it should have been.", "250px", width); WebElement panelComponent = findElement(By.id(componentId)); - Assert.assertNotEquals( - "Panel is positioned to the left side of the screen", 0, + assertNotEquals("Panel is positioned to the left side of the screen", 0, panelComponent.getLocation().getX()); // Click button to change component size $(ButtonElement.class).id(componentId + "-button").click(); String left = panelWrapper.get().getCssValue("left"); - Assert.assertEquals( + assertEquals( "Component wrapper was missing left:0; from its css positioning", "0px", left); width = panelWrapper.get().getCssValue("width"); - Assert.assertNotEquals("Width hasn't changed from the initial value.", - "250px", width); + assertNotEquals("Width hasn't changed from the initial value.", "250px", + width); - Assert.assertEquals("Panel is not on the left side of the screen", 0, + assertEquals("Panel is not on the left side of the screen", 0, panelComponent.getLocation().getX()); } @@ -94,31 +97,30 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest { Optional<WebElement> panelWrapper = getComponentWrapper(componentId); - Assert.assertTrue("No wrapper element found for AbsoluteLayout [ID: " + assertTrue("No wrapper element found for AbsoluteLayout [ID: " + componentId + "].", panelWrapper.isPresent()); String width = panelWrapper.get().getCssValue("width"); - Assert.assertEquals("Width was more that it should have been.", "250px", + assertEquals("Width was more that it should have been.", "250px", width); WebElement panelComponent = findElement(By.id(componentId)); - Assert.assertNotEquals( - "Panel is positioned to the left side of the screen", 0, + assertNotEquals("Panel is positioned to the left side of the screen", 0, panelComponent.getLocation().getX()); // Click button to change component size $(ButtonElement.class).id(componentId + "-button").click(); String left = panelWrapper.get().getCssValue("left"); - Assert.assertEquals( + assertEquals( "Component wrapper was missing left:0; from its css positioning", "0px", left); width = panelWrapper.get().getCssValue("width"); - Assert.assertNotEquals("Width hasn't changed from the initial value.", - "250px", width); + assertNotEquals("Width hasn't changed from the initial value.", "250px", + width); - Assert.assertEquals("Panel is not on the left side of the screen", 0, + assertEquals("Panel is not on the left side of the screen", 0, panelComponent.getLocation().getX()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/ChangeHierarchyBeforeResponseTest.java b/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/ChangeHierarchyBeforeResponseTest.java index 6063cfd189..7c2ebcc85b 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/ChangeHierarchyBeforeResponseTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/ChangeHierarchyBeforeResponseTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.abstractcomponent; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -29,7 +30,7 @@ public class ChangeHierarchyBeforeResponseTest extends SingleBrowserTest { ButtonElement button = $(ButtonElement.class).first(); - Assert.assertEquals( + assertEquals( "Button caption should change by its own beforeClientResponse", "Add label to layout", button.getText()); @@ -37,7 +38,7 @@ public class ChangeHierarchyBeforeResponseTest extends SingleBrowserTest { LabelElement label = $(LabelElement.class).all().get(1); - Assert.assertEquals("Label should have been considered initial twice", + assertEquals("Label should have been considered initial twice", "Initial count: 2", label.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/ResponseWritingErrorHandlingTest.java b/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/ResponseWritingErrorHandlingTest.java index 2b6d1d3b9b..740fc857bf 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/ResponseWritingErrorHandlingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/ResponseWritingErrorHandlingTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.abstractcomponent; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -29,7 +30,7 @@ public class ResponseWritingErrorHandlingTest extends SingleBrowserTest { $(ButtonElement.class).first().click(); - Assert.assertEquals("Message should be logged by error handler", + assertEquals("Message should be logged by error handler", "1. Button.beforeClientResponse", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipModesTest.java b/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipModesTest.java index 489d7e2470..3813d547c5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipModesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipModesTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.abstractcomponent; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -59,7 +60,6 @@ public class TooltipModesTest extends TooltipTest { WebElement tooltip = getTooltip(); WebElement tooltipContent = tooltip .findElement(By.className("v-tooltip-text")); - Assert.assertEquals(tooltipText, - tooltipContent.getAttribute("innerHTML")); + assertEquals(tooltipText, tooltipContent.getAttribute("innerHTML")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/abstractfield/AbstractComponentStyleNameTest.java b/uitest/src/test/java/com/vaadin/tests/components/abstractfield/AbstractComponentStyleNameTest.java index 3b602b2f2c..3c0c534985 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/abstractfield/AbstractComponentStyleNameTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/abstractfield/AbstractComponentStyleNameTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.abstractfield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -34,60 +35,60 @@ public class AbstractComponentStyleNameTest { @Test public void add() { c.addStyleName("foo"); - Assert.assertEquals("foo", c.getStyleName()); + assertEquals("foo", c.getStyleName()); } @Test public void addWithHeadingSpace() { c.addStyleName(" foo"); - Assert.assertEquals("foo", c.getStyleName()); + assertEquals("foo", c.getStyleName()); } @Test public void addWithTrailingSpace() { c.addStyleName("foo "); - Assert.assertEquals("foo", c.getStyleName()); + assertEquals("foo", c.getStyleName()); } @Test public void removeWithHeadingSpace() { c.setStyleName("foo"); c.removeStyleName(" foo"); - Assert.assertEquals("", c.getStyleName()); + assertEquals("", c.getStyleName()); } @Test public void removeWithTrailingSpace() { c.setStyleName("foo"); c.removeStyleName("foo "); - Assert.assertEquals("", c.getStyleName()); + assertEquals("", c.getStyleName()); } @Test public void addMultipleTimes() { c.addStyleName("foo"); c.addStyleName("foo"); - Assert.assertEquals("foo", c.getStyleName()); + assertEquals("foo", c.getStyleName()); } @Test public void setStyleAdd() { c.setStyleName("foo", true); - Assert.assertEquals("foo", c.getStyleName()); + assertEquals("foo", c.getStyleName()); } @Test public void setStyleMultipleAdd() { c.setStyleName("foo", true); c.setStyleName("foo", true); - Assert.assertEquals("foo", c.getStyleName()); + assertEquals("foo", c.getStyleName()); } @Test public void setStyleRemove() { c.addStyleName("foo"); c.setStyleName("foo", false); - Assert.assertEquals("", c.getStyleName()); + assertEquals("", c.getStyleName()); } @Test @@ -95,14 +96,14 @@ public class AbstractComponentStyleNameTest { c.addStyleName("foo"); c.setStyleName("foo", false); c.setStyleName("foo", false); - Assert.assertEquals("", c.getStyleName()); + assertEquals("", c.getStyleName()); } @Test public void remove() { c.addStyleName("foo"); c.removeStyleName("foo"); - Assert.assertEquals("", c.getStyleName()); + assertEquals("", c.getStyleName()); } @Test @@ -110,6 +111,6 @@ public class AbstractComponentStyleNameTest { c.addStyleName("foo"); c.removeStyleName("foo"); c.removeStyleName("foo"); - Assert.assertEquals("", c.getStyleName()); + assertEquals("", c.getStyleName()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocusedTest.java b/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocusedTest.java index 269d84be59..1cc110931a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocusedTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocusedTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.abstractfield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -30,13 +31,13 @@ public class ShortcutWhenBodyFocusedTest extends SingleBrowserTest { openTestURL(); ButtonElement b = $(ButtonElement.class).caption("Hello").first(); b.click(); - Assert.assertEquals("1. Hello clicked", getLogRow(0)); + assertEquals("1. Hello clicked", getLogRow(0)); b.sendKeys("A"); - Assert.assertEquals("2. Hello clicked", getLogRow(0)); + assertEquals("2. Hello clicked", getLogRow(0)); WebElement body = findElement(By.xpath("//body")); body.sendKeys("A"); - Assert.assertEquals("3. Hello clicked", getLogRow(0)); + assertEquals("3. Hello clicked", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/abstractsingleselect/AbstractSingleSelectionTest.java b/uitest/src/test/java/com/vaadin/tests/components/abstractsingleselect/AbstractSingleSelectionTest.java index 4623dac714..549243c971 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/abstractsingleselect/AbstractSingleSelectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/abstractsingleselect/AbstractSingleSelectionTest.java @@ -1,10 +1,14 @@ package com.vaadin.tests.components.abstractsingleselect; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -58,16 +62,15 @@ public class AbstractSingleSelectionTest extends SingleBrowserTest { AbstractSingleSelectElement selectElement = getSelectElement(); // TODO: TB API behavior should be unified. if (selectElement instanceof RadioButtonGroupElement) { - Assert.assertNull("No value should be selected", - selectElement.getValue()); + assertNull("No value should be selected", selectElement.getValue()); } else if (selectElement instanceof ComboBoxElement) { - Assert.assertTrue("No value should be selected", + assertTrue("No value should be selected", selectElement.getValue().isEmpty()); } else { // NativeSelectElement throws if no value is selected. try { selectElement.getValue(); - Assert.fail("No value should be selected"); + fail("No value should be selected"); } catch (NoSuchElementException e) { // All is fine. } @@ -82,11 +85,11 @@ public class AbstractSingleSelectionTest extends SingleBrowserTest { AbstractSingleSelectElement select = getSelectElement(); select.selectByText("Baz"); - Assert.assertEquals("Value should change", "Baz", select.getValue()); + assertEquals("Value should change", "Baz", select.getValue()); $(ButtonElement.class).caption("Refresh").first().click(); - Assert.assertEquals("Value should stay the same through refreshAll", - "Baz", select.getValue()); + assertEquals("Value should stay the same through refreshAll", "Baz", + select.getValue()); } @Test @@ -97,10 +100,10 @@ public class AbstractSingleSelectionTest extends SingleBrowserTest { AbstractSingleSelectElement select = getSelectElement(); select.selectByText("Baz"); - Assert.assertEquals("Value should change", "Baz", select.getValue()); + assertEquals("Value should change", "Baz", select.getValue()); $(ButtonElement.class).caption("Select Bar").first().click(); - Assert.assertEquals("Original value should be selected again", "Bar", + assertEquals("Original value should be selected again", "Bar", select.getValue()); } @@ -113,12 +116,12 @@ public class AbstractSingleSelectionTest extends SingleBrowserTest { AbstractSingleSelectElement rbg = getSelectElement(); rbg.selectByText("Reset"); // Selecting "Reset" selects "Bar" on server. Value was initially "Bar" - Assert.assertEquals("Original value should be selected again", "Bar", + assertEquals("Original value should be selected again", "Bar", rbg.getValue()); } private void assertInitial() { - Assert.assertEquals("Initial state unexpected", "Bar", + assertEquals("Initial state unexpected", "Bar", getSelectElement().getValue()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/accordion/AccordionAddTabTest.java b/uitest/src/test/java/com/vaadin/tests/components/accordion/AccordionAddTabTest.java index 77d9454424..dbf9dc3db0 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/accordion/AccordionAddTabTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/accordion/AccordionAddTabTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.accordion; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -41,7 +42,7 @@ public class AccordionAddTabTest extends MultiBrowserTest { List<WebElement> panels = driver.findElements(By.className("v-panel")); - Assert.assertEquals( + assertEquals( "Found two widgets inside one tab after " + "subsequent tab removal and addition", 1, panels.size()); diff --git a/uitest/src/test/java/com/vaadin/tests/components/accordion/AccordionRemoveTabTest.java b/uitest/src/test/java/com/vaadin/tests/components/accordion/AccordionRemoveTabTest.java index 836b9ddc57..1100c1e1d8 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/accordion/AccordionRemoveTabTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/accordion/AccordionRemoveTabTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.accordion; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -53,7 +55,7 @@ public class AccordionRemoveTabTest extends MultiBrowserTest { WebElement caption = firstItem .findElement(By.className("v-accordion-item-caption")); caption.click(); - Assert.assertEquals("Errors present in console", 0, + assertEquals("Errors present in console", 0, findElements(By.className("SEVERE")).size()); } @@ -61,11 +63,10 @@ public class AccordionRemoveTabTest extends MultiBrowserTest { WebElement firstItem = driver .findElement(By.className("v-accordion-item-first")); WebElement label = firstItem.findElement(By.className("v-label")); - Assert.assertEquals("Unexpected text in first item", text, - label.getText()); + assertEquals("Unexpected text in first item", text, label.getText()); int height = firstItem.getSize().getHeight(); WebElement accordion = driver.findElement(By.className("v-accordion")); - Assert.assertTrue("First item in accordion has unexpected height", + assertTrue("First item in accordion has unexpected height", height > accordion.getSize().getHeight() / 2); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/button/ButtonKeyboardClickTest.java b/uitest/src/test/java/com/vaadin/tests/components/button/ButtonKeyboardClickTest.java index 9ff6d771cc..a0fe8408fd 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/button/ButtonKeyboardClickTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/button/ButtonKeyboardClickTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.button; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -52,56 +53,56 @@ public class ButtonKeyboardClickTest extends MultiBrowserTest { private void checkCoordinates(WebElement button) { int xRelative = getValue("xRelative"); - Assert.assertTrue( + assertTrue( "X relative click coordinate is greater than middle of the button", button.getSize().getWidth() / 2 >= xRelative - 1); - Assert.assertTrue( + assertTrue( "X relative click coordinate is lower than middle of the button", button.getSize().getWidth() / 2 <= xRelative + 1); int yRelative = getValue("yRelative"); - Assert.assertTrue( + assertTrue( "Y relative click coordinate is greater than middle of the button", button.getSize().getHeight() / 2 >= yRelative - 1); - Assert.assertTrue( + assertTrue( "Y relative click coordinate is lower than middle of the button", button.getSize().getHeight() / 2 <= yRelative + 1); - Assert.assertTrue( + assertTrue( "Client X click cooridnate is lower than X button coordinate", getValue("x") > button.getLocation().getX()); - Assert.assertTrue( + assertTrue( "Client X click cooridnate is greater than right button " + "border coordinate", getValue("x") < button.getLocation().getX() + button.getSize().getWidth()); - Assert.assertTrue( + assertTrue( "Client Y click cooridnate is lower than Y button coordinate", getValue("y") > button.getLocation().getY()); - Assert.assertTrue( + assertTrue( "Client Y click cooridnate is greater than bottom button " + "border coordinate", getValue("y") < button.getLocation().getY() + button.getSize().getHeight()); - Assert.assertTrue( + assertTrue( "Client X click cooridnate is greater than X middle button " + "coordinate", button.getLocation().getX() + button.getSize().getWidth() / 2 >= getValue("x") - 1); - Assert.assertTrue( + assertTrue( "Client Y click cooridnate is greater than Y middle button coordinate", button.getLocation().getY() + button.getSize().getHeight() / 2 >= getValue("y") - 1); - Assert.assertTrue( + assertTrue( "Client X click cooridnate is lower than X middle button " + "coordinate", button.getLocation().getX() + button.getSize().getWidth() / 2 <= getValue("x") + 1); - Assert.assertTrue( + assertTrue( "Client Y click cooridnate is lower than Y middle button coordinate", button.getLocation().getY() + button.getSize().getHeight() / 2 <= getValue("y") diff --git a/uitest/src/test/java/com/vaadin/tests/components/button/ButtonUndefinedWidthTest.java b/uitest/src/test/java/com/vaadin/tests/components/button/ButtonUndefinedWidthTest.java index 7b298972a9..f4d793834f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/button/ButtonUndefinedWidthTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/button/ButtonUndefinedWidthTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.button; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -97,13 +98,12 @@ public class ButtonUndefinedWidthTest extends MultiBrowserTest { } private void assertRowWrapperWidth(int wrapperWidth, int rowWidth) { - Assert.assertTrue("Wrapper should be narrower than its parent: " - + wrapperWidth + " < " + rowWidth, wrapperWidth < rowWidth); + assertTrue("Wrapper should be narrower than its parent: " + wrapperWidth + + " < " + rowWidth, wrapperWidth < rowWidth); } private void assertButtonWidth(int buttonWidth, int containerWidth) { - Assert.assertTrue("Button should be narrower than its parent: " - + buttonWidth + " < " + containerWidth, - buttonWidth < containerWidth); + assertTrue("Button should be narrower than its parent: " + buttonWidth + + " < " + containerWidth, buttonWidth < containerWidth); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckboxContextClickTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckboxContextClickTest.java index 0c44732ee4..5bbd243f45 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckboxContextClickTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckboxContextClickTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.checkbox; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; @@ -37,17 +38,17 @@ public class CheckboxContextClickTest extends MultiBrowserTest { public void contextClickCheckboxAndText() { openTestURL(); CheckBoxElement checkbox = $(CheckBoxElement.class).first(); - Assert.assertEquals("checked", checkbox.getValue()); + assertEquals("checked", checkbox.getValue()); WebElement input = checkbox.findElement(By.xpath("input")); WebElement label = checkbox.findElement(By.xpath("label")); contextClickElement(input); - Assert.assertEquals("1. checkbox context clicked", getLogRow(0)); - Assert.assertEquals("checked", checkbox.getValue()); + assertEquals("1. checkbox context clicked", getLogRow(0)); + assertEquals("checked", checkbox.getValue()); contextClickElement(label); - Assert.assertEquals("2. checkbox context clicked", getLogRow(0)); - Assert.assertEquals("checked", checkbox.getValue()); + assertEquals("2. checkbox context clicked", getLogRow(0)); + assertEquals("checked", checkbox.getValue()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckboxFocusClickTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckboxFocusClickTest.java index 63d54ff372..b478bb123f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckboxFocusClickTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckboxFocusClickTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.checkbox; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -29,10 +30,10 @@ public class CheckboxFocusClickTest extends MultiBrowserTest { public void contextClickCheckboxAndText() { openTestURL(); CheckBoxElement checkbox = $(CheckBoxElement.class).first(); - Assert.assertEquals("checked", checkbox.getValue()); + assertEquals("checked", checkbox.getValue()); WebElement label = checkbox.findElement(By.xpath("label")); label.click(); - Assert.assertEquals("1. checkbox focused", getLogRow(0)); + assertEquals("1. checkbox focused", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlurTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlurTest.java index 2f3c8b8cd1..7554b167b4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlurTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlurTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.components.checkboxgroup; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -44,11 +46,11 @@ public class CheckBoxGroupFocusBlurTest extends MultiBrowserTest { $(CheckBoxGroupElement.class).first().selectByText("1"); // Focus event is fired - Assert.assertTrue(logContainsText("1. Focus Event")); + assertTrue(logContainsText("1. Focus Event")); $(CheckBoxGroupElement.class).first().selectByText("2"); // click on the second checkbox doesn't fire anything - Assert.assertFalse(logContainsText("2.")); + assertFalse(logContainsText("2.")); // move the cursor to the middle of the first element, // offset to the middle of the two and perform click @@ -59,32 +61,32 @@ public class CheckBoxGroupFocusBlurTest extends MultiBrowserTest { .click().build().perform(); // no new events - Assert.assertFalse(logContainsText("2.")); + assertFalse(logContainsText("2.")); // click to label of a checkbox $(CheckBoxGroupElement.class).first().findElements(By.tagName("label")) .get(2).click(); // no new events - Assert.assertFalse(logContainsText("2.")); + assertFalse(logContainsText("2.")); // click on log label => blur $(LabelElement.class).first().click(); // blur event is fired - Assert.assertTrue(logContainsText("2. Blur Event")); + assertTrue(logContainsText("2. Blur Event")); $(CheckBoxGroupElement.class).first().selectByText("4"); // Focus event is fired - Assert.assertTrue(logContainsText("3. Focus Event")); + assertTrue(logContainsText("3. Focus Event")); // move keyboard focus to the next checkbox checkBoxes.get(3).sendKeys(Keys.TAB); // no new events - Assert.assertFalse(logContainsText("4.")); + assertFalse(logContainsText("4.")); // select the next checkbox checkBoxes.get(4).sendKeys(Keys.SPACE); // no new events - Assert.assertFalse(logContainsText("4.")); + assertFalse(logContainsText("4.")); } @Override diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupInGridLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupInGridLayoutTest.java index 0aade000fd..73c688659e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupInGridLayoutTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupInGridLayoutTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.checkboxgroup; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.CheckBoxGroupElement; @@ -27,6 +28,6 @@ public class CheckBoxGroupInGridLayoutTest extends MultiBrowserTest { ok = (before == after + 4); } - Assert.assertTrue("GridLayout size changed when selecting a value", ok); + assertTrue("GridLayout size changed when selecting a value", ok); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java index adfe9dcc3a..356f544f2d 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java @@ -96,21 +96,21 @@ public class CheckBoxGroupTest extends MultiBrowserTest { selectMenuPath("Component", "Listeners", "Selection listener"); getSelect().selectByText("Item 4"); - Assert.assertEquals("1. Selected: [Item 4]", getLogRow(0)); + assertEquals("1. Selected: [Item 4]", getLogRow(0)); getSelect().selectByText("Item 2"); // Selection order (most recently selected is last) - Assert.assertEquals("2. Selected: [Item 4, Item 2]", getLogRow(0)); + assertEquals("2. Selected: [Item 4, Item 2]", getLogRow(0)); getSelect().selectByText("Item 4"); - Assert.assertEquals("3. Selected: [Item 2]", getLogRow(0)); + assertEquals("3. Selected: [Item 2]", getLogRow(0)); } @Test public void disabled_clickToSelect() { selectMenuPath("Component", "State", "Enabled"); - Assert.assertTrue(getSelect().findElements(By.tagName("input")).stream() + assertTrue(getSelect().findElements(By.tagName("input")).stream() .allMatch(element -> element.getAttribute("disabled") != null)); selectMenuPath("Component", "Listeners", "Selection listener"); @@ -118,14 +118,14 @@ public class CheckBoxGroupTest extends MultiBrowserTest { String lastLogRow = getLogRow(0); getSelect().selectByText("Item 4"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); getSelect().selectByText("Item 2"); // Selection order (most recently selected is last) - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); getSelect().selectByText("Item 4"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); } @Test @@ -138,13 +138,13 @@ public class CheckBoxGroupTest extends MultiBrowserTest { selectMenuPath("Component", "State", "Enabled"); getSelect().selectByText("Item 5"); - Assert.assertEquals("3. Selected: [Item 5]", getLogRow(0)); + assertEquals("3. Selected: [Item 5]", getLogRow(0)); getSelect().selectByText("Item 2"); - Assert.assertEquals("4. Selected: [Item 5, Item 2]", getLogRow(0)); + assertEquals("4. Selected: [Item 5, Item 2]", getLogRow(0)); getSelect().selectByText("Item 5"); - Assert.assertEquals("5. Selected: [Item 2]", getLogRow(0)); + assertEquals("5. Selected: [Item 2]", getLogRow(0)); } @Test @@ -159,7 +159,7 @@ public class CheckBoxGroupTest extends MultiBrowserTest { selectMenuPath("Component", "Item Generator", "Item Caption Generator", "Null Caption Generator"); for (String text : getSelect().getOptions()) { - Assert.assertEquals("", text); + assertEquals("", text); } } @@ -170,9 +170,9 @@ public class CheckBoxGroupTest extends MultiBrowserTest { assertItemSuffices(20); List<WebElement> icons = getSelect() .findElements(By.cssSelector(".v-select-optiongroup .v-icon")); - Assert.assertTrue(icons.size() > 0); + assertTrue(icons.size() > 0); for (int i = 0; i < icons.size(); i++) { - Assert.assertEquals(VaadinIcons.values()[i + 1].getCodepoint(), + assertEquals(VaadinIcons.values()[i + 1].getCodepoint(), icons.get(i).getText().charAt(0)); } } @@ -182,17 +182,17 @@ public class CheckBoxGroupTest extends MultiBrowserTest { selectMenuPath("Component", "Listeners", "Selection listener"); selectMenuPath("Component", "Selection", "Toggle Item 5"); - Assert.assertEquals("2. Selected: [Item 5]", getLogRow(0)); + assertEquals("2. Selected: [Item 5]", getLogRow(0)); assertSelected("Item 5"); selectMenuPath("Component", "Selection", "Toggle Item 1"); // Selection order (most recently selected is last) - Assert.assertEquals("4. Selected: [Item 5, Item 1]", getLogRow(0)); + assertEquals("4. Selected: [Item 5, Item 1]", getLogRow(0)); // DOM order assertSelected("Item 1", "Item 5"); selectMenuPath("Component", "Selection", "Toggle Item 5"); - Assert.assertEquals("6. Selected: [Item 1]", getLogRow(0)); + assertEquals("6. Selected: [Item 1]", getLogRow(0)); assertSelected("Item 1"); } @@ -205,7 +205,7 @@ public class CheckBoxGroupTest extends MultiBrowserTest { label = (TestBenchElement) findElements(By.tagName("label")).get(5); label.showTooltip(); - Assert.assertEquals("Tooltip should contain the same text as caption", + assertEquals("Tooltip should contain the same text as caption", label.getText(), getTooltipElement().getText()); selectMenuPath("Component", "Item Description Generator", @@ -213,13 +213,13 @@ public class CheckBoxGroupTest extends MultiBrowserTest { label = (TestBenchElement) findElements(By.tagName("label")).get(5); label.showTooltip(); - Assert.assertEquals("Tooltip should contain caption + ' Description'", + assertEquals("Tooltip should contain caption + ' Description'", label.getText() + " Description", getTooltipElement().getText()); } private void assertSelected(String... expectedSelection) { - Assert.assertEquals(Arrays.asList(expectedSelection), + assertEquals(Arrays.asList(expectedSelection), getSelect().getValue()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/DisabledCheckBoxGroupTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/DisabledCheckBoxGroupTest.java index f8fcbdda0f..59b0caaba5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/DisabledCheckBoxGroupTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/DisabledCheckBoxGroupTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.checkboxgroup; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.CheckBoxGroupElement; @@ -34,10 +35,10 @@ public class DisabledCheckBoxGroupTest extends MultiBrowserTest { openTestURL(); List<String> options = $(CheckBoxGroupElement.class).first() .getOptions(); - Assert.assertEquals(3, options.size()); - Assert.assertEquals("a", options.get(0)); - Assert.assertEquals("b", options.get(1)); - Assert.assertEquals("c", options.get(2)); + assertEquals(3, options.size()); + assertEquals("a", options.get(0)); + assertEquals("b", options.get(1)); + assertEquals("c", options.get(2)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUITest.java b/uitest/src/test/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUITest.java index f1a44a1779..c6b3b70a4f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUITest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.colorpicker; -import org.junit.Assert; +import static org.junit.Assert.fail; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -36,8 +37,7 @@ public class ColorPickerGridUITest extends SingleBrowserTest { // check that the color picker does not have component error set if (hasCssClass(grid, "v-colorpicker-grid-error")) { - Assert.fail( - "ColorPickerGrid should not have an active component error"); + fail("ColorPickerGrid should not have an active component error"); } } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java b/uitest/src/test/java/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java index 1cce6b1827..a575e909d9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.colorpicker; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -56,10 +58,10 @@ public class DefaultCaptionWidthTest extends MultiBrowserTest { String clazz = $(ColorPickerElement.class).first() .getAttribute("class"); if (expectedStyle) { - Assert.assertTrue("Default caption style is not found", + assertTrue("Default caption style is not found", clazz.contains("v-default-caption-width")); } else { - Assert.assertFalse("Found unexpected default caption style", + assertFalse("Found unexpected default caption style", clazz.contains("v-default-caption-width")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAutoresetValueTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAutoresetValueTest.java index 42d28165a7..f803853e6a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAutoresetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxAutoresetValueTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.combobox; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ComboBoxElement; @@ -29,31 +30,28 @@ public class ComboBoxAutoresetValueTest extends SingleBrowserTest { ComboBoxElement comboBox = $(ComboBoxElement.class).first(); - Assert.assertEquals("", comboBox.getValue()); + assertEquals("", comboBox.getValue()); comboBox.selectByText(ComboBoxAutoresetValue.RESET); assertLogChange(1, ComboBoxAutoresetValue.RESET, 1); assertLogChange(2, null, 0); - Assert.assertEquals("", comboBox.getValue()); + assertEquals("", comboBox.getValue()); comboBox.selectByText(ComboBoxAutoresetValue.CHANGE); assertLogChange(3, ComboBoxAutoresetValue.CHANGE, 1); assertLogChange(4, ComboBoxAutoresetValue.SOMETHING, 0); - Assert.assertEquals(ComboBoxAutoresetValue.SOMETHING, - comboBox.getValue()); + assertEquals(ComboBoxAutoresetValue.SOMETHING, comboBox.getValue()); comboBox.selectByText(ComboBoxAutoresetValue.SOMETHING); // No new log items assertLogChange(4, ComboBoxAutoresetValue.SOMETHING, 0); - Assert.assertEquals(ComboBoxAutoresetValue.SOMETHING, - comboBox.getValue()); + assertEquals(ComboBoxAutoresetValue.SOMETHING, comboBox.getValue()); } private void assertLogChange(int sequenceNumber, String expectedValue, int rowIndex) { - Assert.assertEquals( - sequenceNumber + ". Value changed to " + expectedValue, + assertEquals(sequenceNumber + ". Value changed to " + expectedValue, getLogRow(rowIndex)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxClickIconTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxClickIconTest.java index a20968986c..20fba51cba 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxClickIconTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxClickIconTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.combobox; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; @@ -41,7 +42,7 @@ public class ComboBoxClickIconTest extends MultiBrowserTest { clickElement(getDriver().findElement(By.className("v-filterselect")) .findElement(By.className("v-icon"))); - Assert.assertTrue("Unable to find menu items in combobox popup", + assertTrue("Unable to find menu items in combobox popup", isElementPresent(By.className("gwt-MenuItem"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcutTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcutTest.java index bff1b9843d..fb967819f9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcutTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcutTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.combobox; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.Keys; @@ -29,9 +30,8 @@ public class ComboBoxCombinedWithEnterShortcutTest extends MultiBrowserTest { ComboBoxElement cb = $(ComboBoxElement.class).first(); cb.click(); cb.sendKeys(500, Keys.DOWN, Keys.DOWN, Keys.DOWN, Keys.ENTER); - Assert.assertEquals("", getLogRow(0).trim()); + assertEquals("", getLogRow(0).trim()); cb.sendKeys(Keys.ENTER); - Assert.assertEquals("1. Button clicked. ComboBox value: Berlin", - getLogRow(0)); + assertEquals("1. Button clicked. ComboBox value: Berlin", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaptionTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaptionTest.java index 0efea9cae9..54de29af0f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaptionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyCaptionTest.java @@ -15,10 +15,11 @@ */ package com.vaadin.tests.components.combobox; +import static org.junit.Assert.assertEquals; + import java.util.ArrayList; import java.util.Arrays; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.Keys; @@ -80,20 +81,19 @@ public class ComboBoxEmptyCaptionTest extends MultiBrowserTest { public void emptyItemCaptionInTextBox() { ComboBoxElement combo = $(ComboBoxElement.class).first(); - Assert.assertEquals("", combo.getInputField().getAttribute("value")); + assertEquals("", combo.getInputField().getAttribute("value")); // set some caption for the empty selection element $(ButtonElement.class).first().click(); - Assert.assertEquals("empty", - combo.getInputField().getAttribute("value")); + assertEquals("empty", combo.getInputField().getAttribute("value")); } private void ensureSuggestions(ComboBoxElement element, String... suggestions) { element.openPopup(); - Assert.assertEquals(Arrays.asList(suggestions), + assertEquals(Arrays.asList(suggestions), new ArrayList<>(element.getPopupSuggestions())); // Close popup new Actions(getDriver()).sendKeys(Keys.ESCAPE).perform(); diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemIconTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemIconTest.java index 7011a58179..e5df4ad827 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemIconTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemIconTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.combobox; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.Keys; @@ -61,11 +62,11 @@ public class ComboBoxItemIconTest extends MultiBrowserTest { private void assertSelection(ComboBoxElement cb, String imageSuffix, String caption) { - Assert.assertEquals(caption, cb.getValue()); + assertEquals(caption, cb.getValue()); String imgSrc = cb.findElement(By.className("v-icon")) .getAttribute("src"); imgSrc = imgSrc.substring(imgSrc.lastIndexOf('/') + 1); - Assert.assertEquals(imageSuffix, imgSrc); + assertEquals(imageSuffix, imgSrc); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemStyleGeneratorTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemStyleGeneratorTest.java index bb839eb591..668851ac3e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemStyleGeneratorTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemStyleGeneratorTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.combobox; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -40,13 +41,13 @@ public class ComboBoxItemStyleGeneratorTest extends SingleBrowserTest { List<WebElement> boldItems = findElements( By.className("v-filterselect-item-bold")); - Assert.assertEquals(1, boldItems.size()); - Assert.assertEquals("Item 5", boldItems.get(0).getText()); + assertEquals(1, boldItems.size()); + assertEquals("Item 5", boldItems.get(0).getText()); selectMenuPath("Component", "Features", "Item style generator", "-"); boldItems = findElements(By.className("v-filterselect-item-bold")); - Assert.assertEquals(0, boldItems.size()); + assertEquals(0, boldItems.size()); } @Override diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxNoTextInputTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxNoTextInputTest.java index 0f7d858e63..4979212070 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxNoTextInputTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxNoTextInputTest.java @@ -15,14 +15,15 @@ */ package com.vaadin.tests.components.combobox; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Test; import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; import com.vaadin.testbench.commands.TestBenchElementCommands; -import com.vaadin.testbench.elements.ComboBoxElement; import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.ComboBoxElement; import com.vaadin.tests.tb3.MultiBrowserTest; public class ComboBoxNoTextInputTest extends MultiBrowserTest { @@ -51,7 +52,7 @@ public class ComboBoxNoTextInputTest extends MultiBrowserTest { click(cb); // popup is opened lazily sleep(1000); - Assert.assertFalse(cb.isElementPresent(By.vaadin("#popup"))); + assertFalse(cb.isElementPresent(By.vaadin("#popup"))); } private void click(ComboBoxElement cb) throws Exception { diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPopupPositionEmbeddedInDivTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPopupPositionEmbeddedInDivTest.java index 682712dcbb..ffe48912e1 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPopupPositionEmbeddedInDivTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPopupPositionEmbeddedInDivTest.java @@ -15,8 +15,9 @@ */ package com.vaadin.tests.components.combobox; +import static org.junit.Assert.assertTrue; + import org.apache.commons.lang3.StringUtils; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Point; import org.openqa.selenium.WebElement; @@ -43,10 +44,10 @@ public class ComboBoxPopupPositionEmbeddedInDivTest extends MultiBrowserTest { Point comboboxLocation = combobox.getLocation(); Point popupLocation = popup.getLocation(); - Assert.assertTrue("Popup should be below combobox", + assertTrue("Popup should be below combobox", popupLocation.getY() > comboboxLocation.getY()); - Assert.assertTrue("Popup should be left aligned with the combobox", + assertTrue("Popup should be left aligned with the combobox", popupLocation.getX() == comboboxLocation.getX()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPopupWhenBodyScrollsTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPopupWhenBodyScrollsTest.java index 9ff02b6f2d..7ca2c8f6dd 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPopupWhenBodyScrollsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxPopupWhenBodyScrollsTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.combobox; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -34,7 +35,6 @@ public class ComboBoxPopupWhenBodyScrollsTest extends MultiBrowserTest { int comboboxTop = combobox.getLocation().getY(); int popupTop = popup.getLocation().getY(); - Assert.assertTrue("Popup should be below combobox", - popupTop > comboboxTop); + assertTrue("Popup should be below combobox", popupTop > comboboxTop); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSelectingTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSelectingTest.java index 616c9a8e82..dfb55e4a07 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSelectingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSelectingTest.java @@ -2,8 +2,8 @@ package com.vaadin.tests.components.combobox; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; @@ -34,7 +34,7 @@ public class ComboBoxSelectingTest extends MultiBrowserTest { int initialVisibleOptions = countVisibleOptions(); clearInputAndType("b11"); int visibleOptionsAfterFiltering = countVisibleOptions(); - Assert.assertEquals(1, visibleOptionsAfterFiltering); + assertEquals(1, visibleOptionsAfterFiltering); clickOnLabel(); sleep(1000); // no selection was made, clicking on arrow should show all options @@ -42,7 +42,7 @@ public class ComboBoxSelectingTest extends MultiBrowserTest { comboBoxElement.openPopup(); int visibleOptions = countVisibleOptions(); - Assert.assertEquals(initialVisibleOptions, visibleOptions); + assertEquals(initialVisibleOptions, visibleOptions); } private int countVisibleOptions() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxMenuBarAutoopenTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxMenuBarAutoopenTest.java index 1d2aa64237..1d94993d89 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxMenuBarAutoopenTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxMenuBarAutoopenTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.combobox; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -41,7 +42,7 @@ public class ComboboxMenuBarAutoopenTest extends MultiBrowserTest { openPopup(); MenuBarElement menuBar = selectMenuBar(); menuBar.click(); - Assert.assertFalse("Combobox popup items are visible", + assertFalse("Combobox popup items are visible", isElementPresent(By.className("gwt-MenuItem"))); openPopup(); @@ -52,7 +53,7 @@ public class ComboboxMenuBarAutoopenTest extends MultiBrowserTest { Actions actions = new Actions(getDriver()); actions.moveToElement(menuBarItem).build().perform(); menuBar.click(); - Assert.assertFalse("Combobox popup items are visible", + assertFalse("Combobox popup items are visible", isElementPresent(By.className("gwt-MenuItem"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java index 3a94153eb8..d3ed5607ec 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.combobox; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Point; @@ -65,9 +67,9 @@ public class ComboboxPopupScrollingTest extends MultiBrowserTest { Point newComboLocation = cb.getLocation(); Point newPopupLocation = popup.getLocation(); - Assert.assertNotEquals("ComboBox didn't move on the page", 0, + assertNotEquals("ComboBox didn't move on the page", 0, newComboLocation.y - comboLocation.y); - Assert.assertEquals("Popup didn't move with the combo box", + assertEquals("Popup didn't move with the combo box", newComboLocation.y - comboLocation.y, newPopupLocation.y - popupLocation.y); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/FilteringTurkishLocaleTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/FilteringTurkishLocaleTest.java index c95894112d..0b88d55fe6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/FilteringTurkishLocaleTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/FilteringTurkishLocaleTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.combobox; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.By; @@ -35,7 +36,7 @@ public class FilteringTurkishLocaleTest extends MultiBrowserTest { List<String> suggestions = getFilterSuggestions("i"); - Assert.assertEquals("Both suggestions should be present", 2, + assertEquals("Both suggestions should be present", 2, suggestions.size()); } @@ -47,9 +48,9 @@ public class FilteringTurkishLocaleTest extends MultiBrowserTest { List<String> suggestions = getFilterSuggestions("i"); - Assert.assertEquals("There should be only one suggestion", 1, + assertEquals("There should be only one suggestion", 1, suggestions.size()); - Assert.assertEquals("İ dotted", suggestions.get(0)); + assertEquals("İ dotted", suggestions.get(0)); } @Test @@ -60,9 +61,9 @@ public class FilteringTurkishLocaleTest extends MultiBrowserTest { List<String> suggestions = getFilterSuggestions("ı"); - Assert.assertEquals("There should be only one suggestion", 1, + assertEquals("There should be only one suggestion", 1, suggestions.size()); - Assert.assertEquals("I dotless", suggestions.get(0)); + assertEquals("I dotless", suggestions.get(0)); } private List<String> getFilterSuggestions(String string) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/composite/CompositeChainUITest.java b/uitest/src/test/java/com/vaadin/tests/components/composite/CompositeChainUITest.java index 228d20f058..98171bde98 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/composite/CompositeChainUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/composite/CompositeChainUITest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.composite; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -32,11 +33,11 @@ public class CompositeChainUITest extends SingleBrowserTest { LabelElement label = $(LabelElement.class).id("innermost"); WebElement labelGrandParent = label.findElement(By.xpath("../..")); - Assert.assertEquals("v-slot", labelGrandParent.getAttribute("class")); - Assert.assertEquals("Label caption", label.getCaption()); + assertEquals("v-slot", labelGrandParent.getAttribute("class")); + assertEquals("Label caption", label.getCaption()); $(ButtonElement.class).caption("Update caption").first().click(); - Assert.assertEquals("Label caption - updated", label.getCaption()); + assertEquals("Label caption - updated", label.getCaption()); } @@ -45,11 +46,11 @@ public class CompositeChainUITest extends SingleBrowserTest { openTestURL("debug"); LabelElement label = $(LabelElement.class).id("innermost"); $(ButtonElement.class).caption("Update caption").first().click(); - Assert.assertEquals("Label caption - updated", label.getCaption()); + assertEquals("Label caption - updated", label.getCaption()); $(ButtonElement.class).caption("Replace with another Composite").first() .click(); label = $(LabelElement.class).id("innermost"); - Assert.assertEquals("Label caption", label.getCaption()); + assertEquals("Label caption", label.getCaption()); assertNoErrorNotifications(); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/customlayout/CustomLayoutUpdateCaptionTest.java b/uitest/src/test/java/com/vaadin/tests/components/customlayout/CustomLayoutUpdateCaptionTest.java index c74595d300..272355557a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/customlayout/CustomLayoutUpdateCaptionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/customlayout/CustomLayoutUpdateCaptionTest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.components.customlayout; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -18,13 +19,13 @@ public class CustomLayoutUpdateCaptionTest extends SingleBrowserTest { TextFieldElement tf1 = tfs.get(0); TextFieldElement tf2 = tfs.get(1); - Assert.assertEquals("initial", tf1.getCaption()); - Assert.assertEquals("initial", tf2.getCaption()); + assertEquals("initial", tf1.getCaption()); + assertEquals("initial", tf2.getCaption()); $(ButtonElement.class).first().click(); - Assert.assertEquals("updated", tf1.getCaption()); - Assert.assertEquals("updated", tf2.getCaption()); + assertEquals("updated", tf1.getCaption()); + assertEquals("updated", tf2.getCaption()); } -}
\ No newline at end of file +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/customlayout/CustomLayoutWithMissingSlotTest.java b/uitest/src/test/java/com/vaadin/tests/components/customlayout/CustomLayoutWithMissingSlotTest.java index 498c097237..0713a66c08 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/customlayout/CustomLayoutWithMissingSlotTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/customlayout/CustomLayoutWithMissingSlotTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.customlayout; +import static org.junit.Assert.assertEquals; + import java.util.logging.Level; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -29,10 +30,10 @@ public class CustomLayoutWithMissingSlotTest extends SingleBrowserTest { public void ensureRenderedWithoutErrors() { setDebug(true); openTestURL(); - Assert.assertEquals("", getLogRow(0).trim()); + assertEquals("", getLogRow(0).trim()); $(ButtonElement.class).first().click(); assertNoDebugMessage(Level.SEVERE); - Assert.assertEquals("1. Button clicked", getLogRow(0)); + assertEquals("1. Button clicked", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/customlayout/OverflowAutoFixTest.java b/uitest/src/test/java/com/vaadin/tests/components/customlayout/OverflowAutoFixTest.java index 20fdb5dfe3..ddfa903194 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/customlayout/OverflowAutoFixTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/customlayout/OverflowAutoFixTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.customlayout; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; @@ -35,7 +36,7 @@ public class OverflowAutoFixTest extends MultiBrowserTest { private void assertElementCssValueEquals(String className, String propertyName, String expected) { - Assert.assertEquals( + assertEquals( String.format( "Unexpected value for property '%s' on element '%s',", propertyName, className), diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldElementTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldElementTest.java index 29a05187bc..de0cbaecd0 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldElementTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldElementTest.java @@ -2,10 +2,11 @@ package com.vaadin.tests.components.datefield; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import java.time.LocalDate; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.DateFieldElement; @@ -29,32 +30,30 @@ public class DateFieldElementTest extends SingleBrowserTest { // No date set DateFieldElement defaultInitiallyEmpty = $(DateFieldElement.class) .first(); - Assert.assertNull(defaultInitiallyEmpty.getDate()); + assertNull(defaultInitiallyEmpty.getDate()); defaultInitiallyEmpty.setDate(DateFieldElementUI.TEST_DATE_TIME); - Assert.assertEquals(DateFieldElementUI.TEST_DATE_TIME, + assertEquals(DateFieldElementUI.TEST_DATE_TIME, defaultInitiallyEmpty.getDate()); assertServerValue("Default date field", DateFieldElementUI.TEST_DATE_TIME); DateFieldElement fi = $(DateFieldElement.class).id("fi"); - Assert.assertEquals(DateFieldElementUI.TEST_DATE_TIME, fi.getDate()); + assertEquals(DateFieldElementUI.TEST_DATE_TIME, fi.getDate()); fi.setDate(DateFieldElementUI.ANOTHER_TEST_DATE_TIME); - Assert.assertEquals(DateFieldElementUI.ANOTHER_TEST_DATE_TIME, - fi.getDate()); + assertEquals(DateFieldElementUI.ANOTHER_TEST_DATE_TIME, fi.getDate()); assertServerValue("Finnish date field", DateFieldElementUI.ANOTHER_TEST_DATE_TIME); DateFieldElement us = $(DateFieldElement.class).id("us"); - Assert.assertEquals(DateFieldElementUI.TEST_DATE_TIME, us.getDate()); + assertEquals(DateFieldElementUI.TEST_DATE_TIME, us.getDate()); us.setDate(DateFieldElementUI.ANOTHER_TEST_DATE_TIME); - Assert.assertEquals(DateFieldElementUI.ANOTHER_TEST_DATE_TIME, - us.getDate()); + assertEquals(DateFieldElementUI.ANOTHER_TEST_DATE_TIME, us.getDate()); assertServerValue("US date field", DateFieldElementUI.ANOTHER_TEST_DATE_TIME); } private void assertServerValue(String id, LocalDate testDateTime) { - Assert.assertEquals(id + " value set to " + testDateTime.toString(), + assertEquals(id + " value set to " + testDateTime.toString(), getLogRow(0)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFastForwardTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFastForwardTest.java index f794cfb904..d0c0be734d 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFastForwardTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFastForwardTest.java @@ -16,8 +16,8 @@ package com.vaadin.tests.components.datefield; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -50,7 +50,7 @@ public class DateFieldFastForwardTest extends MultiBrowserTest { // Make browser context menu disappear, since it will crash IE $(VerticalLayoutElement.class).first().click(); - Assert.assertFalse("Month did not change during fast forward", + assertFalse("Month did not change during fast forward", firstMonth.equals(expectedMonth)); // Wait for a while. diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFaultyInputNotValidTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFaultyInputNotValidTest.java index 1fd335b671..3a3b6cd069 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFaultyInputNotValidTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFaultyInputNotValidTest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.components.datefield; +import static org.junit.Assert.assertEquals; + import java.time.LocalDate; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.interactions.Actions; @@ -18,7 +19,7 @@ public class DateFieldFaultyInputNotValidTest extends SingleBrowserTest { public void testEmptyDateFieldOK() { openTestURL(); $(ButtonElement.class).first().click(); - Assert.assertEquals("Empty DateField should be ok", "OK", + assertEquals("Empty DateField should be ok", "OK", $(NotificationElement.class).first().getText()); } @@ -29,7 +30,7 @@ public class DateFieldFaultyInputNotValidTest extends SingleBrowserTest { dateField.setDate(LocalDate.now()); $(ButtonElement.class).first().click(); - Assert.assertEquals("Current date should be ok", "OK", + assertEquals("Current date should be ok", "OK", $(NotificationElement.class).first().getText()); $(NotificationElement.class).first().close(); @@ -37,7 +38,7 @@ public class DateFieldFaultyInputNotValidTest extends SingleBrowserTest { new Actions(getDriver()).sendKeys("asd").perform(); $(ButtonElement.class).first().click(); - Assert.assertEquals("Added 'asd' should make date not parse correctly.", + assertEquals("Added 'asd' should make date not parse correctly.", "Fail", $(NotificationElement.class).first().getText()); } @@ -48,14 +49,14 @@ public class DateFieldFaultyInputNotValidTest extends SingleBrowserTest { dateField.setDate(LocalDate.now()); $(ButtonElement.class).first().click(); - Assert.assertEquals("Current date should be ok", "OK", + assertEquals("Current date should be ok", "OK", $(NotificationElement.class).first().getText()); $(NotificationElement.class).first().close(); dateField.setDate(LocalDate.now().minusDays(7)); $(ButtonElement.class).first().click(); - Assert.assertEquals("Last week should not be ok", "Fail", + assertEquals("Last week should not be ok", "Fail", $(NotificationElement.class).first().getText()); } @@ -66,7 +67,7 @@ public class DateFieldFaultyInputNotValidTest extends SingleBrowserTest { $(DateFieldElement.class).first().setDate(LocalDate.now()); $(ButtonElement.class).first().click(); - Assert.assertEquals("Current date should be ok", "OK", + assertEquals("Current date should be ok", "OK", $(NotificationElement.class).first().getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldIsValidTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldIsValidTest.java index dacbae3db1..b259e6573b 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldIsValidTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldIsValidTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.datefield; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; @@ -59,7 +60,7 @@ public class DateFieldIsValidTest extends MultiBrowserTest { private void assertLogText(String expected) throws Exception { String text = findElement(By.vaadin("PID_SLog_row_0")).getText(); - Assert.assertTrue("Expected '" + expected + "' found '" + text + "'", + assertTrue("Expected '" + expected + "' found '" + text + "'", text.equals(expected)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldTestTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldTestTest.java index a66018b7dd..d9d2a3e206 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldTestTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldTestTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.datefield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; @@ -45,7 +47,7 @@ public class DateFieldTestTest extends MultiBrowserTest { private void assertNoErrorNotification() { if (isElementPresent(NotificationElement.class)) { - Assert.fail("Notification was present"); + fail("Notification was present"); } } @@ -76,7 +78,7 @@ public class DateFieldTestTest extends MultiBrowserTest { openPopup(); closePopup(); String actual = getInput().getAttribute("value"); - Assert.assertEquals(inputtedValue, actual); + assertEquals(inputtedValue, actual); assertNoErrorNotification(); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParentTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParentTest.java index 74b6825915..79c2431aa0 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParentTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.datefield; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; @@ -68,11 +70,10 @@ public class DateFieldWhenChangingValueAndEnablingParentTest boolean hasClass = hasCssClass(id, "v-disabled"); boolean fieldEnabled = !hasClass; if (assertEnabled) { - Assert.assertTrue( - "Field " + id.getAttribute("id") + " should be enabled", + assertTrue("Field " + id.getAttribute("id") + " should be enabled", fieldEnabled); } else { - Assert.assertFalse( + assertFalse( "Field " + id.getAttribute("id") + " should be disabled", fieldEnabled); } @@ -86,12 +87,12 @@ public class DateFieldWhenChangingValueAndEnablingParentTest boolean textinputEnabled = (disabledAttr == null); if (enabled) { - Assert.assertTrue( + assertTrue( "Field " + id.getAttribute("id") + " text field should be enabled", textinputEnabled); } else { - Assert.assertFalse( + assertFalse( "Field " + id.getAttribute("id") + " text field should be disabled", textinputEnabled); diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldElementTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldElementTest.java index 2138fb5df0..dd0cc8d4f8 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldElementTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldElementTest.java @@ -2,10 +2,11 @@ package com.vaadin.tests.components.datefield; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import java.time.LocalDateTime; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.DateTimeFieldElement; @@ -29,35 +30,33 @@ public class DateTimeFieldElementTest extends SingleBrowserTest { // No date set DateTimeFieldElement defaultInitiallyEmpty = $( DateTimeFieldElement.class).first(); - Assert.assertNull(defaultInitiallyEmpty.getDateTime()); + assertNull(defaultInitiallyEmpty.getDateTime()); defaultInitiallyEmpty .setDateTime(DateTimeFieldElementUI.TEST_DATE_TIME); - Assert.assertEquals(DateTimeFieldElementUI.TEST_DATE_TIME, + assertEquals(DateTimeFieldElementUI.TEST_DATE_TIME, defaultInitiallyEmpty.getDateTime()); assertServerValue("Default date field", DateTimeFieldElementUI.TEST_DATE_TIME); DateTimeFieldElement fi = $(DateTimeFieldElement.class).id("fi"); - Assert.assertEquals(DateTimeFieldElementUI.TEST_DATE_TIME, - fi.getDateTime()); + assertEquals(DateTimeFieldElementUI.TEST_DATE_TIME, fi.getDateTime()); fi.setDateTime(DateTimeFieldElementUI.ANOTHER_TEST_DATE_TIME); - Assert.assertEquals(DateTimeFieldElementUI.ANOTHER_TEST_DATE_TIME, + assertEquals(DateTimeFieldElementUI.ANOTHER_TEST_DATE_TIME, fi.getDateTime()); assertServerValue("Finnish date field", DateTimeFieldElementUI.ANOTHER_TEST_DATE_TIME); DateTimeFieldElement us = $(DateTimeFieldElement.class).id("us"); - Assert.assertEquals(DateTimeFieldElementUI.TEST_DATE_TIME, - us.getDateTime()); + assertEquals(DateTimeFieldElementUI.TEST_DATE_TIME, us.getDateTime()); us.setDateTime(DateTimeFieldElementUI.ANOTHER_TEST_DATE_TIME); - Assert.assertEquals(DateTimeFieldElementUI.ANOTHER_TEST_DATE_TIME, + assertEquals(DateTimeFieldElementUI.ANOTHER_TEST_DATE_TIME, us.getDateTime()); assertServerValue("US date field", DateTimeFieldElementUI.ANOTHER_TEST_DATE_TIME); } private void assertServerValue(String id, LocalDateTime testDateTime) { - Assert.assertEquals(id + " value set to " + testDateTime.toString(), + assertEquals(id + " value set to " + testDateTime.toString(), getLogRow(0)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldFastForwardTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldFastForwardTest.java index f42afe1779..90ca8b72fb 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldFastForwardTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldFastForwardTest.java @@ -16,8 +16,8 @@ package com.vaadin.tests.components.datefield; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -50,7 +50,7 @@ public class DateTimeFieldFastForwardTest extends MultiBrowserTest { // Make browser context menu disappear, since it will crash IE $(VerticalLayoutElement.class).first().click(); - Assert.assertFalse("Month did not change during fast forward", + assertFalse("Month did not change during fast forward", firstMonth.equals(expectedMonth)); // Wait for a while. diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldIsValidTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldIsValidTest.java index 06e8a146c0..8671b9d755 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldIsValidTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldIsValidTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.datefield; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; @@ -59,7 +60,7 @@ public class DateTimeFieldIsValidTest extends MultiBrowserTest { private void assertLogText(String expected) throws Exception { String text = findElement(By.vaadin("PID_SLog_row_0")).getText(); - Assert.assertTrue("Expected '" + expected + "' found '" + text + "'", + assertTrue("Expected '" + expected + "' found '" + text + "'", text.equals(expected)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldTestTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldTestTest.java index e835ac5158..30603c11f8 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldTestTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldTestTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.datefield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; @@ -49,7 +51,7 @@ public class DateTimeFieldTestTest extends MultiBrowserTest { private void assertNoErrorNotification() { if (isElementPresent(NotificationElement.class)) { - Assert.fail("Notification was present"); + fail("Notification was present"); } } @@ -80,7 +82,7 @@ public class DateTimeFieldTestTest extends MultiBrowserTest { openPopup(); closePopup(); String actual = getInput().getAttribute("value"); - Assert.assertEquals(inputtedValue, actual); + assertEquals(inputtedValue, actual); assertNoErrorNotification(); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldWeekDaysTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldWeekDaysTest.java index ebe6220a14..6e61140032 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldWeekDaysTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldWeekDaysTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.datefield; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; @@ -43,7 +45,8 @@ public class DateTimeFieldWeekDaysTest extends SingleBrowserTest { $(CheckBoxElement.class).first().click(); - Assert.assertFalse("Checkbox is selected even though should be unselected.", $(CheckBoxElement.class).first().isChecked()); + assertFalse("Checkbox is selected even though should be unselected.", + $(CheckBoxElement.class).first().isChecked()); openPopupAndValidateNoWeeknumbers(); } @@ -81,10 +84,10 @@ public class DateTimeFieldWeekDaysTest extends SingleBrowserTest { waitUntil(ExpectedConditions.visibilityOfElementLocated( org.openqa.selenium.By.className("v-datefield-popup"))); - Assert.assertFalse("No week numbers found for date field!", + assertFalse("No week numbers found for date field!", findElements( By.className("v-datefield-calendarpanel-weeknumber")) - .isEmpty()); + .isEmpty()); // Close popup popupButton.click(); } @@ -98,10 +101,10 @@ public class DateTimeFieldWeekDaysTest extends SingleBrowserTest { waitUntil(ExpectedConditions.visibilityOfElementLocated( org.openqa.selenium.By.className("v-datefield-popup"))); - Assert.assertTrue("Week numbers still found in calendar popup!", + assertTrue("Week numbers still found in calendar popup!", findElements( By.className("v-datefield-calendarpanel-weeknumber")) - .isEmpty()); + .isEmpty()); // Close popup popupButton.click(); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java index 26daf45a5d..9db0949daa 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java @@ -15,10 +15,11 @@ */ package com.vaadin.tests.components.datefield; +import static org.junit.Assert.assertFalse; + import java.io.IOException; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -44,7 +45,7 @@ public class DisabledDateFieldPopupTest extends MultiBrowserTest { new Actions(driver).moveToElement(button).click() .sendKeys(Keys.ARROW_DOWN).perform(); - Assert.assertFalse( + assertFalse( "Calendar popup should not be opened for disabled date field", isElementPresent(By.className("v-datefield-popup"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DisabledParentLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DisabledParentLayoutTest.java index 84cb6f3e05..47c62b57c4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DisabledParentLayoutTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DisabledParentLayoutTest.java @@ -15,7 +15,10 @@ */ package com.vaadin.tests.components.datefield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -39,7 +42,7 @@ public class DisabledParentLayoutTest extends MultiBrowserTest { .findElement(By.className("v-datefield-textfield")); textField.click(); - Assert.assertFalse( + assertFalse( "Date input text field shoud be disabled for disabled DateField", textField.isEnabled()); @@ -47,13 +50,12 @@ public class DisabledParentLayoutTest extends MultiBrowserTest { .findElement(By.className("v-datefield-button")); dataFieldButton.click(); - Assert.assertFalse( - "Disabled date popup is opened after click to its button", + assertFalse("Disabled date popup is opened after click to its button", isElementPresent(By.className("v-datefield-popup"))); button.click(); - Assert.assertTrue( + assertTrue( "Date input text field should be enabled for enabled DateField", textField.isEnabled()); @@ -61,15 +63,16 @@ public class DisabledParentLayoutTest extends MultiBrowserTest { String text = "text"; textField.sendKeys(text); - Assert.assertEquals("Unexpected text in date text field", text, + assertEquals("Unexpected text in date text field", text, textField.getAttribute("value")); dataFieldButton.click(); - dataFieldButton.click();//Requires two clicks because of error message. TODO fix - Assert.assertFalse("Unexpected disabled element found", + dataFieldButton.click();// Requires two clicks because of error message. + // TODO fix + assertFalse("Unexpected disabled element found", isElementPresent(By.className("v-disabled"))); - Assert.assertTrue("Date popup is not opened after click to its button", + assertTrue("Date popup is not opened after click to its button", isElementPresent(By.className("v-datefield-popup"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/ReindeerDateFieldPopupPositionTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/ReindeerDateFieldPopupPositionTest.java index f264f99320..d676955b0e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/ReindeerDateFieldPopupPositionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/ReindeerDateFieldPopupPositionTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.datefield; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.openqa.selenium.WebElement; import com.vaadin.testbench.elements.DateFieldElement; @@ -36,7 +37,7 @@ public class ReindeerDateFieldPopupPositionTest int right = field.getLocation().getX() + field.getSize().getWidth(); WebElement popup = getPopup(); - Assert.assertTrue( + assertTrue( "Calendar popup has wrong X coordinate=" + popup.getLocation().getX() + " , right side of the field is " + right, diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/TimePopupSelectionTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/TimePopupSelectionTest.java index b10f2299c5..3b299f6308 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/TimePopupSelectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/TimePopupSelectionTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.datefield; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; @@ -38,7 +39,7 @@ public class TimePopupSelectionTest extends MultiBrowserTest { openTestURL(); DateTimeFieldElement field = $(DateTimeFieldElement.class).first(); - Assert.assertEquals("1/13/17 01:00:00 AM", field.getValue()); + assertEquals("1/13/17 01:00:00 AM", field.getValue()); field.openPopup(); @@ -47,13 +48,13 @@ public class TimePopupSelectionTest extends MultiBrowserTest { .findElements(By.tagName("select")); new Select(timeSelects.get(0)).selectByValue("09"); - Assert.assertEquals("1/13/17 09:00:00 AM", field.getValue()); + assertEquals("1/13/17 09:00:00 AM", field.getValue()); new Select(timeSelects.get(1)).selectByValue("35"); - Assert.assertEquals("1/13/17 09:35:00 AM", field.getValue()); + assertEquals("1/13/17 09:35:00 AM", field.getValue()); new Select(timeSelects.get(2)).selectByValue("41"); - Assert.assertEquals("1/13/17 09:35:41 AM", field.getValue()); + assertEquals("1/13/17 09:35:41 AM", field.getValue()); closePopup(); diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/ValoDateFieldPopupPositionTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/ValoDateFieldPopupPositionTest.java index 19dcc636ce..434e8d7063 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/ValoDateFieldPopupPositionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/ValoDateFieldPopupPositionTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.datefield; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.openqa.selenium.WebElement; import com.vaadin.testbench.elements.DateFieldElement; @@ -37,7 +38,7 @@ public class ValoDateFieldPopupPositionTest extends DateFieldPopupPositionTest { int popupRight = popup.getLocation().getX() + popup.getSize().getWidth(); - Assert.assertTrue( + assertTrue( "Calendar popup has wrong X coordinate=" + popupRight + " , left side of the field is " + left, popupRight <= left); diff --git a/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java b/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java index d0aa567e20..0fb55a77c5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.draganddropwrapper; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.AbstractTextFieldElement; @@ -39,13 +40,13 @@ public class DragAndDropFocusObtainTest extends MultiBrowserTest { .all()) { String caption = ta.getCaption(); ta.click(); - Assert.assertEquals(index + ". Field '" + caption + "' focused", + assertEquals(index + ". Field '" + caption + "' focused", getLogRow(0)); index++; } // Make sure we checked all fields - Assert.assertEquals(8 + 1, index); + assertEquals(8 + 1, index); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropRelativeWidthTest.java b/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropRelativeWidthTest.java index fee9d5de30..6ff7b31109 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropRelativeWidthTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropRelativeWidthTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.draganddropwrapper; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; @@ -48,9 +49,9 @@ public class DragAndDropRelativeWidthTest extends MultiBrowserTest { WebElement dragImage = getDriver() .findElement(By.className("v-drag-element")); - Assert.assertEquals("Drag image element height is unexpected", height, + assertEquals("Drag image element height is unexpected", height, dragImage.getSize().getHeight()); - Assert.assertEquals("Drag image element width is unexpected", width, + assertEquals("Drag image element width is unexpected", width, dragImage.getSize().getWidth()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropTextAreaTest.java b/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropTextAreaTest.java index 349413f043..6374bd069b 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropTextAreaTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropTextAreaTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.draganddropwrapper; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; @@ -54,8 +55,8 @@ public class DragAndDropTextAreaTest extends MultiBrowserTest { } } - Assert.assertTrue( - "Text value is not found in the DnD image of text area", found); + assertTrue("Text value is not found in the DnD image of text area", + found); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/embedded/EmbeddedAltTextTest.java b/uitest/src/test/java/com/vaadin/tests/components/embedded/EmbeddedAltTextTest.java index 6c24a05b6d..5ac85535d2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/embedded/EmbeddedAltTextTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/embedded/EmbeddedAltTextTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.embedded; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; @@ -38,18 +40,18 @@ public class EmbeddedAltTextTest extends MultiBrowserTest { public void testEmbeddedAltText() { EmbeddedElement embedded = $(EmbeddedElement.class).first(); - Assert.assertEquals("Alt text of the image", getAltText(embedded)); + assertEquals("Alt text of the image", getAltText(embedded)); assertHtmlSource("Alt text of the object"); $(ButtonElement.class).first().click(); - Assert.assertEquals("New alt text of the image!", getAltText(embedded)); + assertEquals("New alt text of the image!", getAltText(embedded)); assertHtmlSource("New alt text of the object!"); } private void assertHtmlSource(String html) { String pageSource = driver.getPageSource(); - Assert.assertTrue("Page source does not contain '" + html + "'", + assertTrue("Page source does not contain '" + html + "'", pageSource.contains(html)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinatesTest.java b/uitest/src/test/java/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinatesTest.java index 64ab631655..6657102e5b 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinatesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinatesTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.embedded; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -58,13 +60,13 @@ public class EmbeddedClickListenerRelativeCoordinatesTest int x = Integer.parseInt(xLabel.getText()); int y = Integer.parseInt(yLabel.getText()); - Assert.assertEquals( + assertEquals( "Reported X-coordinate from Embedded does not match click location", expectedX, x); // IE10 and IE11 sometimes click one pixel below the given position int tolerance = isIE() ? 1 : 0; - Assert.assertTrue( + assertTrue( "Reported Y-coordinate from Embedded does not match click location", Math.abs(expectedY - y) <= tolerance); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/flash/FlashExpansionTest.java b/uitest/src/test/java/com/vaadin/tests/components/flash/FlashExpansionTest.java index c21992941c..4650c9eeef 100755 --- a/uitest/src/test/java/com/vaadin/tests/components/flash/FlashExpansionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/flash/FlashExpansionTest.java @@ -1,8 +1,10 @@ package com.vaadin.tests.components.flash; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -29,11 +31,11 @@ public class FlashExpansionTest extends MultiBrowserTest { waitForElementPresent(locator); WebElement embed = $(FlashElement.class).first().findElement(locator); String width = embed.getAttribute("width"); - Assert.assertEquals("Width is not 400.0px initially", "400", width); + assertEquals("Width is not 400.0px initially", "400", width); $(ButtonElement.class).first().click(); embed = $(FlashElement.class).first().findElement(locator); String widthAfterExpansion = embed.getAttribute("width"); - Assert.assertNotEquals("Width is still 400.0px after expansion", "400", + assertNotEquals("Width is still 400.0px after expansion", "400", widthAfterExpansion); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutClickListenerTest.java b/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutClickListenerTest.java index 4985d0fcdb..1fb79b097c 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutClickListenerTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutClickListenerTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.formlayout; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -47,11 +48,11 @@ public class FormLayoutClickListenerTest extends MultiBrowserTest { element.getLocation().getY() + 2).click().build().perform(); waitForLogRowUpdate(); - Assert.assertEquals("Source component for click event must be form", + assertEquals("Source component for click event must be form", "3. Source component: form", getLogRow(0)); - Assert.assertEquals("Clicked component for click event must be null", + assertEquals("Clicked component for click event must be null", "2. Clicked component: null", getLogRow(1)); - Assert.assertEquals("Child component for click event must be null", + assertEquals("Child component for click event must be null", "1. Child component: null", getLogRow(2)); } @@ -60,11 +61,11 @@ public class FormLayoutClickListenerTest extends MultiBrowserTest { findElement(By.id("label")).click(); waitForLogRowUpdate(); - Assert.assertEquals("Source component for click event must be form", + assertEquals("Source component for click event must be form", "3. Source component: form", getLogRow(0)); - Assert.assertEquals("Clicked component for click event must be label", + assertEquals("Clicked component for click event must be label", "2. Clicked component: label", getLogRow(1)); - Assert.assertEquals("Child component for click event must be label", + assertEquals("Child component for click event must be label", "1. Child component: label", getLogRow(2)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutInVerticalLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutInVerticalLayoutTest.java index c8183bc9a1..a286de771c 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutInVerticalLayoutTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutInVerticalLayoutTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.formlayout; +import static org.junit.Assert.assertNotEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -39,7 +40,7 @@ public class FormLayoutInVerticalLayoutTest extends MultiBrowserTest { String formLabelMargin = labels.get(0).getCssValue("margin-top"); String verticalLayoutLabelMargin = labels.get(1) .getCssValue("margin-top"); - Assert.assertNotEquals( + assertNotEquals( "'margin-top' values for header label in vertical layout " + "and form layout are the same", verticalLayoutLabelMargin, formLabelMargin); diff --git a/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutResizingTest.java b/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutResizingTest.java index 9b800fa524..fa137cc1f1 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutResizingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/formlayout/FormLayoutResizingTest.java @@ -15,16 +15,17 @@ */ package com.vaadin.tests.components.formlayout; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.FormLayoutElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.parallel.BrowserUtil; import com.vaadin.tests.tb3.MultiBrowserThemeTest; @@ -34,10 +35,10 @@ public class FormLayoutResizingTest extends MultiBrowserThemeTest { openTestURL(); List<TableElement> tables = $(TableElement.class).all(); - Assert.assertEquals("Sanity check", 2, tables.size()); + assertEquals("Sanity check", 2, tables.size()); List<FormLayoutElement> layouts = $(FormLayoutElement.class).all(); - Assert.assertEquals("Sanity check", 2, layouts.size()); + assertEquals("Sanity check", 2, layouts.size()); ButtonElement toggleButton = $(ButtonElement.class).first(); @@ -58,9 +59,9 @@ public class FormLayoutResizingTest extends MultiBrowserThemeTest { int[] expandedWidths = getWidths(tables); - Assert.assertEquals("Table should have grown ", originalWidths[0] + 200, + assertEquals("Table should have grown ", originalWidths[0] + 200, expandedWidths[0]); - Assert.assertEquals("Wrapped table should have grown ", + assertEquals("Wrapped table should have grown ", originalWidths[1] + 200, expandedWidths[1]); // Toggle size from 600 px to 400 px @@ -68,9 +69,9 @@ public class FormLayoutResizingTest extends MultiBrowserThemeTest { int[] collapsedWidths = getWidths(tables); - Assert.assertEquals("Table should return to original width ", + assertEquals("Table should return to original width ", originalWidths[0], collapsedWidths[0]); - Assert.assertEquals("Wrapped table should return to original width ", + assertEquals("Wrapped table should return to original width ", originalWidths[1], collapsedWidths[1]); // Verify that growing is not restricted after triggering the fix @@ -79,9 +80,9 @@ public class FormLayoutResizingTest extends MultiBrowserThemeTest { expandedWidths = getWidths(tables); - Assert.assertEquals("Table should have grown ", originalWidths[0] + 200, + assertEquals("Table should have grown ", originalWidths[0] + 200, expandedWidths[0]); - Assert.assertEquals("Wrapped table should have grown ", + assertEquals("Wrapped table should have grown ", originalWidths[1] + 200, expandedWidths[1]); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/formlayout/HtmlCaptionInFormLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/components/formlayout/HtmlCaptionInFormLayoutTest.java index 0032d8c6fd..ecf7df9f84 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/formlayout/HtmlCaptionInFormLayoutTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/formlayout/HtmlCaptionInFormLayoutTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.formlayout; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -33,11 +34,10 @@ public class HtmlCaptionInFormLayoutTest extends SingleBrowserTest { List<WebElement> captions = getDriver() .findElements(By.cssSelector(".v-formlayout-captioncell span")); - Assert.assertEquals("Should be two formlayout captions", 2, - captions.size()); + assertEquals("Should be two formlayout captions", 2, captions.size()); - Assert.assertEquals("Contains HTML", captions.get(0).getText()); - Assert.assertEquals("Contains <b>HTML</b>", captions.get(1).getText()); + assertEquals("Contains HTML", captions.get(0).getText()); + assertEquals("Contains <b>HTML</b>", captions.get(1).getText()); } @Test @@ -49,11 +49,10 @@ public class HtmlCaptionInFormLayoutTest extends SingleBrowserTest { List<WebElement> captions = getDriver() .findElements(By.cssSelector(".v-formlayout-captioncell span")); - Assert.assertEquals("Should be two formlayout captions", 2, - captions.size()); + assertEquals("Should be two formlayout captions", 2, captions.size()); - Assert.assertEquals("Contains <b>HTML</b>", captions.get(0).getText()); - Assert.assertEquals("Contains HTML", captions.get(1).getText()); + assertEquals("Contains <b>HTML</b>", captions.get(0).getText()); + assertEquals("Contains HTML", captions.get(1).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/formlayout/StylePrefixTest.java b/uitest/src/test/java/com/vaadin/tests/components/formlayout/StylePrefixTest.java index c9199c87e9..f297843289 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/formlayout/StylePrefixTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/formlayout/StylePrefixTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.formlayout; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; @@ -33,7 +34,7 @@ public class StylePrefixTest extends MultiBrowserTest { public void testStylePrefix() { openTestURL(); - Assert.assertTrue("Custom style has unexpected prefix", + assertTrue("Custom style has unexpected prefix", isElementPresent(By.className("v-formlayout-mystyle"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/DisallowedDeselectionTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/DisallowedDeselectionTest.java index 85d202d50d..6da0c0c260 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/DisallowedDeselectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/DisallowedDeselectionTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -34,26 +36,26 @@ public class DisallowedDeselectionTest extends MultiBrowserTest { openTestURL(); GridRowElement row = $(GridElement.class).first().getRow(0); - Assert.assertFalse(row.isSelected()); + assertFalse(row.isSelected()); select(row); - Assert.assertTrue(row.isSelected()); + assertTrue(row.isSelected()); // deselection is disallowed select(row); - Assert.assertTrue(row.isSelected()); + assertTrue(row.isSelected()); // select another row GridRowElement oldRow = row; row = $(GridElement.class).first().getRow(1); select(row); - Assert.assertTrue(row.isSelected()); - Assert.assertFalse(oldRow.isSelected()); + assertTrue(row.isSelected()); + assertFalse(oldRow.isSelected()); $(ButtonElement.class).first().click(); select(row); - Assert.assertFalse(row.isSelected()); + assertFalse(row.isSelected()); } private void select(GridRowElement row) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridAddColumnTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridAddColumnTest.java index e3595e7674..283bc1ef36 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridAddColumnTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridAddColumnTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; @@ -60,9 +62,9 @@ public class GridAddColumnTest extends SingleBrowserTest { @Test public void initial_header_content() { GridCellElement firstHeader = grid.getHeaderCell(0, 0); - Assert.assertTrue("No label element in header", + assertTrue("No label element in header", firstHeader.isElementPresent(By.className("v-label"))); - Assert.assertEquals("Text in label does not match", "Label Header", + assertEquals("Text in label does not match", "Label Header", firstHeader.getText()); } @@ -71,8 +73,8 @@ public class GridAddColumnTest extends SingleBrowserTest { $(ButtonElement.class).first().click(); // Verify button got clicked - Assert.assertTrue(isElementPresent(NotificationElement.class)); - Assert.assertEquals("Columns replaced.", + assertTrue(isElementPresent(NotificationElement.class)); + assertEquals("Columns replaced.", $(NotificationElement.class).first().getText()); // Run default rendering test @@ -80,13 +82,13 @@ public class GridAddColumnTest extends SingleBrowserTest { } private void assertCellEquals(int rowIndex, int colIndex, String content) { - Assert.assertEquals("Cell text should equal", content, + assertEquals("Cell text should equal", content, grid.getCell(rowIndex, colIndex).getText()); } private void assertCellStartsWith(int rowIndex, int colIndex, String startsWith) { - Assert.assertTrue("Cell text should start with", grid + assertTrue("Cell text should start with", grid .getCell(rowIndex, colIndex).getText().startsWith(startsWith)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java index 7f667eea1d..0b5b5f10ee 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -32,11 +34,11 @@ public class GridApplyFilterWhenScrolledDownTest extends MultiBrowserTest { }); WebElement cell = gridBody.findElements(By.className("v-grid-cell")) .get(0); - Assert.assertEquals("Test", cell.getText()); + assertEquals("Test", cell.getText()); int gridHeight = grid.getSize().getHeight(); int scrollerHeight = grid.getVerticalScroller().getSize().getHeight(); - Assert.assertTrue( + assertTrue( "Scroller height is " + scrollerHeight + ", should be smaller than grid height: " + gridHeight, scrollerHeight < gridHeight); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridCheckBoxDisplayTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridCheckBoxDisplayTest.java index 0a667ffcb6..b5988f8892 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridCheckBoxDisplayTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridCheckBoxDisplayTest.java @@ -15,12 +15,13 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -32,17 +33,16 @@ public class GridCheckBoxDisplayTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); - Assert.assertEquals("First item had wrong value", "true", + assertEquals("First item had wrong value", "true", grid.getCell(0, 0).getText()); - Assert.assertEquals("Second item had wrong value", "false", + assertEquals("Second item had wrong value", "false", grid.getCell(1, 0).getText()); // First edit false item and see that the CheckBox is unchecked grid.getCell(1, 0).doubleClick(); CheckBoxElement checkbox = $(CheckBoxElement.class).first(); - Assert.assertEquals("CheckBox was checked", "unchecked", - checkbox.getValue()); + assertEquals("CheckBox was checked", "unchecked", checkbox.getValue()); closeEditor(); @@ -50,7 +50,7 @@ public class GridCheckBoxDisplayTest extends SingleBrowserTest { grid.getCell(0, 0).doubleClick(); checkbox = $(CheckBoxElement.class).first(); - Assert.assertEquals("CheckBox was not checked.", "checked", + assertEquals("CheckBox was not checked.", "checked", checkbox.getValue()); closeEditor(); @@ -59,8 +59,7 @@ public class GridCheckBoxDisplayTest extends SingleBrowserTest { grid.getCell(1, 0).doubleClick(); checkbox = $(CheckBoxElement.class).first(); - Assert.assertEquals("CheckBox was checked", "unchecked", - checkbox.getValue()); + assertEquals("CheckBox was checked", "unchecked", checkbox.getValue()); } /** diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridClickableRenderersTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridClickableRenderersTest.java index 541851b8a1..81d038cfa8 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridClickableRenderersTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridClickableRenderersTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -30,8 +32,8 @@ public class GridClickableRenderersTest extends MultiBrowserTest { @Test public void clickableRenderersPresent() { openTestURL(); - Assert.assertTrue(isElementPresent(By.className("v-nativebutton"))); - Assert.assertTrue(isElementPresent(By.className("gwt-Image"))); + assertTrue(isElementPresent(By.className("v-nativebutton"))); + assertTrue(isElementPresent(By.className("gwt-Image"))); } @Test @@ -41,23 +43,23 @@ public class GridClickableRenderersTest extends MultiBrowserTest { By.className("v-nativebutton")); WebElement firstRowTextButton = findElements.get(0); WebElement firstRowHtmlButton = findElements.get(1); - Assert.assertEquals("button 1 text", firstRowTextButton.getText()); + assertEquals("button 1 text", firstRowTextButton.getText()); // If it was rendered as text, getText() would return the markup also - Assert.assertEquals("button 1 html", firstRowHtmlButton.getText()); + assertEquals("button 1 html", firstRowHtmlButton.getText()); WebElement secondRowTextButton = findElements.get(3); WebElement secondRowHtmlButton = findElements.get(4); - Assert.assertEquals("button 2 text", secondRowTextButton.getText()); + assertEquals("button 2 text", secondRowTextButton.getText()); // If it was rendered as text, getText() would return the markup also - Assert.assertEquals("button 2 html", secondRowHtmlButton.getText()); + assertEquals("button 2 html", secondRowHtmlButton.getText()); LabelElement label = $(LabelElement.class).get(1); firstRowTextButton.click(); - Assert.assertEquals("first row clicked", label.getText()); + assertEquals("first row clicked", label.getText()); secondRowTextButton.click(); - Assert.assertEquals("second row clicked", label.getText()); + assertEquals("second row clicked", label.getText()); } @Test @@ -70,9 +72,9 @@ public class GridClickableRenderersTest extends MultiBrowserTest { LabelElement label = $(LabelElement.class).get(2); firstRowButton.click(); - Assert.assertEquals("first row false", label.getText()); + assertEquals("first row false", label.getText()); secondRowButton.click(); - Assert.assertEquals("second row true", label.getText()); + assertEquals("second row true", label.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnHidingTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnHidingTest.java index e1b5939ead..6728b621dd 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnHidingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnHidingTest.java @@ -16,10 +16,11 @@ package com.vaadin.tests.components.grid; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Dimension; import org.openqa.selenium.WebElement; @@ -42,28 +43,28 @@ public class GridColumnHidingTest extends MultiBrowserTest { ButtonElement toggleAgeColumn = $(ButtonElement.class).get(1); ButtonElement toggleEmailColumn = $(ButtonElement.class).get(2); - Assert.assertEquals("Foo", grid.getCell(0, 0).getText()); - Assert.assertEquals("Maya", grid.getCell(1, 0).getText()); - Assert.assertEquals("46", grid.getCell(0, 1).getText()); - Assert.assertEquals("yeah@cool.com", grid.getCell(0, 2).getText()); + assertEquals("Foo", grid.getCell(0, 0).getText()); + assertEquals("Maya", grid.getCell(1, 0).getText()); + assertEquals("46", grid.getCell(0, 1).getText()); + assertEquals("yeah@cool.com", grid.getCell(0, 2).getText()); toggleAgeColumn.click(); - Assert.assertEquals("Foo", grid.getCell(0, 0).getText()); - Assert.assertEquals("Maya", grid.getCell(1, 0).getText()); - Assert.assertEquals("yeah@cool.com", grid.getCell(0, 1).getText()); + assertEquals("Foo", grid.getCell(0, 0).getText()); + assertEquals("Maya", grid.getCell(1, 0).getText()); + assertEquals("yeah@cool.com", grid.getCell(0, 1).getText()); toggleNameColumn.click(); - Assert.assertEquals("yeah@cool.com", grid.getCell(0, 0).getText()); + assertEquals("yeah@cool.com", grid.getCell(0, 0).getText()); toggleEmailColumn.click(); - Assert.assertFalse(isElementPresent(By.className("v-grid-cell"))); + assertFalse(isElementPresent(By.className("v-grid-cell"))); toggleAgeColumn.click(); toggleNameColumn.click(); toggleEmailColumn.click(); - Assert.assertEquals("Foo", grid.getCell(0, 0).getText()); - Assert.assertEquals("46", grid.getCell(0, 1).getText()); - Assert.assertEquals("yeah@cool.com", grid.getCell(0, 2).getText()); + assertEquals("Foo", grid.getCell(0, 0).getText()); + assertEquals("46", grid.getCell(0, 1).getText()); + assertEquals("yeah@cool.com", grid.getCell(0, 2).getText()); } @Test @@ -73,19 +74,19 @@ public class GridColumnHidingTest extends MultiBrowserTest { getSidebarOpenButton(grid).click(); getColumnHidingToggle(grid, "custom age column caption").click(); - Assert.assertEquals("Foo", grid.getCell(0, 0).getText()); - Assert.assertEquals("Maya", grid.getCell(1, 0).getText()); - Assert.assertEquals("yeah@cool.com", grid.getCell(0, 1).getText()); - Assert.assertEquals("maya@foo.bar", grid.getCell(1, 1).getText()); + assertEquals("Foo", grid.getCell(0, 0).getText()); + assertEquals("Maya", grid.getCell(1, 0).getText()); + assertEquals("yeah@cool.com", grid.getCell(0, 1).getText()); + assertEquals("maya@foo.bar", grid.getCell(1, 1).getText()); getColumnHidingToggle(grid, "Name").click(); - Assert.assertEquals("yeah@cool.com", grid.getCell(0, 0).getText()); + assertEquals("yeah@cool.com", grid.getCell(0, 0).getText()); getColumnHidingToggle(grid, "custom age column caption").click(); - Assert.assertEquals("46", grid.getCell(0, 0).getText()); - Assert.assertEquals("18", grid.getCell(1, 0).getText()); - Assert.assertEquals("yeah@cool.com", grid.getCell(0, 1).getText()); - Assert.assertEquals("maya@foo.bar", grid.getCell(1, 1).getText()); + assertEquals("46", grid.getCell(0, 0).getText()); + assertEquals("18", grid.getCell(1, 0).getText()); + assertEquals("yeah@cool.com", grid.getCell(0, 1).getText()); + assertEquals("maya@foo.bar", grid.getCell(1, 1).getText()); } @Test @@ -101,10 +102,10 @@ public class GridColumnHidingTest extends MultiBrowserTest { // Show from server $(ButtonElement.class).caption("server side toggle age column").first() .click(); - Assert.assertEquals("46", grid.getCell(0, 0).getText()); - Assert.assertEquals("18", grid.getCell(1, 0).getText()); - Assert.assertEquals("yeah@cool.com", grid.getCell(0, 1).getText()); - Assert.assertEquals("maya@foo.bar", grid.getCell(1, 1).getText()); + assertEquals("46", grid.getCell(0, 0).getText()); + assertEquals("18", grid.getCell(1, 0).getText()); + assertEquals("yeah@cool.com", grid.getCell(0, 1).getText()); + assertEquals("maya@foo.bar", grid.getCell(1, 1).getText()); } @Test @@ -115,19 +116,19 @@ public class GridColumnHidingTest extends MultiBrowserTest { ButtonElement toggleNameColumn = $(ButtonElement.class).get(0); ButtonElement toggleAgeColumn = $(ButtonElement.class).get(1); - Assert.assertEquals("visibility change label", isHiddenLabel.getText()); + assertEquals("visibility change label", isHiddenLabel.getText()); toggleNameColumn.click(); - Assert.assertEquals("true", isHiddenLabel.getText()); + assertEquals("true", isHiddenLabel.getText()); toggleAgeColumn.click(); - Assert.assertEquals("true", isHiddenLabel.getText()); + assertEquals("true", isHiddenLabel.getText()); toggleAgeColumn.click(); - Assert.assertEquals("false", isHiddenLabel.getText()); + assertEquals("false", isHiddenLabel.getText()); getSidebarOpenButton(grid).click(); getColumnHidingToggle(grid, "Name").click(); - Assert.assertEquals("false", isHiddenLabel.getText()); + assertEquals("false", isHiddenLabel.getText()); getColumnHidingToggle(grid, "custom age column caption").click(); - Assert.assertEquals("true", isHiddenLabel.getText()); + assertEquals("true", isHiddenLabel.getText()); getSidebarOpenButton(grid).click(); } @@ -137,9 +138,9 @@ public class GridColumnHidingTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); getSidebarOpenButton(grid).click(); List<WebElement> elements = getColumnHidingToggles(grid); - Assert.assertEquals(2, elements.size()); - Assert.assertTrue("Name".equals(elements.get(0).getText())); - Assert.assertTrue( + assertEquals(2, elements.size()); + assertTrue("Name".equals(elements.get(0).getText())); + assertTrue( "custom age column caption".equals(elements.get(1).getText())); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnResizingTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnResizingTest.java index 3f2a08d979..a95992df23 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnResizingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnResizingTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; @@ -33,11 +35,11 @@ public class GridColumnResizingTest extends MultiBrowserTest { ButtonElement toggleResizableButton = $(ButtonElement.class).get(4); GridCellElement cell = getGrid().getHeaderCell(0, 0); - Assert.assertEquals(true, cell.isElementPresent( + assertEquals(true, cell.isElementPresent( By.cssSelector("div.v-grid-column-resize-handle"))); toggleResizableButton.click(); - Assert.assertEquals(false, cell.isElementPresent( + assertEquals(false, cell.isElementPresent( By.cssSelector("div.v-grid-column-resize-handle"))); } @@ -87,16 +89,13 @@ public class GridColumnResizingTest extends MultiBrowserTest { public void resizeEventListener() { openTestURL(); - Assert.assertEquals("not resized", - $(LabelElement.class).get(1).getText()); + assertEquals("not resized", $(LabelElement.class).get(1).getText()); serverSideSetWidth(150); - Assert.assertEquals("server resized", - $(LabelElement.class).get(1).getText()); + assertEquals("server resized", $(LabelElement.class).get(1).getText()); dragResizeColumn(0, 0, 100); - Assert.assertEquals("client resized", - $(LabelElement.class).get(1).getText()); + assertEquals("client resized", $(LabelElement.class).get(1).getText()); } private GridElement getGrid() { @@ -137,13 +136,13 @@ public class GridColumnResizingTest extends MultiBrowserTest { } private void assertColumnWidth(int width, int columnIndex) { - Assert.assertEquals(width, + assertEquals(width, getGrid().getCell(0, columnIndex).getSize().getWidth()); } private void assertColumnWidthWithThreshold(int width, int columnIndex, int threshold) { - Assert.assertTrue( + assertTrue( Math.abs(getGrid().getCell(0, columnIndex).getSize().getWidth() - width) <= threshold); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnWidthsWithoutDataTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnWidthsWithoutDataTest.java index b85e6cb4d8..da767f3b4d 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnWidthsWithoutDataTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnWidthsWithoutDataTest.java @@ -15,13 +15,17 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.util.List; -import org.junit.Assert; import org.junit.Test; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.GridElement.GridCellElement; import com.vaadin.testbench.elements.NativeSelectElement; import com.vaadin.testbench.elements.NotificationElement; @@ -37,9 +41,9 @@ public class GridColumnWidthsWithoutDataTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); int[] baseWidths = getColWidths(grid); - Assert.assertEquals("Sanity check", 2, baseWidths.length); + assertEquals("Sanity check", 2, baseWidths.length); - Assert.assertTrue("Columns should not have equal width", + assertTrue("Columns should not have equal width", Math.abs(baseWidths[0] - baseWidths[1]) > 2); removeData(); @@ -60,20 +64,20 @@ public class GridColumnWidthsWithoutDataTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); int[] baseWidths = getColWidths(grid); - Assert.assertEquals("Sanity check", 2, baseWidths.length); + assertEquals("Sanity check", 2, baseWidths.length); - Assert.assertTrue("Columns should have roughly equal width", + assertTrue("Columns should have roughly equal width", Math.abs(baseWidths[0] - baseWidths[1]) < 10); - Assert.assertTrue("Columns should not have default widths", + assertTrue("Columns should not have default widths", baseWidths[0] > 140); - Assert.assertTrue("Columns should not have default widths", + assertTrue("Columns should not have default widths", baseWidths[1] > 140); addData(); assertSameWidths(baseWidths, getColWidths(grid)); - Assert.assertFalse("Notification was present", + assertFalse("Notification was present", isElementPresent(NotificationElement.class)); } @@ -89,7 +93,7 @@ public class GridColumnWidthsWithoutDataTest extends SingleBrowserTest { int sum = sumUsedWidths(grid); // 295 instead of 300 to avoid rounding issues - Assert.assertTrue("Only " + sum + " out of 300px was used", sum > 295); + assertTrue("Only " + sum + " out of 300px was used", sum > 295); $(ButtonElement.class).caption("Recreate without data").first().click(); @@ -97,7 +101,7 @@ public class GridColumnWidthsWithoutDataTest extends SingleBrowserTest { sum = sumUsedWidths(grid); // 295 instead of 300 to avoid rounding issues - Assert.assertTrue("Only " + sum + " out of 300px was used", sum > 295); + assertTrue("Only " + sum + " out of 300px was used", sum > 295); } private int sumUsedWidths(GridElement grid) { @@ -109,12 +113,12 @@ public class GridColumnWidthsWithoutDataTest extends SingleBrowserTest { } private static void assertSameWidths(int[] expected, int[] actual) { - Assert.assertEquals("Arrays have differing lengths", expected.length, + assertEquals("Arrays have differing lengths", expected.length, actual.length); for (int i = 0; i < expected.length; i++) { if (Math.abs(expected[i] - actual[i]) > 1) { - Assert.fail("Differing sizes at index " + i + ". Expected " + fail("Differing sizes at index " + i + ". Expected " + expected[i] + " but got " + actual[i]); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java index cd680d3804..88b218e6bf 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java @@ -1,9 +1,12 @@ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.stream.IntStream; import java.util.stream.Stream; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -35,9 +38,9 @@ public class GridComponentsTest extends MultiBrowserTest { WebElement textField = grid.getCell(0, 1) .findElement(By.tagName("input")); - Assert.assertEquals("TextField value was reset", "Foo", + assertEquals("TextField value was reset", "Foo", textField.getAttribute("value")); - Assert.assertTrue("No mention in the log", + assertTrue("No mention in the log", logContainsText("1. Reusing old text field for: Row 0")); } @@ -51,9 +54,9 @@ public class GridComponentsTest extends MultiBrowserTest { WebElement textField = grid.getCell(1, 1) .findElement(By.tagName("input")); - Assert.assertEquals("TextField value was reset", "Foo", + assertEquals("TextField value was reset", "Foo", textField.getAttribute("value")); - Assert.assertTrue("No mention in the log", + assertTrue("No mention in the log", logContainsText("1. Reusing old text field for: Row 1")); } @@ -76,7 +79,7 @@ public class GridComponentsTest extends MultiBrowserTest { int padding = 18 * 2 + 1; int extraSpace = Math.abs(fieldWidth - cellWidth); - Assert.assertTrue("Too much unused space in cell. Expected: " + padding + assertTrue("Too much unused space in cell. Expected: " + padding + " Actual: " + extraSpace, extraSpace <= padding); } @@ -97,7 +100,7 @@ public class GridComponentsTest extends MultiBrowserTest { public void testRow0() { openTestURL(); assertRowExists(0, "Row 0"); - Assert.assertEquals("Grid row height is not what it should be", 40, + assertEquals("Grid row height is not what it should be", 40, $(GridElement.class).first().getRow(0).getSize().getHeight()); } @@ -126,31 +129,30 @@ public class GridComponentsTest extends MultiBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); GridCellElement headerCell = grid.getHeaderCell(0, 0); - Assert.assertTrue("First header should contain a Label", + assertTrue("First header should contain a Label", headerCell.isElementPresent(LabelElement.class)); - Assert.assertEquals("Label", + assertEquals("Label", headerCell.$(LabelElement.class).first().getText()); - Assert.assertFalse("Second header should not contain a component", + assertFalse("Second header should not contain a component", grid.getHeaderCell(0, 1).isElementPresent(LabelElement.class)); - Assert.assertEquals("Other Components", - grid.getHeaderCell(0, 1).getText()); + assertEquals("Other Components", grid.getHeaderCell(0, 1).getText()); } private void assertRowExists(int i, String string) { GridRowElement row = $(GridElement.class).first().getRow(i); - Assert.assertEquals("Label text did not match", string, + assertEquals("Label text did not match", string, row.getCell(0).getText()); row.findElement(By.id(string.replace(' ', '_').toLowerCase())).click(); // IE 11 is slow, need to wait for the notification. waitUntil(driver -> isElementPresent(NotificationElement.class), 10); - Assert.assertTrue("Notification should contain given text", + assertTrue("Notification should contain given text", $(NotificationElement.class).first().getText() .contains(string)); } private void assertNoButton(int i) { GridRowElement row = $(GridElement.class).first().getRow(i); - Assert.assertFalse("Row " + i + " should not have a button", + assertFalse("Row " + i + " should not have a button", row.getCell(2).isElementPresent(ButtonElement.class)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsDetachTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsDetachTest.java index 2967d210ab..17f0f00a9a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsDetachTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsDetachTest.java @@ -15,15 +15,16 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -64,11 +65,11 @@ public class GridDetailsDetachTest extends MultiBrowserTest { assertNoErrorNotifications(); List<WebElement> spacers = findElements(By.className("v-grid-spacer")); - Assert.assertEquals("Not enough spacers in DOM", 2, spacers.size()); - Assert.assertEquals("Spacer content not visible", - "Extra data for Bean 1", spacers.get(0).getText()); - Assert.assertEquals("Spacer content not visible", - "Extra data for Bean 3", spacers.get(1).getText()); + assertEquals("Not enough spacers in DOM", 2, spacers.size()); + assertEquals("Spacer content not visible", "Extra data for Bean 1", + spacers.get(0).getText()); + assertEquals("Spacer content not visible", "Extra data for Bean 3", + spacers.get(1).getText()); } @Test @@ -87,11 +88,11 @@ public class GridDetailsDetachTest extends MultiBrowserTest { assertNoErrorNotifications(); List<WebElement> spacers = findElements(By.className("v-grid-spacer")); - Assert.assertEquals("Not enough spacers in DOM", 2, spacers.size()); - Assert.assertEquals("Spacer content not visible", - "Extra data for Bean 1", spacers.get(0).getText()); - Assert.assertEquals("Spacer content not visible", - "Extra data for Bean 3", spacers.get(1).getText()); + assertEquals("Not enough spacers in DOM", 2, spacers.size()); + assertEquals("Spacer content not visible", "Extra data for Bean 1", + spacers.get(0).getText()); + assertEquals("Spacer content not visible", "Extra data for Bean 3", + spacers.get(1).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsLocationTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsLocationTest.java index 530d7ddda5..81b75385f6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsLocationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsLocationTest.java @@ -1,10 +1,12 @@ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -140,7 +142,7 @@ public class GridDetailsLocationTest extends MultiBrowserTest { int visibleIndexOfSpacer) { waitForDetailsVisible(); WebElement details = getDetailsElement(visibleIndexOfSpacer); - Assert.assertEquals("Wrong details row height", expectedHeight, + assertEquals("Wrong details row height", expectedHeight, details.getSize().getHeight()); } @@ -151,11 +153,10 @@ public class GridDetailsLocationTest extends MultiBrowserTest { visibleIndexOfDeco); GridElement.GridRowElement rowElement = getGrid().getRow(row); - Assert.assertEquals( - "Details deco top position does not match row top pos", + assertEquals("Details deco top position does not match row top pos", rowElement.getLocation().getY(), detailsDecoElement.getLocation().getY()); - Assert.assertEquals( + assertEquals( "Details deco bottom position does not match details bottom pos", detailsElement.getLocation().getY() + detailsElement.getSize().getHeight(), @@ -164,7 +165,7 @@ public class GridDetailsLocationTest extends MultiBrowserTest { } private void verifyLocation(Param param) { - Assert.assertFalse("Notification was present", + assertFalse("Notification was present", isElementPresent(By.className("v-Notification"))); TestBenchElement headerRow = getGrid().getHeaderRow(0); @@ -189,11 +190,13 @@ public class GridDetailsLocationTest extends MultiBrowserTest { + bottomBoundary + " decoratorBotton:" + detailsBottom, detailsBottom, bottomBoundary); - verifyDetailsRowHeight(param.getRowIndex(), param.useGenerator() - ? detailsDefinedHeight : detailsDefaultHeight, 0); + verifyDetailsRowHeight(param.getRowIndex(), + param.useGenerator() ? detailsDefinedHeight + : detailsDefaultHeight, + 0); verifyDetailsDecoratorLocation(param.getRowIndex(), 0, 0); - Assert.assertFalse("Notification was present", + assertFalse("Notification was present", isElementPresent(By.className("v-Notification"))); } @@ -220,7 +223,8 @@ public class GridDetailsLocationTest extends MultiBrowserTest { WebElement detailsElement = getDetailsElement(); return detailsElement.isDisplayed() && detailsElement.getSize().getHeight() > 3 - ? detailsElement : null; + ? detailsElement + : null; } catch (StaleElementReferenceException e) { return null; } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsReattachTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsReattachTest.java index 5f0ebc6178..9ddee5b68f 100755 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsReattachTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsReattachTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -20,9 +21,10 @@ public class GridDetailsReattachTest extends MultiBrowserTest { @Test public void clickToAddCaption() { openTestURL(); - Assert.assertTrue("Grid details don't exist", hasDetailsElement()); + assertTrue("Grid details don't exist", hasDetailsElement()); $(ButtonElement.class).first().click(); - Assert.assertTrue("Grid details don't exist after deattach and reattach",hasDetailsElement() ); + assertTrue("Grid details don't exist after deattach and reattach", + hasDetailsElement()); } private final By locator = By.className("v-grid-spacer"); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsWidthTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsWidthTest.java index b82ad3b363..d6b3174beb 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsWidthTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsWidthTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -58,10 +60,10 @@ public class GridDetailsWidthTest extends SingleBrowserTest { private void checkSpacersHaveNoWidths(int expectedCount) { List<WebElement> spacers = findElements(By.className("v-grid-spacer")); - Assert.assertEquals("Wrong amount of spacers visible.", expectedCount, + assertEquals("Wrong amount of spacers visible.", expectedCount, spacers.size()); for (WebElement spacer : spacers) { - Assert.assertFalse("Spacer element had an unexpected width set.", + assertFalse("Spacer element had an unexpected width set.", spacer.findElement(By.tagName("td")).getAttribute("style") .contains("width")); } @@ -81,9 +83,9 @@ public class GridDetailsWidthTest extends SingleBrowserTest { cell = grid.getCell(2, 0); WebElement spacer = findElement(By.className("v-grid-spacer")); - Assert.assertEquals("Grid was not sorted correctly", "Hello 0", + assertEquals("Grid was not sorted correctly", "Hello 0", cell.getText()); - Assert.assertEquals("Details row was not in correct location", + assertEquals("Details row was not in correct location", cell.getLocation().getY() + cell.getSize().getHeight(), spacer.getLocation().getY(), 2); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridDisallowUserSelectionTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridDisallowUserSelectionTest.java index c8e6e39f2b..b2e1650bb4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridDisallowUserSelectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridDisallowUserSelectionTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -46,6 +47,6 @@ public class GridDisallowUserSelectionTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); grid.getCell(index, 0).click(); - Assert.assertFalse(grid.getRow(0).isSelected()); + assertFalse(grid.getRow(0).isSelected()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorCustomFieldTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorCustomFieldTest.java index a53a822a97..1bf8f943f6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorCustomFieldTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorCustomFieldTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.Keys; @@ -33,7 +34,7 @@ public class GridEditorCustomFieldTest extends MultiBrowserTest { public void testCustomFieldWorksInEditorRow() { openTestURL(); GridElement grid = $(GridElement.class).first(); - Assert.assertEquals("Stockholm", grid.getCell(0, 2).getText()); + assertEquals("Stockholm", grid.getCell(0, 2).getText()); grid.getCell(0, 1).doubleClick(); GridEditorElement editor = grid.getEditor(); TestBenchElement customField = editor.getField(2); @@ -41,7 +42,7 @@ public class GridEditorCustomFieldTest extends MultiBrowserTest { ComboBoxElement comboBox = customField.$(ComboBoxElement.class).first(); comboBox.selectByText("Oslo"); editor.save(); - Assert.assertEquals("Oslo", grid.getCell(0, 2).getText()); + assertEquals("Oslo", grid.getCell(0, 2).getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorEventsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorEventsTest.java index 753bd656d6..989b0a52d5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorEventsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorEventsTest.java @@ -41,17 +41,17 @@ public class GridEditorEventsTest extends MultiBrowserTest { GridEditorElement editor = updateField(index, grid, "foo"); editor.save(); - Assert.assertEquals((index * 4 + 1) + ". editor is opened", + assertEquals((index * 4 + 1) + ". editor is opened", getLogRow(1)); - Assert.assertEquals((index * 4 + 2) + ". editor is saved", + assertEquals((index * 4 + 2) + ". editor is saved", getLogRow(0)); editor = updateField(index, grid, "bar"); editor.cancel(); - Assert.assertEquals((index * 4 + 3) + ". editor is opened", + assertEquals((index * 4 + 3) + ". editor is opened", getLogRow(1)); - Assert.assertEquals((index * 4 + 4) + ". editor is canceled", + assertEquals((index * 4 + 4) + ". editor is canceled", getLogRow(0)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java index 95581505ee..3d68fc5800 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java @@ -1,8 +1,10 @@ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -41,7 +43,7 @@ public class GridEditorMultiselectTest extends MultiBrowserTest { private GridElement openEditor() { GridElement grid = $(GridElement.class).first(); grid.getRow(0).doubleClick(); - Assert.assertTrue("Grid editor should be displayed.", + assertTrue("Grid editor should be displayed.", grid.getEditor().isDisplayed()); return grid; } @@ -50,7 +52,7 @@ public class GridEditorMultiselectTest extends MultiBrowserTest { List<WebElement> checkboxes = grid .findElements(By.xpath("//input[@type='checkbox']")); for (WebElement checkbox : checkboxes) { - Assert.assertEquals( + assertEquals( "Select checkboxes should be " + (isEnabled ? "enabled" : "disabled"), isEnabled, checkbox.isEnabled()); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFooterComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFooterComponentsTest.java index f6f1ff05d5..db0ad112a6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFooterComponentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFooterComponentsTest.java @@ -15,9 +15,13 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + import java.util.List; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -42,19 +46,19 @@ public class GridHeaderFooterComponentsTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); int filterRow = 2; - Assert.assertNull(getHeaderElement(grid, filterRow, 1)); - Assert.assertNotNull(getHeaderElement(grid, filterRow, 2)); - Assert.assertNotNull(getHeaderElement(grid, filterRow, 3)); + assertNull(getHeaderElement(grid, filterRow, 1)); + assertNotNull(getHeaderElement(grid, filterRow, 2)); + assertNotNull(getHeaderElement(grid, filterRow, 3)); // Show (1,2) grid.getHeaderCell(1, 1).$(ButtonElement.class).first().click(); TextFieldElement textfield = getHeaderElement(grid, filterRow, 1); - Assert.assertNotNull(textfield); - Assert.assertEquals("Filter: string", textfield.getValue()); + assertNotNull(textfield); + assertEquals("Filter: string", textfield.getValue()); textfield.setValue("foo"); - Assert.assertEquals("1. value change for field in string to foo", + assertEquals("1. value change for field in string to foo", getLogRow(0)); assertNoErrorNotifications(); @@ -80,19 +84,19 @@ public class GridHeaderFooterComponentsTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); int filterRow = 0; - Assert.assertNull(getFooterElement(grid, filterRow, 1)); - Assert.assertNotNull(getFooterElement(grid, filterRow, 2)); - Assert.assertNotNull(getFooterElement(grid, filterRow, 3)); + assertNull(getFooterElement(grid, filterRow, 1)); + assertNotNull(getFooterElement(grid, filterRow, 2)); + assertNotNull(getFooterElement(grid, filterRow, 3)); // Show (1,2) grid.getFooterCell(1, 1).$(ButtonElement.class).first().click(); TextFieldElement textfield = getFooterElement(grid, filterRow, 1); - Assert.assertNotNull(textfield); - Assert.assertEquals("Filter: string", textfield.getValue()); + assertNotNull(textfield); + assertEquals("Filter: string", textfield.getValue()); textfield.setValue("foo"); - Assert.assertEquals("1. value change for field in string to foo", + assertEquals("1. value change for field in string to foo", getLogRow(0)); assertNoErrorNotifications(); @@ -121,14 +125,14 @@ public class GridHeaderFooterComponentsTest extends SingleBrowserTest { // Remove Header $(GridElement.class).first().getHeaderCell(i, 0) .$(ButtonElement.class).first().click(); - Assert.assertFalse("Header " + i + " should not be present.", + assertFalse("Header " + i + " should not be present.", $(GridElement.class).first() .isElementPresent(By.vaadin("#header[" + i + "]"))); // Remove Footer $(GridElement.class).first().getFooterCell(i, 0) .$(ButtonElement.class).first().click(); - Assert.assertFalse("Footer " + i + " should not be present.", + assertFalse("Footer " + i + " should not be present.", $(GridElement.class).first() .isElementPresent(By.vaadin("#footer[" + i + "]"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java index ef69679d98..2771617aee 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; @@ -33,30 +35,28 @@ public class GridHeaderFormatChangeTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); // Assert that we do not have the select all checkbox - Assert.assertTrue( - "Found input in header even though none should exist.", + assertTrue("Found input in header even though none should exist.", grid.getHeader().findElements(By.tagName("input")).isEmpty()); // Set grid into multiselection mode toggleSelectionMode(); // Assert that we now have a select all checkbox in the header - Assert.assertFalse("Expected one input field in header", + assertFalse("Expected one input field in header", grid.getHeader().findElements(By.tagName("input")).isEmpty()); // Hide the firstName column from the grid. toggleFirstName(); // Assert that we still have the select all checkbox in the header. - Assert.assertFalse("Header was missing checkbox after hiding column", + assertFalse("Header was missing checkbox after hiding column", grid.getHeader().findElements(By.tagName("input")).isEmpty()); // Show the firstName column. toggleFirstName(); // Assert that we still have the select all checkbox in the header. - Assert.assertFalse( - "Header was missing checkbox after bringing back column", + assertFalse("Header was missing checkbox after bringing back column", grid.getHeader().findElements(By.tagName("input")).isEmpty()); } @@ -66,30 +66,28 @@ public class GridHeaderFormatChangeTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); // Assert that we do not have the select all checkbox - Assert.assertTrue( - "Found input in header even though none should exist.", + assertTrue("Found input in header even though none should exist.", grid.getHeader().findElements(By.tagName("input")).isEmpty()); // Set grid into multiselection mode toggleSelectionMode(); // Assert that we now have a select all checkbox in the header - Assert.assertFalse("Expected one input field in header", + assertFalse("Expected one input field in header", grid.getHeader().findElements(By.tagName("input")).isEmpty()); // Add Join columns header toggleJoin(); // Assert that we still have the select all checkbox in the header. - Assert.assertFalse("Header was missing checkbox after hiding column", + assertFalse("Header was missing checkbox after hiding column", grid.getHeader().findElements(By.tagName("input")).isEmpty()); // remove Join Columns header toggleJoin(); // Assert that we still have the select all checkbox in the header. - Assert.assertFalse( - "Header was missing checkbox after bringing back column", + assertFalse("Header was missing checkbox after bringing back column", grid.getHeader().findElements(By.tagName("input")).isEmpty()); } @@ -99,15 +97,14 @@ public class GridHeaderFormatChangeTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); // Assert that we do not have the select all checkbox - Assert.assertTrue( - "Found input in header even though none should exist.", + assertTrue("Found input in header even though none should exist.", grid.getHeader().findElements(By.tagName("input")).isEmpty()); // Set grid into multiselection mode toggleSelectionMode(); // Assert that we now have a select all checkbox in the header - Assert.assertFalse("Should not be selected after adding", + assertFalse("Should not be selected after adding", grid.getHeader().findElement(By.tagName("input")).isSelected()); grid.getHeader().findElement(By.tagName("input")).click(); @@ -133,7 +130,7 @@ public class GridHeaderFormatChangeTest extends MultiBrowserTest { } private void assertSelectAllChecked(String message, GridElement grid) { - Assert.assertTrue(message, + assertTrue(message, grid.getHeader().findElement(By.tagName("input")).isSelected()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderStyleNamesTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderStyleNamesTest.java index 0297b30876..bee5780aa5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderStyleNamesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderStyleNamesTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.fail; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -144,14 +145,14 @@ public class GridHeaderStyleNamesTest extends SingleBrowserTest { private void assertHasStyleName(String message, WebElement element, String stylename) { if (!hasCssClass(element, stylename)) { - Assert.fail(message); + fail(message); } } private void assertHasNotStyleName(String message, WebElement element, String stylename) { if (hasCssClass(element, stylename)) { - Assert.fail(message); + fail(message); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeightTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeightTest.java index 6571d92f11..09df98583e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeightTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeightTest.java @@ -18,12 +18,12 @@ package com.vaadin.tests.components.grid; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.hamcrest.number.IsCloseTo.closeTo; +import static org.junit.Assert.fail; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import org.openqa.selenium.By; @@ -95,7 +95,7 @@ public class GridHeightTest extends MultiBrowserTest { } catch (AssertionError e) { errors.put(e, new Object[] { gridHeight, gridWidth, detailsRowHeight, "initial" }); - Assert.fail(); + fail(); } grid.getRow(2).click(5, 5); @@ -139,7 +139,7 @@ public class GridHeightTest extends MultiBrowserTest { } sb.append(entry.getKey().getMessage()); } - Assert.fail(sb.toString()); + fail(sb.toString()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridInWindowResizeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridInWindowResizeTest.java index f371d949e3..079149ecb8 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridInWindowResizeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridInWindowResizeTest.java @@ -15,10 +15,11 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertTrue; + import java.util.Collections; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.remote.DesiredCapabilities; @@ -43,6 +44,6 @@ public class GridInWindowResizeTest extends MultiBrowserTest { $(ButtonElement.class).caption("resize").first().click(); int col1WidthAfter = grid.getCell(0, 0).getSize().getWidth(); - Assert.assertTrue(col1WidthAfter < col1WidthBefore); + assertTrue(col1WidthAfter < col1WidthBefore); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridInitiallyHiddenColumnsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridInitiallyHiddenColumnsTest.java index 1a909e7a32..5464e70c8f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridInitiallyHiddenColumnsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridInitiallyHiddenColumnsTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -33,20 +34,20 @@ public class GridInitiallyHiddenColumnsTest extends SingleBrowserTest { public void ensureCorrectlyRendered() { openTestURL("debug"); GridElement grid = $(GridElement.class).first(); - Assert.assertEquals("Rowling", grid.getCell(0, 0).getText()); - Assert.assertEquals("Barks", grid.getCell(1, 0).getText()); + assertEquals("Rowling", grid.getCell(0, 0).getText()); + assertEquals("Barks", grid.getCell(1, 0).getText()); getSidebarOpenButton(grid).click(); getColumnHidingToggle(grid, "First Name").click(); getColumnHidingToggle(grid, "Age").click(); getSidebarOpenButton(grid).click(); - Assert.assertEquals("Umberto", grid.getCell(0, 0).getText()); - Assert.assertEquals("Rowling", grid.getCell(0, 1).getText()); - Assert.assertEquals("40", grid.getCell(0, 2).getText()); - Assert.assertEquals("Alex", grid.getCell(1, 0).getText()); - Assert.assertEquals("Barks", grid.getCell(1, 1).getText()); - Assert.assertEquals("25", grid.getCell(1, 2).getText()); + assertEquals("Umberto", grid.getCell(0, 0).getText()); + assertEquals("Rowling", grid.getCell(0, 1).getText()); + assertEquals("40", grid.getCell(0, 2).getText()); + assertEquals("Alex", grid.getCell(1, 0).getText()); + assertEquals("Barks", grid.getCell(1, 1).getText()); + assertEquals("25", grid.getCell(1, 2).getText()); } @@ -61,12 +62,12 @@ public class GridInitiallyHiddenColumnsTest extends SingleBrowserTest { getColumnHidingToggle(grid, "Age").click(); getSidebarOpenButton(grid).click(); - Assert.assertEquals("Umberto", grid.getCell(0, 0).getText()); - Assert.assertEquals("Rowling", grid.getCell(0, 1).getText()); - Assert.assertEquals("40", grid.getCell(0, 2).getText()); - Assert.assertEquals("Alex", grid.getCell(1, 0).getText()); - Assert.assertEquals("Barks", grid.getCell(1, 1).getText()); - Assert.assertEquals("25", grid.getCell(1, 2).getText()); + assertEquals("Umberto", grid.getCell(0, 0).getText()); + assertEquals("Rowling", grid.getCell(0, 1).getText()); + assertEquals("40", grid.getCell(0, 2).getText()); + assertEquals("Alex", grid.getCell(1, 0).getText()); + assertEquals("Barks", grid.getCell(1, 1).getText()); + assertEquals("25", grid.getCell(1, 2).getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridPopupViewTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridPopupViewTest.java index 658ed8e1d5..d01a6b47d7 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridPopupViewTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridPopupViewTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; @@ -47,8 +48,8 @@ public class GridPopupViewTest extends MultiBrowserTest { pv.click(); GridElement grid = $(GridElement.class).first(); Dimension rect = grid.getCell(0, 0).getSize(); - Assert.assertEquals(500, rect.width); - Assert.assertEquals(38, rect.height); + assertEquals(500, rect.width); + assertEquals(38, rect.height); findElement(By.className("v-ui")).click(); waitForElementNotPresent(By.className("v-grid")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridRefreshRowTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridRefreshRowTest.java index 3b1e2b9c88..7c9aab1738 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridRefreshRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridRefreshRowTest.java @@ -1,6 +1,9 @@ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -22,37 +25,37 @@ public class GridRefreshRowTest extends SingleBrowserTest { style(1); style(2); - Assert.assertEquals("Lisa", grid.getCell(0, 1).getText()); - Assert.assertEquals("Joshua", grid.getCell(1, 1).getText()); - Assert.assertEquals("Marge", grid.getCell(2, 1).getText()); + assertEquals("Lisa", grid.getCell(0, 1).getText()); + assertEquals("Joshua", grid.getCell(1, 1).getText()); + assertEquals("Marge", grid.getCell(2, 1).getText()); - Assert.assertFalse(hasCssClass(grid.getRow(0), "rowstyle")); - Assert.assertFalse(hasCssClass(grid.getRow(1), "rowstyle")); - Assert.assertFalse(hasCssClass(grid.getRow(2), "rowstyle")); - Assert.assertFalse(hasCssClass(grid.getCell(0, 0), "cellstyle")); - Assert.assertFalse(hasCssClass(grid.getCell(1, 0), "cellstyle")); - Assert.assertFalse(hasCssClass(grid.getCell(2, 0), "cellstyle")); + assertFalse(hasCssClass(grid.getRow(0), "rowstyle")); + assertFalse(hasCssClass(grid.getRow(1), "rowstyle")); + assertFalse(hasCssClass(grid.getRow(2), "rowstyle")); + assertFalse(hasCssClass(grid.getCell(0, 0), "cellstyle")); + assertFalse(hasCssClass(grid.getCell(1, 0), "cellstyle")); + assertFalse(hasCssClass(grid.getCell(2, 0), "cellstyle")); refresh(1); - Assert.assertEquals("Lisa", grid.getCell(0, 1).getText()); - Assert.assertEquals("!Joshua", grid.getCell(1, 1).getText()); - Assert.assertEquals("Marge", grid.getCell(2, 1).getText()); + assertEquals("Lisa", grid.getCell(0, 1).getText()); + assertEquals("!Joshua", grid.getCell(1, 1).getText()); + assertEquals("Marge", grid.getCell(2, 1).getText()); - Assert.assertFalse(hasCssClass(grid.getRow(0), "rowstyle")); - Assert.assertTrue(hasCssClass(grid.getRow(1), "rowstyle")); - Assert.assertFalse(hasCssClass(grid.getRow(2), "rowstyle")); - Assert.assertFalse(hasCssClass(grid.getCell(0, 0), "cellstyle")); - Assert.assertTrue(hasCssClass(grid.getCell(1, 0), "cellstyle")); - Assert.assertFalse(hasCssClass(grid.getCell(2, 0), "cellstyle")); + assertFalse(hasCssClass(grid.getRow(0), "rowstyle")); + assertTrue(hasCssClass(grid.getRow(1), "rowstyle")); + assertFalse(hasCssClass(grid.getRow(2), "rowstyle")); + assertFalse(hasCssClass(grid.getCell(0, 0), "cellstyle")); + assertTrue(hasCssClass(grid.getCell(1, 0), "cellstyle")); + assertFalse(hasCssClass(grid.getCell(2, 0), "cellstyle")); // Assert refreshing works many times and for many rows at the same time update(0); update(1); update(2); refresh10First(); - Assert.assertEquals("!!Lisa", grid.getCell(0, 1).getText()); - Assert.assertEquals("!!Joshua", grid.getCell(1, 1).getText()); - Assert.assertEquals("!!Marge", grid.getCell(2, 1).getText()); + assertEquals("!!Lisa", grid.getCell(0, 1).getText()); + assertEquals("!!Joshua", grid.getCell(1, 1).getText()); + assertEquals("!!Marge", grid.getCell(2, 1).getText()); } private void refresh10First() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridRendererSwitchTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridRendererSwitchTest.java index a2ac8e1043..ce81eb796a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridRendererSwitchTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridRendererSwitchTest.java @@ -1,6 +1,9 @@ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.By; @@ -17,17 +20,17 @@ public class GridRendererSwitchTest extends SingleBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); - Assert.assertEquals("Unexpected content in first grid cell", "Foo 0", + assertEquals("Unexpected content in first grid cell", "Foo 0", grid.getCell(0, 0).getAttribute("innerHTML")); ButtonElement button = $(ButtonElement.class).first(); button.click(); - Assert.assertFalse("No button in cell", grid.getCell(0, 0) + assertFalse("No button in cell", grid.getCell(0, 0) .findElements(By.tagName("button")).isEmpty()); grid.getCell(0, 0).findElement(By.tagName("button")).click(); - Assert.assertTrue("Notification not shown", + assertTrue("Notification not shown", isElementPresent(NotificationElement.class)); button.click(); - Assert.assertEquals("Cell should be back to text content.", "Foo 0", + assertEquals("Cell should be back to text content.", "Foo 0", grid.getCell(0, 0).getAttribute("innerHTML")); assertNoErrorNotifications(); @@ -39,26 +42,24 @@ public class GridRendererSwitchTest extends SingleBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); - Assert.assertEquals("Unexpected content in first grid cell", "Foo 0", + assertEquals("Unexpected content in first grid cell", "Foo 0", grid.getCell(0, 0).getAttribute("innerHTML")); ButtonElement button = $(ButtonElement.class).caption("Switch").first(); button.click(); ButtonElement reverse = $(ButtonElement.class).caption("Reverse") .first(); reverse.click(); - Assert.assertEquals( - "Unexpected content in first grid cell after reorder", "Bar 0", - grid.getCell(0, 0).getAttribute("innerHTML")); + assertEquals("Unexpected content in first grid cell after reorder", + "Bar 0", grid.getCell(0, 0).getAttribute("innerHTML")); - Assert.assertFalse("No button in cell after reversing order", grid + assertFalse("No button in cell after reversing order", grid .getCell(0, 1).findElements(By.tagName("button")).isEmpty()); grid.getCell(0, 1).findElement(By.tagName("button")).click(); - Assert.assertTrue("Notification not shown", + assertTrue("Notification not shown", isElementPresent(NotificationElement.class)); reverse.click(); - Assert.assertFalse("No button in cell after restoring original order", - grid.getCell(0, 0).findElements(By.tagName("button")) - .isEmpty()); + assertFalse("No button in cell after restoring original order", grid + .getCell(0, 0).findElements(By.tagName("button")).isEmpty()); assertNoErrorNotifications(); } @@ -69,29 +70,28 @@ public class GridRendererSwitchTest extends SingleBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); - Assert.assertEquals("Unexpected content in first grid cell", "Foo 0", + assertEquals("Unexpected content in first grid cell", "Foo 0", grid.getCell(0, 0).getAttribute("innerHTML")); ButtonElement reverse = $(ButtonElement.class).caption("Reverse") .first(); reverse.click(); - Assert.assertEquals( - "Unexpected content in first grid cell after reorder", "Bar 0", - grid.getCell(0, 0).getAttribute("innerHTML")); + assertEquals("Unexpected content in first grid cell after reorder", + "Bar 0", grid.getCell(0, 0).getAttribute("innerHTML")); ButtonElement button = $(ButtonElement.class).caption("Switch").first(); button.click(); - Assert.assertFalse( + assertFalse( "No button in cell after reversing order and changing renderer", grid.getCell(0, 1).findElements(By.tagName("button")) .isEmpty()); grid.getCell(0, 1).findElement(By.tagName("button")).click(); - Assert.assertTrue("Notification not shown", + assertTrue("Notification not shown", isElementPresent(NotificationElement.class)); button.click(); - Assert.assertEquals("Cell should be back to text content.", "Foo 0", + assertEquals("Cell should be back to text content.", "Foo 0", grid.getCell(0, 1).getAttribute("innerHTML")); assertNoErrorNotifications(); @@ -103,15 +103,14 @@ public class GridRendererSwitchTest extends SingleBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); - Assert.assertEquals("Unexpected content in first grid cell", "Foo 0", + assertEquals("Unexpected content in first grid cell", "Foo 0", grid.getCell(0, 0).getAttribute("innerHTML")); ButtonElement reverse = $(ButtonElement.class).caption("Reverse") .first(); reverse.click(); - Assert.assertEquals( - "Unexpected content in first grid cell after reorder", "Bar 0", - grid.getCell(0, 0).getAttribute("innerHTML")); + assertEquals("Unexpected content in first grid cell after reorder", + "Bar 0", grid.getCell(0, 0).getAttribute("innerHTML")); grid.toggleColumnHidden("Bar"); @@ -120,12 +119,12 @@ public class GridRendererSwitchTest extends SingleBrowserTest { assertNoErrorNotifications(); - Assert.assertFalse( + assertFalse( "No button in cell after reversing order and changing renderer", grid.getCell(0, 0).findElements(By.tagName("button")) .isEmpty()); grid.getCell(0, 0).findElement(By.tagName("button")).click(); - Assert.assertTrue("Notification not shown", + assertTrue("Notification not shown", isElementPresent(NotificationElement.class)); } @@ -135,12 +134,12 @@ public class GridRendererSwitchTest extends SingleBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); - Assert.assertEquals("Unexpected content in first grid cell", "Foo 0", + assertEquals("Unexpected content in first grid cell", "Foo 0", grid.getCell(0, 0).getAttribute("innerHTML")); grid.toggleColumnHidden("Foo"); - Assert.assertEquals("Unexpected content in first grid cell after hide", + assertEquals("Unexpected content in first grid cell after hide", "Bar 0", grid.getCell(0, 0).getAttribute("innerHTML")); ButtonElement button = $(ButtonElement.class).caption("Switch").first(); @@ -148,7 +147,7 @@ public class GridRendererSwitchTest extends SingleBrowserTest { assertNoErrorNotifications(); - Assert.assertEquals( + assertEquals( "Unexpected content in first grid cell after hidden renderer change", "Bar 0", grid.getCell(0, 0).getAttribute("innerHTML")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridReplaceContainerTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridReplaceContainerTest.java index 6e1536c6a2..9aa932a70c 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridReplaceContainerTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridReplaceContainerTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -29,11 +31,11 @@ public class GridReplaceContainerTest extends SingleBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); grid.getCell(0, 0).click(); - Assert.assertTrue(grid.getRow(0).isSelected()); + assertTrue(grid.getRow(0).isSelected()); $(ButtonElement.class).first().click(); - Assert.assertFalse(grid.getRow(0).isSelected()); + assertFalse(grid.getRow(0).isSelected()); grid.getCell(0, 0).click(); - Assert.assertTrue(grid.getRow(0).isSelected()); + assertTrue(grid.getRow(0).isSelected()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeAndScrollTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeAndScrollTest.java index f226710313..d8ee725c36 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeAndScrollTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeAndScrollTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.GridElement; @@ -37,7 +38,7 @@ public class GridResizeAndScrollTest extends MultiBrowserTest { String textBefore = cell.getText(); cell.click(); - Assert.assertEquals("String contents changed on click", textBefore, + assertEquals("String contents changed on click", textBefore, cell.getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java index 3e28c846de..c5a5b8834e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java @@ -15,9 +15,12 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -44,9 +47,9 @@ public class GridResizeHiddenColumnTest extends MultiBrowserTest { // Check if column 'Last Name' hidden List<GridCellElement> headerCells = grid.getHeaderCells(0); - Assert.assertEquals("There should be two visible columns", 2, + assertEquals("There should be two visible columns", 2, headerCells.size()); - Assert.assertFalse("'Last Name' column should be hidden", + assertFalse("'Last Name' column should be hidden", containsText("Last Name", headerCells)); // Resize first column @@ -58,8 +61,7 @@ public class GridResizeHiddenColumnTest extends MultiBrowserTest { // (might be an issue with the feature that doesn't start resizing until // the cursor moved a few pixels) double delta = BrowserUtil.isIE8(getDesiredCapabilities()) ? 5d : 0; - Assert.assertEquals( - "Column width should've changed by " + dragOffset + "px", + assertEquals("Column width should've changed by " + dragOffset + "px", headerCellWidth + dragOffset, headerCells.get(0).getSize().getWidth(), delta); @@ -77,9 +79,9 @@ public class GridResizeHiddenColumnTest extends MultiBrowserTest { // Check if column "Last Name" is visible headerCells = grid.getHeaderCells(0); - Assert.assertEquals("There should be three visible columns", 3, + assertEquals("There should be three visible columns", 3, headerCells.size()); - Assert.assertTrue("'Last Name' column should be visible", + assertTrue("'Last Name' column should be visible", containsText("Last Name", headerCells)); // Check if column "Last Name" has expanded width @@ -87,8 +89,7 @@ public class GridResizeHiddenColumnTest extends MultiBrowserTest { for (GridCellElement e : headerCells) { widthSum += e.getSize().getWidth(); } - Assert.assertEquals( - "'Last Name' column should take up the remaining space", + assertEquals("'Last Name' column should take up the remaining space", grid.getHeader().getSize().getWidth(), widthSum, 1d); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridScrollToTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridScrollToTest.java index a3c3002e91..d2635034bb 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridScrollToTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridScrollToTest.java @@ -1,8 +1,12 @@ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.util.Optional; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -13,10 +17,6 @@ import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.SingleBrowserTest; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - @TestCategory("grid") public class GridScrollToTest extends SingleBrowserTest { @@ -79,22 +79,32 @@ public class GridScrollToTest extends SingleBrowserTest { waitForElementPresent(By.className("v-grid-spacer")); waitForElementPresent(By.className("v-label")); - assertTrue("Details not visible", getGrid().findElements(By.className("v-label")).stream() - .filter(element -> element.getText().contains("Name 199 details")).findFirst().get().isDisplayed()); + assertTrue("Details not visible", + getGrid().findElements(By.className("v-label")).stream() + .filter(element -> element.getText() + .contains("Name 199 details")) + .findFirst().get().isDisplayed()); // scroll away $(ButtonElement.class).id("top").click(); assertEquals("Found final element even though should be at top of list", 0, cellsContaining("199")); - assertFalse("Found final element details even though should be at top of list", getGrid().findElements(By.className("v-label")).stream() - .filter(element -> element.getText().contains("Name 199 details")).findFirst().isPresent()); + assertFalse( + "Found final element details even though should be at top of list", + getGrid().findElements(By.className("v-label")).stream() + .filter(element -> element.getText() + .contains("Name 199 details")) + .findFirst().isPresent()); // Scroll to end $(ButtonElement.class).id("end").click(); - assertTrue("Details not visible", getGrid().findElements(By.className("v-label")).stream() - .filter(element -> element.getText().contains("Name 199 details")).findFirst().get().isDisplayed()); + assertTrue("Details not visible", + getGrid().findElements(By.className("v-label")).stream() + .filter(element -> element.getText() + .contains("Name 199 details")) + .findFirst().get().isDisplayed()); } @Test @@ -110,22 +120,32 @@ public class GridScrollToTest extends SingleBrowserTest { waitForElementPresent(By.className("v-grid-spacer")); waitForElementPresent(By.className("v-label")); - assertTrue("Details not visible", getGrid().findElements(By.className("v-label")).stream() - .filter(element -> element.getText().contains("Name 50 details")).findFirst().get().isDisplayed()); + assertTrue("Details not visible", + getGrid().findElements(By.className("v-label")).stream() + .filter(element -> element.getText() + .contains("Name 50 details")) + .findFirst().get().isDisplayed()); // scroll away $(ButtonElement.class).id("top").click(); assertEquals("Found final element even though should be at top of list", 0, cellsContaining("50")); - assertFalse("Found final element details even though should be at top of list", getGrid().findElements(By.className("v-label")).stream() - .filter(element -> element.getText().contains("Name 50 details")).findFirst().isPresent()); + assertFalse( + "Found final element details even though should be at top of list", + getGrid().findElements(By.className("v-label")).stream() + .filter(element -> element.getText() + .contains("Name 50 details")) + .findFirst().isPresent()); // Scroll to end $(ButtonElement.class).id("row").click(); - assertTrue("Details not visible", getGrid().findElements(By.className("v-label")).stream() - .filter(element -> element.getText().contains("Name 50 details")).findFirst().get().isDisplayed()); + assertTrue("Details not visible", + getGrid().findElements(By.className("v-label")).stream() + .filter(element -> element.getText() + .contains("Name 50 details")) + .findFirst().get().isDisplayed()); } private GridElement getGrid() { @@ -145,6 +165,6 @@ public class GridScrollToTest extends SingleBrowserTest { if (first.isPresent()) first.get().click(); else - Assert.fail("Cell not present"); + fail("Cell not present"); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridSelectionTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridSelectionTest.java index 45f7d54ebf..93575e26ac 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridSelectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridSelectionTest.java @@ -455,10 +455,10 @@ public class GridSelectionTest extends GridBasicsTest { for (int i = 0; i < 10; i++) { boolean rowSelected = grid.getRow(i).isSelected(); if (expected.contains(i)) { - Assert.assertTrue("Expected row " + i + " to be selected", + assertTrue("Expected row " + i + " to be selected", rowSelected); } else { - Assert.assertFalse("Expected row " + i + " not to be selected", + assertFalse("Expected row " + i + " not to be selected", rowSelected); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridSidebarPositionTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridSidebarPositionTest.java index 4b3fe2057a..6227e4b7c5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridSidebarPositionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridSidebarPositionTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; @@ -38,8 +39,7 @@ public class GridSidebarPositionTest extends MultiBrowserTest { Dimension popupSize = getSidebarPopup().getSize(); Dimension browserWindowSize = getDriver().manage().window().getSize(); - Assert.assertTrue( - popupSize.getHeight() <= browserWindowSize.getHeight()); + assertTrue(popupSize.getHeight() <= browserWindowSize.getHeight()); } @Test @@ -54,7 +54,7 @@ public class GridSidebarPositionTest extends MultiBrowserTest { int popupBottom = popupLocation.getY() + popupSize.getHeight(); Dimension browserWindowSize = getDriver().manage().window().getSize(); - Assert.assertTrue(popupBottom <= browserWindowSize.getHeight()); + assertTrue(popupBottom <= browserWindowSize.getHeight()); } @Test @@ -69,7 +69,7 @@ public class GridSidebarPositionTest extends MultiBrowserTest { Point popupLocation = sidebarPopup.getLocation(); int popupBottom = popupLocation.getY() + popupSize.getHeight(); int sideBarButtonTop = sidebarOpenButton.getLocation().getY(); - Assert.assertTrue(popupBottom <= sideBarButtonTop); + assertTrue(popupBottom <= sideBarButtonTop); } protected WebElement getSidebarOpenButton(GridElement grid) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridSingleColumnTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridSingleColumnTest.java index 01355e8801..d1b80bc5a6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridSingleColumnTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridSingleColumnTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.GridElement; @@ -32,7 +34,7 @@ public class GridSingleColumnTest extends MultiBrowserTest { openTestURL(); GridCellElement cell = $(GridElement.class).first().getHeaderCell(0, 0); - Assert.assertTrue("No header available", + assertTrue("No header available", cell.getText().equalsIgnoreCase("header")); } @@ -41,7 +43,7 @@ public class GridSingleColumnTest extends MultiBrowserTest { setDebug(true); openTestURL(); - Assert.assertFalse("Exception when scrolling on init", + assertFalse("Exception when scrolling on init", isElementPresent(NotificationElement.class)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridSortIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridSortIndicatorTest.java index 2f623e1c51..aae5d367ac 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridSortIndicatorTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridSortIndicatorTest.java @@ -15,7 +15,10 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -32,30 +35,31 @@ public class GridSortIndicatorTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); $(ButtonElement.class).caption("Sort both").first().click(); - Assert.assertTrue("First column should be sorted ascending", + assertTrue("First column should be sorted ascending", grid.getHeaderCell(0, 0).getAttribute("class") .contains("sort-asc")); - Assert.assertEquals("First column should have aria-sort other", "other", + assertEquals("First column should have aria-sort other", "other", grid.getHeaderCell(0, 0).getAttribute("aria-sort")); - Assert.assertEquals("First column should be first in sort order", "1", + assertEquals("First column should be first in sort order", "1", grid.getHeaderCell(0, 0).getAttribute("sort-order")); - Assert.assertTrue("Second column should be sorted ascending", + assertTrue("Second column should be sorted ascending", grid.getHeaderCell(0, 1).getAttribute("class") .contains("sort-asc")); - Assert.assertEquals("Second column should have aria-sort other", "other", + assertEquals("Second column should have aria-sort other", "other", grid.getHeaderCell(0, 1).getAttribute("aria-sort")); - Assert.assertEquals("Second column should be also sorted", "2", + assertEquals("Second column should be also sorted", "2", grid.getHeaderCell(0, 1).getAttribute("sort-order")); $(ButtonElement.class).caption("Sort first").first().click(); - Assert.assertEquals("First column should have aria-sort ascending", "ascending", + assertEquals("First column should have aria-sort ascending", + "ascending", grid.getHeaderCell(0, 0).getAttribute("aria-sort")); - Assert.assertTrue("First column should be sorted ascending", + assertTrue("First column should be sorted ascending", grid.getHeaderCell(0, 0).getAttribute("class") .contains("sort-asc")); - Assert.assertEquals("Second column should have aria-sort none", "none", + assertEquals("Second column should have aria-sort none", "none", grid.getHeaderCell(0, 1).getAttribute("aria-sort")); - Assert.assertFalse("Second column should not be sorted", + assertFalse("Second column should not be sorted", grid.getHeaderCell(0, 1).getAttribute("class") .contains("sort-asc")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridUndefinedHeightTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridUndefinedHeightTest.java index 07ccf6a95b..120c1cc955 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridUndefinedHeightTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridUndefinedHeightTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -25,7 +26,7 @@ public class GridUndefinedHeightTest extends SingleBrowserTest { int gridHeight = grid.getSize().getHeight(); int rows = 4; // Header Row + 3 Body Rows - Assert.assertEquals("Grid height mismatch", oneRow * rows, gridHeight); + assertEquals("Grid height mismatch", oneRow * rows, gridHeight); assertNoErrorNotifications(); } @@ -37,7 +38,7 @@ public class GridUndefinedHeightTest extends SingleBrowserTest { int gridHeight = grid.getSize().getHeight(); int rows = 4; // Header Row + 3 Body Rows - Assert.assertEquals("Grid height mismatch", oneRow * rows, gridHeight); + assertEquals("Grid height mismatch", oneRow * rows, gridHeight); assertNoErrorNotifications(); } @@ -52,7 +53,7 @@ public class GridUndefinedHeightTest extends SingleBrowserTest { int gridHeight = grid.getSize().getHeight(); int rows = 5; // 2 Header Rows + 3 Body Rows - Assert.assertEquals("Grid height mismatch", oneRow * rows, gridHeight); + assertEquals("Grid height mismatch", oneRow * rows, gridHeight); assertNoErrorNotifications(); } @@ -67,7 +68,7 @@ public class GridUndefinedHeightTest extends SingleBrowserTest { int gridHeight = grid.getSize().getHeight(); int rows = 5; // 2 Header Rows + 3 Body Rows - Assert.assertEquals("Grid height mismatch", oneRow * rows, gridHeight); + assertEquals("Grid height mismatch", oneRow * rows, gridHeight); assertNoErrorNotifications(); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/HorizontalScrollAfterResizeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/HorizontalScrollAfterResizeTest.java index fa612b1a28..0ec0768e38 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/HorizontalScrollAfterResizeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/HorizontalScrollAfterResizeTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.Dimension; import org.openqa.selenium.Point; @@ -57,10 +59,10 @@ public class HorizontalScrollAfterResizeTest extends GridBasicFeaturesTest { // With the bug scrolling doesn't happen. Location should be around of // the initial scrolling - Assert.assertEquals(locationAfterFirstScroll.getY(), + assertEquals(locationAfterFirstScroll.getY(), locationAfterSecondScrollcation.getY()); int delta = 5; - Assert.assertTrue(Math.abs(locationAfterFirstScroll.getX() + assertTrue(Math.abs(locationAfterFirstScroll.getX() - locationAfterSecondScrollcation.getX()) < delta); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/InitialFrozenColumnsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/InitialFrozenColumnsTest.java index 58abe75731..c20e7900d2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/InitialFrozenColumnsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/InitialFrozenColumnsTest.java @@ -15,11 +15,11 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.logging.Level; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -35,7 +35,7 @@ public class InitialFrozenColumnsTest extends MultiBrowserTest { setDebug(true); openTestURL(); - Assert.assertFalse("Notification was present", + assertFalse("Notification was present", isElementPresent(NotificationElement.class)); WebElement cell = $(GridElement.class).first().getCell(0, 0); @@ -47,7 +47,7 @@ public class InitialFrozenColumnsTest extends MultiBrowserTest { setDebug(true); openTestURL("frozen=3"); - Assert.assertFalse("Notification was present", + assertFalse("Notification was present", isElementPresent(NotificationElement.class)); assertNoDebugMessage(Level.SEVERE); WebElement cell = $(GridElement.class).first().getCell(0, 2); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/InitiallyDisabledGridTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/InitiallyDisabledGridTest.java index b1f3cba508..d24ad87472 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/InitiallyDisabledGridTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/InitiallyDisabledGridTest.java @@ -1,14 +1,16 @@ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.GridElement.GridCellElement; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -21,8 +23,8 @@ public class InitiallyDisabledGridTest extends SingleBrowserTest { List<WebElement> cells = findElements(By.className("v-grid-cell")); WebElement col0 = cells.get(0); WebElement col1 = cells.get(1); - Assert.assertTrue(col0.getSize().getWidth() > 250); - Assert.assertTrue(col1.getSize().getWidth() > 250); + assertTrue(col0.getSize().getWidth() > 250); + assertTrue(col1.getSize().getWidth() > 250); } @Test @@ -33,6 +35,6 @@ public class InitiallyDisabledGridTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); grid.scrollToRow(80); GridCellElement col0 = grid.getCell(80, 0); - Assert.assertEquals("First 80", col0.getText()); + assertEquals("First 80", col0.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/JavaScriptRenderersTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/JavaScriptRenderersTest.java index 6707e6097d..951889c304 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/JavaScriptRenderersTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/JavaScriptRenderersTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -40,17 +42,16 @@ public class JavaScriptRenderersTest extends MultiBrowserTest { GridCellElement cell_2_2 = grid.getCell(2, 2); // Verify render functionality - Assert.assertEquals("Bean(2, 0)", cell_1_1.getText()); + assertEquals("Bean(2, 0)", cell_1_1.getText()); - Assert.assertEquals("string2", cell_2_2.getText()); + assertEquals("string2", cell_2_2.getText()); // Verify init functionality - Assert.assertEquals("1", cell_1_1.getAttribute("column")); + assertEquals("1", cell_1_1.getAttribute("column")); // Verify onbrowserevent cell_1_1.click(); - Assert.assertTrue( - cell_1_1.getText().startsWith("Clicked 1 with key 2 at")); + assertTrue(cell_1_1.getText().startsWith("Clicked 1 with key 2 at")); } @Test @@ -65,9 +66,9 @@ public class JavaScriptRenderersTest extends MultiBrowserTest { WebElement log = findElement(By.id("clientLog")); String text = log.getText(); - Assert.assertTrue(text.contains("destory: 19/3")); - Assert.assertTrue(text.contains("destroy: 19/2")); - Assert.assertTrue(text.contains("destroy: 0/2")); - Assert.assertTrue(text.contains("destory: 0/3")); + assertTrue(text.contains("destory: 19/3")); + assertTrue(text.contains("destroy: 19/2")); + assertTrue(text.contains("destroy: 0/2")); + assertTrue(text.contains("destory: 0/3")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/LocalDateRenderersTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/LocalDateRenderersTest.java index 76f17edb63..1bafdbaab2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/LocalDateRenderersTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/LocalDateRenderersTest.java @@ -1,11 +1,12 @@ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertEquals; + import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; import java.util.Locale; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.GridElement; @@ -20,19 +21,20 @@ public class LocalDateRenderersTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); LocalDate epochDate = LocalDate.ofEpochDay(0); - Assert.assertEquals( + assertEquals( epochDate.format( DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG) .withLocale(new Locale("en"))), grid.getCell(0, 0).getText()); - Assert.assertEquals("1. tammikuuta 1970", grid.getCell(0, 1).getText()); - Assert.assertEquals( + assertEquals("1. tammikuuta 1970", grid.getCell(0, 1).getText()); + assertEquals( epochDate.atTime(0, 0) - .format(DateTimeFormatter.ofLocalizedDateTime( - FormatStyle.LONG, FormatStyle.SHORT) + .format(DateTimeFormatter + .ofLocalizedDateTime(FormatStyle.LONG, + FormatStyle.SHORT) .withLocale(new Locale("en"))), grid.getCell(0, 2).getText()); - Assert.assertEquals("1. tammikuuta 1970 klo 0.00.00", + assertEquals("1. tammikuuta 1970 klo 0.00.00", grid.getCell(0, 3).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/MoveGridAndAddRowTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/MoveGridAndAddRowTest.java index c6d9aa394a..abff073ebe 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/MoveGridAndAddRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/MoveGridAndAddRowTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -15,7 +16,7 @@ public class MoveGridAndAddRowTest extends SingleBrowserTest { $(ButtonElement.class).id("add").click(); GridElement grid = $(GridElement.class).first(); - Assert.assertEquals("1", grid.getCell(0, 0).getText()); - Assert.assertEquals("2", grid.getCell(1, 0).getText()); + assertEquals("1", grid.getCell(0, 0).getText()); + assertEquals("2", grid.getCell(1, 0).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java index 908c8c3cec..bb8655bd35 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.grid.basicfeatures; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -74,7 +75,7 @@ public class GridColumnResizeModeTest extends GridBasicsTest { // See that we got a resize event sleep(500); - Assert.assertTrue("Log shows resize event", getLogRow(0) + assertTrue("Log shows resize event", getLogRow(0) .contains("ColumnResizeEvent: isUserOriginated? true")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java index 974ac559e0..0f0202e8ac 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java @@ -15,11 +15,11 @@ */ package com.vaadin.tests.components.grid.basicfeatures.escalator; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.IOException; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -75,7 +75,7 @@ public class EscalatorRemoveAndAddRowsTest private void verifyRow(int escalatorIndex, int rowIndexInText) { // the format of text in cells is // Row: <index_when_updated>: <cell_index>,<index_when_inserted> - Assert.assertEquals("Invalid row present in index " + escalatorIndex, + assertEquals("Invalid row present in index " + escalatorIndex, "Row " + escalatorIndex + ": 0," + rowIndexInText, getBodyCell(escalatorIndex, 0).getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicDetailsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicDetailsTest.java index 32b7cf4b92..614de92071 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicDetailsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicDetailsTest.java @@ -56,7 +56,7 @@ public class GridBasicDetailsTest extends GridBasicsTest { try { selectMenuPath(OPEN_FIRST_ITEM_DETAILS); } catch (NoSuchElementException e) { - Assert.fail("Unable to set up details."); + fail("Unable to set up details."); } getGridElement().getDetails(0); @@ -77,7 +77,7 @@ public class GridBasicDetailsTest extends GridBasicsTest { selectMenuPath(OPEN_FIRST_ITEM_DETAILS); selectMenuPath(OPEN_FIRST_ITEM_DETAILS); } catch (NoSuchElementException e) { - Assert.fail("Unable to set up details."); + fail("Unable to set up details."); } getGridElement().getDetails(0); } @@ -100,7 +100,7 @@ public class GridBasicDetailsTest extends GridBasicsTest { selectMenuPath(OPEN_FIRST_ITEM_DETAILS); getGridElement().scroll(0); } catch (NoSuchElementException e) { - Assert.fail("Unable to set up details."); + fail("Unable to set up details."); } getGridElement().getDetails(0); } @@ -135,7 +135,7 @@ public class GridBasicDetailsTest extends GridBasicsTest { // scroll somewhere to hit uncached rows getGridElement().scrollToRow(101); } catch (NoSuchElementException e) { - Assert.fail("Unable to set up details."); + fail("Unable to set up details."); } // this should throw diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicStyleGeneratorTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicStyleGeneratorTest.java index b9b93fa884..da4eae84d1 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicStyleGeneratorTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicStyleGeneratorTest.java @@ -16,8 +16,8 @@ package com.vaadin.tests.components.grid.basics; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; -import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -37,8 +37,8 @@ public class GridBasicStyleGeneratorTest extends GridBasicsTest { GridRowElement row = getGridElement().getRow(2); GridCellElement cell = getGridElement().getCell(3, 2); - Assert.assertTrue(hasCssClass(row, "row2")); - Assert.assertTrue(hasCssClass(cell, "Column_2")); + assertTrue(hasCssClass(row, "row2")); + assertTrue(hasCssClass(cell, "Column_2")); // Scroll down and verify that the old elements don't have the // stylename any more @@ -47,8 +47,8 @@ public class GridBasicStyleGeneratorTest extends GridBasicsTest { row = getGridElement().getRow(352); cell = getGridElement().getCell(353, 2); - Assert.assertFalse(hasCssClass(row, "row352")); - Assert.assertFalse(hasCssClass(cell, "Column_2")); + assertFalse(hasCssClass(row, "row352")); + assertFalse(hasCssClass(cell, "Column_2")); } @Test @@ -63,8 +63,8 @@ public class GridBasicStyleGeneratorTest extends GridBasicsTest { GridRowElement row = getGridElement().getRow(2); GridCellElement cell = getGridElement().getCell(3, 2); - Assert.assertTrue(hasCssClass(row, "row2")); - Assert.assertTrue(hasCssClass(cell, "Column_2")); + assertTrue(hasCssClass(row, "row2")); + assertTrue(hasCssClass(cell, "Column_2")); // Disable the generator and check again selectRowStyleNameGenerator(GridBasics.ROW_STYLE_GENERATOR_NONE); @@ -73,8 +73,8 @@ public class GridBasicStyleGeneratorTest extends GridBasicsTest { row = getGridElement().getRow(2); cell = getGridElement().getCell(3, 2); - Assert.assertFalse(hasCssClass(row, "row2")); - Assert.assertFalse(hasCssClass(cell, "Column_2")); + assertFalse(hasCssClass(row, "row2")); + assertFalse(hasCssClass(cell, "Column_2")); } @Test @@ -89,8 +89,8 @@ public class GridBasicStyleGeneratorTest extends GridBasicsTest { GridRowElement row = getGridElement().getRow(2); GridCellElement cell = getGridElement().getCell(3, 2); - Assert.assertTrue(hasCssClass(row, "row2")); - Assert.assertTrue(hasCssClass(cell, "Column_2")); + assertTrue(hasCssClass(row, "row2")); + assertTrue(hasCssClass(cell, "Column_2")); // Change the generator and check again selectRowStyleNameGenerator(GridBasics.ROW_STYLE_GENERATOR_NONE); @@ -101,11 +101,11 @@ public class GridBasicStyleGeneratorTest extends GridBasicsTest { cell = getGridElement().getCell(3, 2); // Old styles removed? - Assert.assertFalse(hasCssClass(row, "row2")); - Assert.assertFalse(hasCssClass(cell, "Column_2")); + assertFalse(hasCssClass(row, "row2")); + assertFalse(hasCssClass(cell, "Column_2")); // New style present? - Assert.assertTrue(hasCssClass(cell, "Column-2")); + assertTrue(hasCssClass(cell, "Column-2")); } @Test diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridContentTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridContentTest.java index ba7187a5ec..55fd4f90c0 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridContentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridContentTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.grid.basics; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; public class GridContentTest extends GridBasicsTest { @@ -8,10 +9,10 @@ public class GridContentTest extends GridBasicsTest { @Test public void testHtmlRenderer() { DataObject first = getTestData().findFirst().orElse(null); - Assert.assertEquals("Text content should match row number", + assertEquals("Text content should match row number", first.getRowNumber().toString(), getGridElement().getCell(0, 5).getText()); - Assert.assertEquals("HTML content did not match", first.getHtmlString(), + assertEquals("HTML content did not match", first.getHtmlString(), getGridElement().getCell(0, 5).getAttribute("innerHTML")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridRowHeightTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridRowHeightTest.java index c99c31d4f7..7ec0bfb477 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridRowHeightTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridRowHeightTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.grid.basics; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + import org.junit.Test; public class GridRowHeightTest extends GridBasicsTest { @@ -11,7 +13,7 @@ public class GridRowHeightTest extends GridBasicsTest { int initialHeaderHeight = getHeaderHeight(); - Assert.assertNotEquals("Header height should not be 50px initially", 50, + assertNotEquals("Header height should not be 50px initially", 50, initialHeaderHeight); selectMenuPath("Component", "Body rows", "Body Row Height", "" + 100); @@ -50,11 +52,11 @@ public class GridRowHeightTest extends GridBasicsTest { private void checkRowHeights(int expectedHeaderHeight, int expectedBodyRowHeight, int expectedFooterHeight) { - Assert.assertEquals("Header height does not match expected value", + assertEquals("Header height does not match expected value", expectedHeaderHeight, getHeaderHeight()); - Assert.assertEquals("Body row height does not match expected value", + assertEquals("Body row height does not match expected value", expectedBodyRowHeight, getBodyRowHeight()); - Assert.assertEquals("Footer height does not match expected value", + assertEquals("Footer height does not match expected value", expectedFooterHeight, getFooterHeight()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridSortingTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridSortingTest.java index 4a6ddc4f61..42641ab7de 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridSortingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridSortingTest.java @@ -1,12 +1,14 @@ package com.vaadin.tests.components.grid.basics; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.List; import java.util.stream.Collectors; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.remote.DesiredCapabilities; @@ -35,8 +37,7 @@ public class GridSortingTest extends GridBasicsTest { for (Integer rowNumber : getTestData().sorted(BIG_RANDOM) .map(DataObject::getRowNumber).limit(5) .collect(Collectors.toList())) { - Assert.assertEquals( - "Grid was not sorted as expected, row number mismatch", + assertEquals("Grid was not sorted as expected, row number mismatch", rowNumber.toString(), getGridElement().getCell(i++, 3).getText()); } @@ -52,8 +53,7 @@ public class GridSortingTest extends GridBasicsTest { .sorted(SMALL_RANDOM.thenComparing(BIG_RANDOM)) .map(DataObject::getRowNumber).limit(5) .collect(Collectors.toList())) { - Assert.assertEquals( - "Grid was not sorted as expected, row number mismatch", + assertEquals("Grid was not sorted as expected, row number mismatch", rowNumber.toString(), getGridElement().getCell(i++, 3).getText()); } @@ -63,31 +63,27 @@ public class GridSortingTest extends GridBasicsTest { public void serverSideOrderByColumn0() { selectMenuPath("Component", "Columns", "Column 0", "Sort ASC"); - Assert.assertEquals("1. SortEvent: isUserOriginated? false", - getLogRow(0)); + assertEquals("1. SortEvent: isUserOriginated? false", getLogRow(0)); Comparator<String> comparator = Comparator.naturalOrder(); int i = 0; for (String coord : getTestData().map(DataObject::getCoordinates) .sorted(comparator).limit(5).collect(Collectors.toList())) { - Assert.assertEquals( - "Grid was not sorted as expected, row number mismatch", + assertEquals("Grid was not sorted as expected, row number mismatch", coord, getGridElement().getCell(i++, 0).getText()); } // self-verification - Assert.assertTrue(i > 0); + assertTrue(i > 0); selectMenuPath("Component", "Columns", "Column 0", "Sort DESC"); - Assert.assertEquals("2. SortEvent: isUserOriginated? false", - getLogRow(0)); + assertEquals("2. SortEvent: isUserOriginated? false", getLogRow(0)); i = 0; for (String coord : getTestData().map(DataObject::getCoordinates) .sorted(comparator.reversed()).limit(5) .collect(Collectors.toList())) { - Assert.assertEquals( - "Grid was not sorted as expected, row number mismatch", + assertEquals("Grid was not sorted as expected, row number mismatch", coord, getGridElement().getCell(i++, 0).getText()); } } @@ -96,32 +92,28 @@ public class GridSortingTest extends GridBasicsTest { public void serverSideOrderByDate() { selectMenuPath("Component", "Columns", "Date", "Sort ASC"); - Assert.assertEquals("1. SortEvent: isUserOriginated? false", - getLogRow(0)); + assertEquals("1. SortEvent: isUserOriginated? false", getLogRow(0)); Comparator<Date> comparator = Comparator.naturalOrder(); int i = 0; for (Date date : getTestData().map(DataObject::getDate) .sorted(comparator).limit(5).collect(Collectors.toList())) { - Assert.assertEquals( - "Grid was not sorted as expected, row number mismatch", + assertEquals("Grid was not sorted as expected, row number mismatch", date.toString(), getGridElement().getCell(i++, 4).getText()); } // self-verification - Assert.assertTrue(i > 0); + assertTrue(i > 0); selectMenuPath("Component", "Columns", "Date", "Sort DESC"); - Assert.assertEquals("2. SortEvent: isUserOriginated? false", - getLogRow(0)); + assertEquals("2. SortEvent: isUserOriginated? false", getLogRow(0)); i = 0; for (Date date : getTestData().map(DataObject::getDate) .sorted(comparator.reversed()).limit(5) .collect(Collectors.toList())) { - Assert.assertEquals( - "Grid was not sorted as expected, row number mismatch", + assertEquals("Grid was not sorted as expected, row number mismatch", date.toString(), getGridElement().getCell(i++, 4).getText()); } @@ -132,18 +124,16 @@ public class GridSortingTest extends GridBasicsTest { selectMenuPath("Component", "Columns", "Column 0", "Sort ASC"); selectMenuPath("Component", "Columns", "Clear sort"); - Assert.assertEquals("2. SortEvent: isUserOriginated? false", - getLogRow(0)); + assertEquals("2. SortEvent: isUserOriginated? false", getLogRow(0)); int i = 0; for (String coord : getTestData().map(DataObject::getCoordinates) .limit(5).collect(Collectors.toList())) { - Assert.assertEquals( - "Grid was not sorted as expected, row number mismatch", + assertEquals("Grid was not sorted as expected, row number mismatch", coord, getGridElement().getCell(i++, 0).getText()); } // self-verification - Assert.assertTrue(i > 0); + assertTrue(i > 0); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/RefreshDataProviderTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/RefreshDataProviderTest.java index 7c60bb9572..a3eccef4a4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/RefreshDataProviderTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/RefreshDataProviderTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.grid.basics; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -34,8 +36,7 @@ public class RefreshDataProviderTest extends MultiBrowserTest { findElement(By.id("update")).click(); WebElement first = findElement(By.tagName("td")); - Assert.assertEquals( - "UI component is not refreshed after update in data", + assertEquals("UI component is not refreshed after update in data", "Updated coordinates", first.getText()); } @@ -46,7 +47,7 @@ public class RefreshDataProviderTest extends MultiBrowserTest { findElement(By.id("add")).click(); WebElement first = findElement(By.tagName("td")); - Assert.assertEquals("UI component is not refreshed after add new data", + assertEquals("UI component is not refreshed after add new data", "Added", first.getText()); } @@ -57,8 +58,8 @@ public class RefreshDataProviderTest extends MultiBrowserTest { WebElement first = findElement(By.tagName("td")); String old = first.getText(); first = findElement(By.id("remove")); - Assert.assertNotEquals("UI component is not refreshed after removal", - old, first.getText()); + assertNotEquals("UI component is not refreshed after removal", old, + first.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/ComponentAlignmentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/ComponentAlignmentsTest.java index fafcfbd77e..a4f91e516f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/ComponentAlignmentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/ComponentAlignmentsTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.gridlayout; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -42,14 +43,14 @@ public class ComponentAlignmentsTest extends MultiBrowserTest { int rightSpaceSize = parent.getLocation().getX() + parent.getSize().getWidth() - checkbox.getLocation().getX() - checkbox.getSize().getWidth(); - Assert.assertTrue("No space on the left for centered element", + assertTrue("No space on the left for centered element", leftSpaceSize > 0); - Assert.assertTrue("No space on the right for centered element", + assertTrue("No space on the right for centered element", rightSpaceSize > 0); int diff = Math.abs(rightSpaceSize - leftSpaceSize); - Assert.assertTrue("Element is not in the center, diff:" + diff, - diff <= 2); // IE11 2pixels + assertTrue("Element is not in the center, diff:" + diff, diff <= 2); // IE11 + // 2pixels } @Test @@ -64,14 +65,14 @@ public class ComponentAlignmentsTest extends MultiBrowserTest { int rightSpaceSize = parent.getLocation().getX() + parent.getSize().getWidth() - checkbox.getLocation().getX() - checkbox.getSize().getWidth(); - Assert.assertTrue("No space on the left for centered element", + assertTrue("No space on the left for centered element", leftSpaceSize > 0); - Assert.assertTrue("There is some space on the right for the element", + assertTrue("There is some space on the right for the element", rightSpaceSize <= 1); int sizeDiff = parent.getSize().getWidth() - checkbox.getSize().getWidth(); - Assert.assertTrue("Element is not in aligned to the right", + assertTrue("Element is not in aligned to the right", Math.abs(sizeDiff - leftSpaceSize) <= 1); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutAlignmentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutAlignmentsTest.java index c677dcb1ce..26f4c7f771 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutAlignmentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutAlignmentsTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.gridlayout; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.Point; @@ -79,8 +80,8 @@ public class GridLayoutAlignmentsTest extends MultiBrowserTest { x++; y++; - Assert.assertEquals("X offset incorrect", x, offsetX); - Assert.assertEquals("Y offset incorrect", y, offsetY); + assertEquals("X offset incorrect", x, offsetX); + assertEquals("Y offset incorrect", y, offsetY); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUITest.java b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUITest.java index d489cd9614..0bdd0c653b 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUITest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.components.gridlayout; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -41,7 +43,7 @@ public class GridLayoutCellSizesUITest extends MultiBrowserTest { // items in positions 0,1,2,3,4,5 should have the same height int firstSlotHeight = getSlotHeight(0); for (int i = 1; i < 6; i++) { - Assert.assertEquals("Cell height didn't match for cell: " + i, + assertEquals("Cell height didn't match for cell: " + i, firstSlotHeight, getSlotHeight(i)); } } @@ -59,12 +61,12 @@ public class GridLayoutCellSizesUITest extends MultiBrowserTest { @Test public void expandedRowsShouldHaveCorrectHeight() { // Slots expanding over 2 rows should have the same height. - Assert.assertEquals("1x2 and 2x2 cell heights didn't match", - getSlotHeight(7), getSlotHeight(8)); + assertEquals("1x2 and 2x2 cell heights didn't match", getSlotHeight(7), + getSlotHeight(8)); // Slots on same row as the 1x2 label should have the same combined // height. - Assert.assertEquals( + assertEquals( "1x2 and combined row two and row three cell heights didn't match", getSlotHeight(7), getSlotHeight(6) + getSlotHeight(9)); } @@ -72,17 +74,16 @@ public class GridLayoutCellSizesUITest extends MultiBrowserTest { @Test public void expandedRowsShouldHaveCorrectWidth() { // Col 2 slot should be the dame width as 1x2 cell slot - Assert.assertEquals( - "Col 2 slot was not the same width as slot for 1x2 cell", + assertEquals("Col 2 slot was not the same width as slot for 1x2 cell", getSlotWidth(1), getSlotWidth(7)); // Row one col 3 & 4 should be as wide as the 2x2 date field - Assert.assertEquals( + assertEquals( "2x2 date field width didn't match col 3 & col 4 combined width", getSlotWidth(8), getSlotWidth(2) + getSlotWidth(3)); // 3x1 button should be as wide as 1x2cell + 2x2 data field - Assert.assertEquals( + assertEquals( "3x1 slot width wasn't the same as the combined slot widths of 1x2 cell and 2x2 date field", getSlotWidth(5), getSlotWidth(7) + getSlotWidth(8)); @@ -90,8 +91,7 @@ public class GridLayoutCellSizesUITest extends MultiBrowserTest { private void assertNotMatchesSmallHeight(int firstSlotHeight, int i, String id) { - Assert.assertNotEquals( - "Big slot '" + id + "' matched small slots in height", + assertNotEquals("Big slot '" + id + "' matched small slots in height", firstSlotHeight, getSlotHeight(i)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutExpandWithManyRowsTest.java b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutExpandWithManyRowsTest.java index 39648a5083..42566a37ea 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutExpandWithManyRowsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutExpandWithManyRowsTest.java @@ -1,8 +1,10 @@ package com.vaadin.tests.components.gridlayout; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -23,16 +25,15 @@ public class GridLayoutExpandWithManyRowsTest extends SingleBrowserTest { // lower than the first row List<WebElement> slots = gridlayout .findElements(By.className("v-gridlayout-slot")); - Assert.assertEquals(GridLayoutExpandWithManyRows.POPULATED_ROWS, - slots.size()); + assertEquals(GridLayoutExpandWithManyRows.POPULATED_ROWS, slots.size()); int firstRowHeight = slots.get(0).getSize().height; int lastRowHeight = firstRowHeight; for (int i = 1; i < GridLayoutExpandWithManyRows.POPULATED_ROWS; i++) { int rowHeight = slots.get(i).getSize().height; - Assert.assertTrue(rowHeight <= firstRowHeight); - Assert.assertTrue(rowHeight >= firstRowHeight - 2); - Assert.assertTrue(rowHeight <= lastRowHeight); + assertTrue(rowHeight <= firstRowHeight); + assertTrue(rowHeight >= firstRowHeight - 2); + assertTrue(rowHeight <= lastRowHeight); lastRowHeight = rowHeight; } diff --git a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutExtraSpacingTest.java b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutExtraSpacingTest.java index 4d884da3c1..15b4f9c507 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutExtraSpacingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutExtraSpacingTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.components.gridlayout; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.io.IOException; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -85,7 +87,7 @@ public class GridLayoutExtraSpacingTest extends MultiBrowserTest { assertHeight(component, 500 - spacing, 1); int offset = component.getLocation().getY() - gridLayout.getLocation().getY(); - Assert.assertEquals(spacing, offset); + assertEquals(spacing, offset); } @@ -95,12 +97,12 @@ public class GridLayoutExtraSpacingTest extends MultiBrowserTest { int offset = component.getLocation().getY() - gridLayout.getLocation().getY(); - Assert.assertEquals(0, offset); + assertEquals(0, offset); } private void assertHeight(WebElement component, int height, int tolerance) { - Assert.assertTrue(Math + assertTrue(Math .abs(height - component.getSize().getHeight()) <= tolerance); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutFocusOrderAfterShowChildTest.java b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutFocusOrderAfterShowChildTest.java index c8bce3a7aa..59e3c074c2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutFocusOrderAfterShowChildTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutFocusOrderAfterShowChildTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.gridlayout; +import static org.junit.Assert.assertEquals; + import java.io.IOException; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; @@ -38,13 +39,12 @@ public class GridLayoutFocusOrderAfterShowChildTest extends MultiBrowserTest { $(ButtonElement.class).first().click(); - Assert.assertEquals("First", - grid.$(LabelElement.class).first().getText()); + assertEquals("First", grid.$(LabelElement.class).first().getText()); grid.$(TextFieldElement.class).first().focus(); grid.$(TextFieldElement.class).first().sendKeys(Keys.TAB); - Assert.assertEquals("t2", + assertEquals("t2", driver.switchTo().activeElement().getAttribute("id")); } @@ -57,13 +57,12 @@ public class GridLayoutFocusOrderAfterShowChildTest extends MultiBrowserTest { $(ButtonElement.class).get(1).click(); - Assert.assertEquals("Third", - grid.$(LabelElement.class).get(1).getText()); + assertEquals("Third", grid.$(LabelElement.class).get(1).getText()); grid.$(TextFieldElement.class).first().focus(); grid.$(TextFieldElement.class).first().sendKeys(Keys.TAB); - Assert.assertEquals("t3", + assertEquals("t3", driver.switchTo().activeElement().getAttribute("id")); } @@ -76,13 +75,12 @@ public class GridLayoutFocusOrderAfterShowChildTest extends MultiBrowserTest { $(ButtonElement.class).get(2).click(); - Assert.assertEquals("Fifth", - grid.$(LabelElement.class).get(2).getText()); + assertEquals("Fifth", grid.$(LabelElement.class).get(2).getText()); grid.$(TextFieldElement.class).get(1).focus(); grid.$(TextFieldElement.class).get(1).sendKeys(Keys.TAB); - Assert.assertEquals("t5", + assertEquals("t5", driver.switchTo().activeElement().getAttribute("id")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutRequiredIndicatorLocationTest.java b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutRequiredIndicatorLocationTest.java index a1afe0edb3..366eacd44b 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutRequiredIndicatorLocationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutRequiredIndicatorLocationTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.gridlayout; +import static org.junit.Assert.assertEquals; + import java.io.IOException; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -90,7 +91,7 @@ public class GridLayoutRequiredIndicatorLocationTest extends MultiBrowserTest { + field.getSize().getWidth(); int actualIndicatorPosition = caption.getLocation().getX(); - Assert.assertEquals("Required indicator has wrong position", + assertEquals("Required indicator has wrong position", desiredIndicatorPosition, actualIndicatorPosition, 1d); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabelTest.java b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabelTest.java index b8caac693d..714ac6a6d6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabelTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabelTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.gridlayout; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.CheckBoxElement; @@ -21,7 +22,7 @@ public class GridLayoutWithLabelTest extends MultiBrowserTest { cb.click(); // Turn off int after = gridLayout.getSize().getWidth(); - Assert.assertEquals( + assertEquals( "layout width should not have changed after checkbox was toggled", before, after); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponentTest.java b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponentTest.java index 7aa5575696..4597015a72 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponentTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.javascriptcomponent; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; @@ -14,44 +16,42 @@ public class BasicJavaScriptComponentTest extends MultiBrowserTest { public void javascriptCommunication() throws Exception { openTestURL(); int idx = 0; - Assert.assertEquals( - "12. Got callback message: Callback message processed", + assertEquals("12. Got callback message: Callback message processed", getLogRow(idx++)); - Assert.assertEquals("11. Got RPC message: RPC message processed", + assertEquals("11. Got RPC message: RPC message processed", getLogRow(idx++)); - Assert.assertEquals("10. Parent ids checked", getLogRow(idx++)); + assertEquals("10. Parent ids checked", getLogRow(idx++)); // Data types in JS functions String expected = "1970-01-01T00:00:00.111Z"; - Assert.assertEquals( + assertEquals( "9. Argument[4][aDate] type: elemental.json.impl.JreJsonString, value: " + expected, getLogRow(idx++)); - Assert.assertEquals( + assertEquals( "8. Argument[4][aBoolean] type: elemental.json.impl.JreJsonBoolean, value: false", getLogRow(idx++)); - Assert.assertEquals( + assertEquals( "7. Argument[4][anInt] type: elemental.json.impl.JreJsonNumber, value: 556", getLogRow(idx++)); - Assert.assertEquals( + assertEquals( "6. Argument[4][aString] type: elemental.json.impl.JreJsonString, value: value1", getLogRow(idx++)); - Assert.assertEquals( - "5. Argument[4] type: elemental.json.impl.JreJsonObject", + assertEquals("5. Argument[4] type: elemental.json.impl.JreJsonObject", getLogRow(idx++)); - Assert.assertEquals( + assertEquals( "4. Argument[3] type: elemental.json.impl.JreJsonBoolean, value: true", getLogRow(idx++)); - Assert.assertEquals( + assertEquals( "3. Argument[2] type: elemental.json.impl.JreJsonNumber, value: 556", getLogRow(idx++)); - Assert.assertEquals( + assertEquals( "2. Argument[1] type: elemental.json.impl.JreJsonString, value: a string", getLogRow(idx++)); expected = "1970-01-01T00:00:00.123Z"; - Assert.assertEquals( + assertEquals( "1. Argument[0] type: elemental.json.impl.JreJsonString, value: " + expected, getLogRow(idx++)); @@ -59,14 +59,14 @@ public class BasicJavaScriptComponentTest extends MultiBrowserTest { // Component attributes AbstractJavaScriptComponentElement jsComponent = $( AbstractJavaScriptComponentElement.class).first(); - Assert.assertEquals("Component caption", getCaption(jsComponent)); + assertEquals("Component caption", getCaption(jsComponent)); // app://APP/connector/[uiid]/[cid]/[key]/[filename] - Assert.assertTrue(getChildText(jsComponent, 0) + assertTrue(getChildText(jsComponent, 0) .matches("4. Url: .*/run/APP/connector/0/\\d+/test")); - Assert.assertEquals("3. State message: Second state message", + assertEquals("3. State message: Second state message", getChildText(jsComponent, 1)); - Assert.assertEquals("2. State message: First state message", + assertEquals("2. State message: First state message", getChildText(jsComponent, 2)); // Can't/shouldn't check parent class name as we used to because it @@ -76,8 +76,7 @@ public class BasicJavaScriptComponentTest extends MultiBrowserTest { // Modifications ButtonElement button = $(ButtonElement.class).first(); button.click(); - Assert.assertEquals("Remove component\nDon't mess with me", - button.getText()); + assertEquals("Remove component\nDon't mess with me", button.getText()); } private String getCaption(AbstractComponentElement c) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/DuplicateJavascriptDependenciesTest.java b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/DuplicateJavascriptDependenciesTest.java index 652cd75e03..015d9b2b83 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/DuplicateJavascriptDependenciesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/DuplicateJavascriptDependenciesTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.javascriptcomponent; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -28,7 +29,6 @@ public class DuplicateJavascriptDependenciesTest extends SingleBrowserTest { public void duplicateJavascriptsDoNotCauseProblems() { openTestURL(); $(ButtonElement.class).first().click(); - Assert.assertEquals("It works", - $(LabelElement.class).id("result").getText()); + assertEquals("It works", $(LabelElement.class).id("result").getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java index a1c5edd095..23335d58b0 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.javascriptcomponent; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -18,12 +19,12 @@ public class JSComponentLoadingIndicatorTest extends SingleBrowserTest { js.click(); waitUntilLoadingIndicatorVisible(); waitUntilLoadingIndicatorNotVisible(); - Assert.assertEquals(1, findElements(By.className("pong")).size()); + assertEquals(1, findElements(By.className("pong")).size()); js.click(); waitUntilLoadingIndicatorVisible(); waitUntilLoadingIndicatorNotVisible(); - Assert.assertEquals(2, findElements(By.className("pong")).size()); + assertEquals(2, findElements(By.className("pong")).size()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptNoLayoutHandlingUITest.java b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptNoLayoutHandlingUITest.java index 623442a7ce..4dd6ff1387 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptNoLayoutHandlingUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptNoLayoutHandlingUITest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.javascriptcomponent; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -29,9 +30,9 @@ public class JavaScriptNoLayoutHandlingUITest extends MultiBrowserTest { public void stateUpdate() { openTestURL("debug"); WebElement js = findElement(By.id("js")); - Assert.assertEquals("state: 1", js.getText()); + assertEquals("state: 1", js.getText()); $(ButtonElement.class).first().click(); - Assert.assertEquals("state: 2", js.getText()); + assertEquals("state: 2", js.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptStateTrackingTest.java b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptStateTrackingTest.java index 760ec04af6..c277d9e754 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptStateTrackingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptStateTrackingTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.javascriptcomponent; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.By; @@ -46,11 +47,11 @@ public class JavaScriptStateTrackingTest extends SingleBrowserTest { private void assertValues(int expectedCounter, String expectedField1, String expectedField2) { - Assert.assertEquals(String.valueOf(expectedCounter), + assertEquals(String.valueOf(expectedCounter), findElement(By.id("counter")).getText()); - Assert.assertEquals(String.valueOf(expectedField1), + assertEquals(String.valueOf(expectedField1), findElement(By.id("field1")).getText()); - Assert.assertEquals(String.valueOf(expectedField2), + assertEquals(String.valueOf(expectedField2), findElement(By.id("field2")).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/StateChangeCounterTest.java b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/StateChangeCounterTest.java index 0dd88ef75a..08938632a9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/StateChangeCounterTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/StateChangeCounterTest.java @@ -15,11 +15,12 @@ */ package com.vaadin.tests.components.javascriptcomponent; +import static org.junit.Assert.assertEquals; + import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -54,6 +55,6 @@ public class StateChangeCounterTest extends SingleBrowserTest { private void assertMessages(String... expectedMessages) { List<String> actualMessages = findElements(By.className("logRow")) .stream().map(WebElement::getText).collect(Collectors.toList()); - Assert.assertEquals(Arrays.asList(expectedMessages), actualMessages); + assertEquals(Arrays.asList(expectedMessages), actualMessages); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/label/LabelTooltipTest.java b/uitest/src/test/java/com/vaadin/tests/components/label/LabelTooltipTest.java index c88a16387d..8a963e0b83 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/label/LabelTooltipTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/label/LabelTooltipTest.java @@ -15,10 +15,11 @@ */ package com.vaadin.tests.components.label; +import static org.junit.Assert.assertEquals; + import java.io.IOException; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.remote.DesiredCapabilities; @@ -53,8 +54,7 @@ public class LabelTooltipTest extends MultiBrowserTest { private void assertTooltips() throws IOException { $(LabelElement.class).get(2).showTooltip(); - Assert.assertEquals("Default tooltip content", - getTooltipElement().getText()); + assertEquals("Default tooltip content", getTooltipElement().getText()); /* * Some cases tooltip doesn't disappear without some extra mouse events @@ -64,11 +64,10 @@ public class LabelTooltipTest extends MultiBrowserTest { .click().perform(); $(LabelElement.class).get(4).showTooltip(); - Assert.assertEquals( + assertEquals( "Error inside tooltip together with the regular tooltip message.", getTooltipErrorElement().getText()); - Assert.assertEquals("Default tooltip content", - getTooltipElement().getText()); + assertEquals("Default tooltip content", getTooltipElement().getText()); /* Visual comparison */ compareScreen("tooltipVisible"); diff --git a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectAddRemoveItemsTest.java b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectAddRemoveItemsTest.java index ee655c40af..b51f6e473b 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectAddRemoveItemsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectAddRemoveItemsTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.listselect; +import static org.junit.Assert.assertEquals; + import java.util.Arrays; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -53,7 +54,7 @@ public class ListSelectAddRemoveItemsTest extends SingleBrowserTest { } private void assertOptions(String... options) { - Assert.assertEquals(Arrays.asList(options), + assertEquals(Arrays.asList(options), $(ListSelectElement.class).first().getOptions()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectNoDomRebuildTest.java b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectNoDomRebuildTest.java index e63f10f987..1133bb0c1a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectNoDomRebuildTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectNoDomRebuildTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.listselect; +import static org.junit.Assert.assertNotNull; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -63,7 +64,7 @@ public class ListSelectNoDomRebuildTest extends SingleBrowserTest { for (WebElement element : options) { // We really don't expect the text to be null, mainly doing this // since getText() will throw if the element is detached. - Assert.assertNotNull(element.getText()); + assertNotNull(element.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectStyleNamesTest.java b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectStyleNamesTest.java index f6137387d7..f819dcc396 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectStyleNamesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectStyleNamesTest.java @@ -15,10 +15,11 @@ */ package com.vaadin.tests.components.listselect; +import static org.junit.Assert.assertEquals; + import java.util.Arrays; import java.util.HashSet; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; @@ -86,7 +87,7 @@ public class ListSelectStyleNamesTest extends SingleBrowserTest { private void assertStyleNames(TestBenchElement element, String... styleNames) { - Assert.assertEquals(new HashSet<>(Arrays.asList(styleNames)), + assertEquals(new HashSet<>(Arrays.asList(styleNames)), element.getClassNames()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectTest.java b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectTest.java index e256a9c525..a95b52f6fb 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectTest.java @@ -1,7 +1,9 @@ package com.vaadin.tests.components.listselect; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.util.Arrays; import java.util.List; @@ -9,7 +11,6 @@ import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -49,24 +50,23 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { selectMenuPath("Component", "Listeners", "Selection listener"); selectItem("Item 4"); - Assert.assertEquals("1. Selected: [Item 4]", getLogRow(0)); + assertEquals("1. Selected: [Item 4]", getLogRow(0)); selectItem("Item 2"); - Assert.assertEquals("3. Selected: [Item 2]", getLogRow(0)); + assertEquals("3. Selected: [Item 2]", getLogRow(0)); addItemsToSelection("Item 4"); - Assert.assertEquals("4. Selected: [Item 2, Item 4]", getLogRow(0)); + assertEquals("4. Selected: [Item 2, Item 4]", getLogRow(0)); addItemsToSelection("Item 10", "Item 0", "Item 9"); // will cause 3 // events - Assert.assertEquals( - "7. Selected: [Item 2, Item 4, Item 10, Item 0, Item 9]", + assertEquals("7. Selected: [Item 2, Item 4, Item 10, Item 0, Item 9]", getLogRow(0)); removeItemsFromSelection("Item 0", "Item 2", "Item 9"); // will cause 3 // events - Assert.assertEquals("10. Selected: [Item 4, Item 10]", getLogRow(0)); + assertEquals("10. Selected: [Item 4, Item 10]", getLogRow(0)); } @Test @@ -74,15 +74,17 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { selectMenuPath("Component", "Listeners", "Selection listener"); selectItem("Item 4"); - Assert.assertEquals("1. Selected: [Item 4]", getLogRow(0)); + assertEquals("1. Selected: [Item 4]", getLogRow(0)); - getListSelect().findElement(By.tagName("select")).sendKeys(Keys.ARROW_UP); + getListSelect().findElement(By.tagName("select")) + .sendKeys(Keys.ARROW_UP); - Assert.assertEquals("2. Selected: [Item 3]", getLogRow(0)); + assertEquals("2. Selected: [Item 3]", getLogRow(0)); - getListSelect().findElement(By.tagName("select")).sendKeys(Keys.ARROW_DOWN, Keys.ARROW_DOWN); + getListSelect().findElement(By.tagName("select")) + .sendKeys(Keys.ARROW_DOWN, Keys.ARROW_DOWN); - Assert.assertEquals("4. Selected: [Item 5]", getLogRow(0)); + assertEquals("4. Selected: [Item 5]", getLogRow(0)); } @@ -92,23 +94,23 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { List<WebElement> select = getListSelect() .findElements(By.tagName("select")); - Assert.assertEquals(1, select.size()); - Assert.assertNotNull(select.get(0).getAttribute("disabled")); + assertEquals(1, select.size()); + assertNotNull(select.get(0).getAttribute("disabled")); selectMenuPath("Component", "Listeners", "Selection listener"); String lastLogRow = getLogRow(0); selectItem("Item 4"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); assertNothingSelected(); addItemsToSelection("Item 2"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); assertNothingSelected(); removeItemsFromSelection("Item 4"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); assertNothingSelected(); } @@ -119,13 +121,13 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { List<WebElement> select = getListSelect() .findElements(By.tagName("select")); - Assert.assertEquals(1, select.size()); - Assert.assertNotNull(select.get(0).getAttribute("disabled")); + assertEquals(1, select.size()); + assertNotNull(select.get(0).getAttribute("disabled")); String lastLogRow = getLogRow(0); selectItem("Item 4"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); assertNothingSelected(); } @@ -136,8 +138,8 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { List<WebElement> select = getListSelect() .findElements(By.tagName("select")); - Assert.assertEquals(1, select.size()); - Assert.assertNotNull(select.get(0).getAttribute("disabled")); + assertEquals(1, select.size()); + assertNotNull(select.get(0).getAttribute("disabled")); addItemsToSelection("Item 2"); } @@ -152,8 +154,8 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { List<WebElement> select = getListSelect() .findElements(By.tagName("select")); - Assert.assertEquals(1, select.size()); - Assert.assertNotNull(select.get(0).getAttribute("disabled")); + assertEquals(1, select.size()); + assertNotNull(select.get(0).getAttribute("disabled")); removeItemsFromSelection("Item 4"); } @@ -169,16 +171,16 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { selectMenuPath("Component", "State", "Enabled"); selectItem("Item 5"); - Assert.assertEquals("3. Selected: [Item 5]", getLogRow(0)); + assertEquals("3. Selected: [Item 5]", getLogRow(0)); selectItem("Item 1"); - Assert.assertEquals("5. Selected: [Item 1]", getLogRow(0)); + assertEquals("5. Selected: [Item 1]", getLogRow(0)); addItemsToSelection("Item 2"); - Assert.assertEquals("6. Selected: [Item 1, Item 2]", getLogRow(0)); + assertEquals("6. Selected: [Item 1, Item 2]", getLogRow(0)); removeItemsFromSelection("Item 1"); - Assert.assertEquals("7. Selected: [Item 2]", getLogRow(0)); + assertEquals("7. Selected: [Item 2]", getLogRow(0)); } @Test @@ -192,16 +194,16 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { selectMenuPath("Component", "State", "Readonly"); selectItem("Item 5"); - Assert.assertEquals("3. Selected: [Item 5]", getLogRow(0)); + assertEquals("3. Selected: [Item 5]", getLogRow(0)); selectItem("Item 1"); - Assert.assertEquals("5. Selected: [Item 1]", getLogRow(0)); + assertEquals("5. Selected: [Item 1]", getLogRow(0)); addItemsToSelection("Item 2"); - Assert.assertEquals("6. Selected: [Item 1, Item 2]", getLogRow(0)); + assertEquals("6. Selected: [Item 1, Item 2]", getLogRow(0)); removeItemsFromSelection("Item 1"); - Assert.assertEquals("7. Selected: [Item 2]", getLogRow(0)); + assertEquals("7. Selected: [Item 2]", getLogRow(0)); } @Test @@ -216,17 +218,17 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { selectMenuPath("Component", "Listeners", "Selection listener"); selectMenuPath("Component", "Selection", "Toggle Item 5"); - Assert.assertEquals("2. Selected: [Item 5]", getLogRow(0)); + assertEquals("2. Selected: [Item 5]", getLogRow(0)); assertSelected("Item 5"); selectMenuPath("Component", "Selection", "Toggle Item 1"); // Selection order (most recently selected is last) - Assert.assertEquals("4. Selected: [Item 5, Item 1]", getLogRow(0)); + assertEquals("4. Selected: [Item 5, Item 1]", getLogRow(0)); // DOM order assertSelected("Item 1", "Item 5"); selectMenuPath("Component", "Selection", "Toggle Item 5"); - Assert.assertEquals("6. Selected: [Item 1]", getLogRow(0)); + assertEquals("6. Selected: [Item 1]", getLogRow(0)); assertSelected("Item 1"); } @@ -238,8 +240,7 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { } private void assertSelected(String... expectedSelection) { - Assert.assertEquals(Arrays.asList(expectedSelection), - getSelectedValues()); + assertEquals(Arrays.asList(expectedSelection), getSelectedValues()); } @Override @@ -264,7 +265,7 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { if (first.isPresent()) { first.get().click(); } else { - Assert.fail("No element present with text " + text); + fail("No element present with text " + text); } } @@ -282,7 +283,7 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { } private void assertNothingSelected() { - Assert.assertEquals(0, getSelectedValues().size()); + assertEquals(0, getSelectedValues().size()); } protected void assertItems(int count, String suffix) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/loginform/CustomizedLoginFormUITest.java b/uitest/src/test/java/com/vaadin/tests/components/loginform/CustomizedLoginFormUITest.java index 4db7fb658b..02d3b20245 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/loginform/CustomizedLoginFormUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/loginform/CustomizedLoginFormUITest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.loginform; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.By; @@ -12,9 +13,9 @@ public class CustomizedLoginFormUITest extends LoginFormUITest { @Test public void captionsCorrect() { openTestURL(); - Assert.assertEquals("Identifiant", getUsernameCaption()); - Assert.assertEquals("Mot de passe", getPasswordCaption()); - Assert.assertEquals("Se connecter", getLoginCaption()); + assertEquals("Identifiant", getUsernameCaption()); + assertEquals("Mot de passe", getPasswordCaption()); + assertEquals("Se connecter", getLoginCaption()); } private String getLoginCaption() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/loginform/LoginFormUITest.java b/uitest/src/test/java/com/vaadin/tests/components/loginform/LoginFormUITest.java index 4648b750f1..171f341852 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/loginform/LoginFormUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/loginform/LoginFormUITest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.loginform; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -17,7 +18,7 @@ public class LoginFormUITest extends SingleBrowserTest { getUsername().sendKeys("user123"); getPassword().sendKeys("pass123"); getLogin().click(); - Assert.assertEquals("User 'user123', password='pass123' logged in", + assertEquals("User 'user123', password='pass123' logged in", getInfo().getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java index 7213d2d466..4da01aabaa 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.menubar; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -69,13 +71,13 @@ public class MenuBarIconsTest extends SingleBrowserTest { private void assertImage(String image, WebElement menuItem) { WebElement imageElement = menuItem.findElement(By.className("v-icon")); - Assert.assertTrue(imageElement.getAttribute("src").endsWith(image)); + assertTrue(imageElement.getAttribute("src").endsWith(image)); } private void assertFontIcon(FontAwesome expected, WebElement menuItem) { WebElement mainIcon = menuItem.findElement(By.className("v-icon")); - Assert.assertEquals(expected.getCodepoint(), + assertEquals(expected.getCodepoint(), mainIcon.getText().codePointAt(0)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarNavigationKeyboardTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarNavigationKeyboardTest.java index 8737ba054e..2f8c4f2e46 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarNavigationKeyboardTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarNavigationKeyboardTest.java @@ -1,9 +1,9 @@ package com.vaadin.tests.components.menubar; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -36,34 +36,34 @@ public class MenuBarNavigationKeyboardTest extends MultiBrowserTest { openMenu("File"); getMenuBar().sendKeys(Keys.DOWN, Keys.DOWN, Keys.DOWN, Keys.DOWN, Keys.RIGHT, Keys.ENTER); - Assert.assertEquals("1. MenuItem File/Export../As PDF... selected", + assertEquals("1. MenuItem File/Export../As PDF... selected", getLogRow(0)); openMenu("File"); getMenuBar().sendKeys(Keys.RIGHT, Keys.RIGHT, Keys.RIGHT, Keys.ENTER); - Assert.assertEquals("2. MenuItem Help selected", getLogRow(0)); + assertEquals("2. MenuItem Help selected", getLogRow(0)); openMenu("Edit"); getMenuBar().sendKeys(Keys.LEFT, Keys.DOWN, Keys.DOWN, Keys.ENTER); - Assert.assertEquals("3. MenuItem Edit/Cut selected", getLogRow(0)); + assertEquals("3. MenuItem Edit/Cut selected", getLogRow(0)); openMenu("Edit"); getMenuBar().sendKeys(Keys.ENTER); - Assert.assertEquals("3. MenuItem Edit/Cut selected", getLogRow(0)); + assertEquals("3. MenuItem Edit/Cut selected", getLogRow(0)); getMenuBar().sendKeys(Keys.ENTER); - Assert.assertEquals("4. MenuItem Edit/Copy selected", getLogRow(0)); + assertEquals("4. MenuItem Edit/Copy selected", getLogRow(0)); /* Enter while menubar has focus but no selection should focus "File" */ getMenuBar().sendKeys(Keys.ENTER); - Assert.assertEquals("4. MenuItem Edit/Copy selected", getLogRow(0)); + assertEquals("4. MenuItem Edit/Copy selected", getLogRow(0)); /* Enter again should open File and focus Open */ getMenuBar().sendKeys(Keys.ENTER); - Assert.assertEquals("4. MenuItem Edit/Copy selected", getLogRow(0)); + assertEquals("4. MenuItem Edit/Copy selected", getLogRow(0)); getMenuBar().sendKeys(Keys.ENTER); - Assert.assertEquals("5. MenuItem File/Open selected", getLogRow(0)); + assertEquals("5. MenuItem File/Open selected", getLogRow(0)); } @Test diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarNavigationMouseTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarNavigationMouseTest.java index 98651b2759..a88fc47f6d 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarNavigationMouseTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarNavigationMouseTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.menubar; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.MenuBarElement; @@ -18,13 +19,13 @@ public class MenuBarNavigationMouseTest extends MultiBrowserTest { openTestURL(); MenuBarElement menuBar = $(MenuBarElement.class).first(); menuBar.clickItem("File", "Export..", "As PDF..."); - Assert.assertEquals("1. MenuItem File/Export../As PDF... selected", + assertEquals("1. MenuItem File/Export../As PDF... selected", getLogRow(0)); menuBar.clickItem("Edit", "Copy"); - Assert.assertEquals("2. MenuItem Edit/Copy selected", getLogRow(0)); + assertEquals("2. MenuItem Edit/Copy selected", getLogRow(0)); menuBar.clickItem("Help"); - Assert.assertEquals("3. MenuItem Help selected", getLogRow(0)); + assertEquals("3. MenuItem Help selected", getLogRow(0)); menuBar.clickItem("File", "Exit"); - Assert.assertEquals("4. MenuItem File/Exit selected", getLogRow(0)); + assertEquals("4. MenuItem File/Exit selected", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java index 7ba79ed7ff..4de9b37c26 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.menubar; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; @@ -46,7 +47,7 @@ public class MenuBarSubmenusClosingValoTest extends MultiBrowserTest { menu.sendKeys(Keys.ARROW_RIGHT); int count = driver.findElements(By.className("v-menubar-popup")).size(); - Assert.assertTrue("The count of open popups should be one", count == 1); + assertTrue("The count of open popups should be one", count == 1); } @Test @@ -67,6 +68,6 @@ public class MenuBarSubmenusClosingValoTest extends MultiBrowserTest { waitForElementPresent(By.className("v-menubar-popup")); int count = driver.findElements(By.className("v-menubar-popup")).size(); - Assert.assertTrue("The count of open popups should be one", count == 1); + assertTrue("The count of open popups should be one", count == 1); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java index 2487aa3863..e984558838 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.components.menubar; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -22,11 +23,11 @@ public class MenuItemStyleRemovedTest extends MultiBrowserTest { MenuBarElement menu = $(MenuBarElement.class).first(); List<WebElement> elements = menu .findElements(By.className("custom-menu-item")); - Assert.assertEquals(2, elements.size()); + assertEquals(2, elements.size()); menu.clickItem("first"); menu.clickItem("second"); elements = menu.findElements(By.className("custom-menu-item")); - Assert.assertEquals(2, elements.size()); + assertEquals(2, elements.size()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java index 0604840669..0caf786304 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.menubar; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; @@ -51,11 +52,11 @@ public class SpaceMenuBarNavigationTest extends MultiBrowserTest { found = true; } } - Assert.assertTrue("Sub menu is not opened on ENTER key", found); + assertTrue("Sub menu is not opened on ENTER key", found); menu.sendKeys(Keys.SPACE); - Assert.assertTrue("No result of action triggered by SPACE key", + assertTrue("No result of action triggered by SPACE key", isElementPresent(By.className("action-result"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativebutton/NativeButtonClickTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativebutton/NativeButtonClickTest.java index 80bba12f7e..2a49691c3e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/nativebutton/NativeButtonClickTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/nativebutton/NativeButtonClickTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.nativebutton; -import org.junit.Assert; +import static org.junit.Assert.assertNotEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -42,11 +43,11 @@ public class NativeButtonClickTest extends MultiBrowserTest { clickFirstButton(); String eventCoordinates = getFirstLabelValue(); - Assert.assertNotEquals("0,0", eventCoordinates); + assertNotEquals("0,0", eventCoordinates); clickSecondButton(); eventCoordinates = getSecondLabelValue(); - Assert.assertNotEquals("0,0", eventCoordinates); + assertNotEquals("0,0", eventCoordinates); } private void clickFirstButton() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativebutton/NativeButtonIconAndTextTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativebutton/NativeButtonIconAndTextTest.java index af077f6d13..1aa516ef1f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/nativebutton/NativeButtonIconAndTextTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/nativebutton/NativeButtonIconAndTextTest.java @@ -23,10 +23,10 @@ import static com.vaadin.tests.components.nativebutton.NativeButtonIconAndText.N import static com.vaadin.tests.components.nativebutton.NativeButtonIconAndText.NATIVE_BUTTON_TEXT_ICON; import static com.vaadin.tests.components.nativebutton.NativeButtonIconAndText.NATIVE_BUTTON_TEXT_ICON_ALT; import static com.vaadin.tests.components.nativebutton.NativeButtonIconAndText.UPDATED_ALTERNATE_TEXT; +import static org.junit.Assert.assertEquals; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -88,7 +88,7 @@ public class NativeButtonIconAndTextTest extends MultiBrowserTest { alt = ""; } - Assert.assertEquals(expected, alt); + assertEquals(expected, alt); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectCaptionGenerationTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectCaptionGenerationTest.java index 2e7accac48..a66dc87a06 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectCaptionGenerationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectCaptionGenerationTest.java @@ -1,19 +1,20 @@ package com.vaadin.tests.components.nativeselect; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.TestBenchElement; -import com.vaadin.testbench.elements.NativeSelectElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.NativeSelectElement; import com.vaadin.tests.tb3.SingleBrowserTest; public class NativeSelectCaptionGenerationTest extends SingleBrowserTest { - private static final String[] value = { "Foo", "Bar", "Baz", - "Spam", "Eggs" }; + private static final String[] value = { "Foo", "Bar", "Baz", "Spam", + "Eggs" }; @Test public void testDefaultDeclarativeCaptions() { @@ -21,7 +22,7 @@ public class NativeSelectCaptionGenerationTest extends SingleBrowserTest { List<TestBenchElement> options = $(NativeSelectElement.class).first() .getOptions(); for (int i = 0; i < options.size(); ++i) { - Assert.assertEquals("Captions don't match.", value[i], + assertEquals("Captions don't match.", value[i], options.get(i).getText()); } } @@ -33,7 +34,7 @@ public class NativeSelectCaptionGenerationTest extends SingleBrowserTest { List<TestBenchElement> options = $(NativeSelectElement.class).first() .getOptions(); for (int i = 0; i < options.size(); ++i) { - Assert.assertEquals("Captions don't match.", "Option " + (i + 1), + assertEquals("Captions don't match.", "Option " + (i + 1), options.get(i).getText()); } } @@ -45,7 +46,7 @@ public class NativeSelectCaptionGenerationTest extends SingleBrowserTest { List<TestBenchElement> options = $(NativeSelectElement.class).first() .getOptions(); for (int i = 0; i < options.size(); ++i) { - Assert.assertEquals("Captions don't match.", "" + (i + 1), + assertEquals("Captions don't match.", "" + (i + 1), options.get(i).getText()); } } @@ -58,7 +59,7 @@ public class NativeSelectCaptionGenerationTest extends SingleBrowserTest { List<TestBenchElement> options = $(NativeSelectElement.class).first() .getOptions(); for (int i = 0; i < options.size(); ++i) { - Assert.assertEquals("Captions don't match.", value[i], + assertEquals("Captions don't match.", value[i], options.get(i).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectEmptySelectionTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectEmptySelectionTest.java index 102b504605..4578d261c2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectEmptySelectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectEmptySelectionTest.java @@ -15,11 +15,13 @@ */ package com.vaadin.tests.components.nativeselect; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Set; import java.util.stream.Collectors; import java.util.stream.IntStream; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.TestBenchElement; @@ -60,12 +62,12 @@ public class NativeSelectEmptySelectionTest extends MultiBrowserTest { Set<String> options = select.getOptions().stream() .map(TestBenchElement::getText).collect(Collectors.toSet()); if (emptyCaption == null) { - Assert.assertEquals(49, options.size()); - Assert.assertTrue(options.containsAll(originalOptions)); + assertEquals(49, options.size()); + assertTrue(options.containsAll(originalOptions)); } else { options.contains(emptyCaption); - Assert.assertEquals(50, options.size()); - Assert.assertTrue(options.containsAll(originalOptions)); + assertEquals(50, options.size()); + assertTrue(options.containsAll(originalOptions)); } } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectFocusBlurTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectFocusBlurTest.java index f6bb38c6f4..5d9e3cc540 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectFocusBlurTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectFocusBlurTest.java @@ -15,15 +15,17 @@ */ package com.vaadin.tests.components.nativeselect; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import com.vaadin.testbench.TestBenchElement; -import com.vaadin.testbench.elements.NativeSelectElement; import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.testbench.elements.NativeSelectElement; import com.vaadin.tests.tb3.MultiBrowserTest; /** @@ -40,24 +42,24 @@ public class NativeSelectFocusBlurTest extends MultiBrowserTest { nativeSelect.click(); // Focus event is fired - Assert.assertTrue(logContainsText("1. Focus Event")); + assertTrue(logContainsText("1. Focus Event")); List<TestBenchElement> options = nativeSelect.getOptions(); options.get(1).click(); // No any new event - Assert.assertFalse(logContainsText("2.")); + assertFalse(logContainsText("2.")); // click on log label => blur $(LabelElement.class).first().click(); // blur event is fired - Assert.assertTrue(logContainsText("2. Blur Event")); + assertTrue(logContainsText("2. Blur Event")); nativeSelect.click(); // Focus event is fired - Assert.assertTrue(logContainsText("3. Focus Event")); + assertTrue(logContainsText("3. Focus Event")); nativeSelect.sendKeys(Keys.ARROW_UP, Keys.ENTER); // No any new event - Assert.assertFalse(logContainsText("4.")); + assertFalse(logContainsText("4.")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectInitTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectInitTest.java index 8fefd2af5d..4f48d7a1ce 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectInitTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectInitTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.nativeselect; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.NativeSelectElement; @@ -32,7 +33,7 @@ public class NativeSelectInitTest extends MultiBrowserTest { openTestURL(); String selected = $(NativeSelectElement.class).first().getValue(); - Assert.assertEquals("Bar", selected); + assertEquals("Bar", selected); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectStyleNamesTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectStyleNamesTest.java index 28defc1a58..344dbe9853 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectStyleNamesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectStyleNamesTest.java @@ -15,11 +15,12 @@ */ package com.vaadin.tests.components.nativeselect; +import static org.junit.Assert.assertEquals; + import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.NativeSelectElement; @@ -38,7 +39,7 @@ public class NativeSelectStyleNamesTest extends SingleBrowserTest { Set<String> expected = Stream.of("v-select", "v-widget") .collect(Collectors.toSet()); - Assert.assertEquals(expected, + assertEquals(expected, $(NativeSelectElement.class).first().getClassNames()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectVisibleItemCountTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectVisibleItemCountTest.java index 95af50e55d..da2c6a7629 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectVisibleItemCountTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectVisibleItemCountTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.nativeselect; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -30,9 +31,9 @@ public class NativeSelectVisibleItemCountTest extends SingleBrowserTest { openTestURL(); WebElement select = $(NativeSelectElement.class).first() .findElement(By.xpath("select")); - Assert.assertEquals("1", select.getAttribute("size")); + assertEquals("1", select.getAttribute("size")); selectMenuPath("Component", "Size", "Visible item count", "5"); - Assert.assertEquals("5", select.getAttribute("size")); + assertEquals("5", select.getAttribute("size")); } @Override diff --git a/uitest/src/test/java/com/vaadin/tests/components/notification/MiddleNotificationPositionTest.java b/uitest/src/test/java/com/vaadin/tests/components/notification/MiddleNotificationPositionTest.java index 759bd13185..3a95bda5ff 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/notification/MiddleNotificationPositionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/notification/MiddleNotificationPositionTest.java @@ -15,7 +15,10 @@ */ package com.vaadin.tests.components.notification; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.Point; import org.openqa.selenium.WebElement; @@ -42,22 +45,21 @@ public class MiddleNotificationPositionTest extends MultiBrowserTest { WebElement notification = driver .findElement(By.className("v-Notification")); - Assert.assertNotNull(notification); + assertNotNull(notification); String left = notification.getCssValue("left"); - Assert.assertEquals( - "Left position of notification element should be 0px", "0px", - left); + assertEquals("Left position of notification element should be 0px", + "0px", left); Point location = notification.getLocation(); - Assert.assertEquals("X coordinate of notifiation element should be 0", - 0, location.getX()); + assertEquals("X coordinate of notifiation element should be 0", 0, + location.getX()); WebElement body = driver.findElement(By.tagName("body")); int height = body.getSize().height; - Assert.assertTrue("Y coordinate of notification element is too small", + assertTrue("Y coordinate of notification element is too small", height / 2 - notification.getSize().height / 2 - 1 <= location .getY()); - Assert.assertTrue("Y coordinate of notification element is too big", + assertTrue("Y coordinate of notification element is too big", height / 2 + 1 >= location.getY()); } @@ -72,26 +74,25 @@ public class MiddleNotificationPositionTest extends MultiBrowserTest { WebElement notification = driver .findElement(By.className("v-Notification")); - Assert.assertNotNull(notification); + assertNotNull(notification); String right = notification.getCssValue("right"); - Assert.assertEquals( - "Right position of notification element should be 0px", "0px", - right); + assertEquals("Right position of notification element should be 0px", + "0px", right); WebElement body = driver.findElement(By.tagName("body")); int height = body.getSize().height; int width = body.getSize().width; Point location = notification.getLocation(); - Assert.assertTrue( + assertTrue( "Notification right border should be in the rightmost position", width - 1 <= location.getX() + notification.getSize().getWidth()); - Assert.assertTrue("Y coordinate of notification element is too small", + assertTrue("Y coordinate of notification element is too small", height / 2 - notification.getSize().height / 2 - 1 <= location .getY()); - Assert.assertTrue("Y coordinate of notification element is too big", + assertTrue("Y coordinate of notification element is too big", height / 2 + 1 >= location.getY()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/notification/NotificationDelayTest.java b/uitest/src/test/java/com/vaadin/tests/components/notification/NotificationDelayTest.java index 40bca3d6c3..e2cc28db7d 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/notification/NotificationDelayTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/notification/NotificationDelayTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.notification; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; @@ -35,7 +36,7 @@ public class NotificationDelayTest extends MultiBrowserTest { public void testDelay() throws InterruptedException { openTestURL(); - Assert.assertTrue("No notification found", hasNotification()); + assertTrue("No notification found", hasNotification()); waitUntil(new ExpectedCondition<Boolean>() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/notification/NotificationsWaiAriaTest.java b/uitest/src/test/java/com/vaadin/tests/components/notification/NotificationsWaiAriaTest.java index 362dcaffcd..5d37a919b0 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/notification/NotificationsWaiAriaTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/notification/NotificationsWaiAriaTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.notification; -import org.junit.Assert; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -67,18 +69,16 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest { NotificationElement notification = $(NotificationElement.class).first(); String text = notification.getAttribute("role"); - Assert.assertTrue( - "Expected attribute 'role' to equal 'alert', found " + text, + assertTrue("Expected attribute 'role' to equal 'alert', found " + text, text.equals("alert")); text = getHiddenText(notification .findElements(By.className("v-assistive-device-only")).get(0)); - Assert.assertTrue("Expected 'Prefix:', found " + text, - text.equals("Prefix:")); + assertTrue("Expected 'Prefix:', found " + text, text.equals("Prefix:")); text = getHiddenText(notification .findElements(By.className("v-assistive-device-only")).get(1)); - Assert.assertTrue("Expected '- press ESC to close', found " + text, + assertTrue("Expected '- press ESC to close', found " + text, text.equals("- press ESC to close")); notification.close(); @@ -92,8 +92,7 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest { notification = $(NotificationElement.class).first(); text = notification.getAttribute("role"); - Assert.assertTrue( - "Expected attribute 'role' to equal 'status', found " + text, + assertTrue("Expected attribute 'role' to equal 'status', found " + text, text.equals("status")); notification.close(); @@ -111,8 +110,7 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest { } catch (Exception e) { element = null; } - Assert.assertNull( - "Notification shouldn't have assistive-device-only spans", + assertNull("Notification shouldn't have assistive-device-only spans", element); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroupTest.java b/uitest/src/test/java/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroupTest.java index 760f333936..d921cd1bbc 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroupTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroupTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.optiongroup; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -40,7 +41,7 @@ public class ReadOnlyOptionGroupTest extends MultiBrowserTest { assertNoErrorNotifications(); - Assert.assertFalse( + assertFalse( "Radio button in option group is still disabled " + "after unset reaonly", isElementPresent(By.className("v-radiobutton-disabled"))); diff --git a/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/HorizontalLayoutFullsizeContentWithErrorMsgTest.java b/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/HorizontalLayoutFullsizeContentWithErrorMsgTest.java index d39ab871d4..4b69bbb1aa 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/HorizontalLayoutFullsizeContentWithErrorMsgTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/HorizontalLayoutFullsizeContentWithErrorMsgTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.orderedlayout; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Point; @@ -38,11 +39,11 @@ public class HorizontalLayoutFullsizeContentWithErrorMsgTest errorToggleButton.click(); - Assert.assertEquals(location, element.getLocation()); + assertEquals(location, element.getLocation()); errorToggleButton.click(); - Assert.assertEquals(location, element.getLocation()); + assertEquals(location, element.getLocation()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java b/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java index 3617c00c08..aed6d718ea 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.orderedlayout; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; @@ -42,8 +43,8 @@ public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest { new Actions(getDriver()).moveToElement(tf2).click().build().perform(); WebElement activeElement = getFocusedElement(); - Assert.assertEquals("input", activeElement.getTagName()); - Assert.assertEquals("", activeElement.getAttribute("value")); + assertEquals("input", activeElement.getTagName()); + assertEquals("", activeElement.getAttribute("value")); tf1.sendKeys(incrementalText); new Actions(getDriver()) @@ -51,11 +52,10 @@ public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest { getDriver().findElement(By.className("v-button"))) .click().build().perform(); activeElement = getFocusedElement(); - Assert.assertEquals("Just a button", activeElement.getText()); + assertEquals("Just a button", activeElement.getText()); DesiredCapabilities capabilities = getDesiredCapabilities(); - Assert.assertEquals(initialText + incrementalText, - tf1.getAttribute("value")); + assertEquals(initialText + incrementalText, tf1.getAttribute("value")); } @Test @@ -74,11 +74,11 @@ public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest { new Actions(getDriver()).moveToElement(tf2).click().build().perform(); WebElement activeElement = getFocusedElement(); - Assert.assertEquals("input", activeElement.getTagName()); - Assert.assertEquals(firstText, activeElement.getAttribute("value")); + assertEquals("input", activeElement.getTagName()); + assertEquals(firstText, activeElement.getAttribute("value")); new Actions(getDriver()).sendKeys(secondText).build().perform(); DesiredCapabilities capabilities = getDesiredCapabilities(); - Assert.assertEquals(firstText + secondText, tf2.getAttribute("value")); + assertEquals(firstText + secondText, tf2.getAttribute("value")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/page/PageTitleTest.java b/uitest/src/test/java/com/vaadin/tests/components/page/PageTitleTest.java index 766f42a378..5c82e9a8a6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/page/PageTitleTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/page/PageTitleTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.page; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -25,12 +26,12 @@ public class PageTitleTest extends MultiBrowserTest { @Test public void nullTitle() { driver.get(getTestUrl()); - Assert.assertEquals(PageTitle.class.getName(), driver.getTitle()); + assertEquals(PageTitle.class.getName(), driver.getTitle()); } @Test public void fooTitle() { driver.get(getTestUrl() + "?title=foo"); - Assert.assertEquals("foo", driver.getTitle()); + assertEquals("foo", driver.getTitle()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/panel/PanelChangeContentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/panel/PanelChangeContentsTest.java index 8b20a4d889..0730ebdb71 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/panel/PanelChangeContentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/panel/PanelChangeContentsTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.panel; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -27,24 +28,21 @@ public class PanelChangeContentsTest extends MultiBrowserTest { setPush(true); openTestURL(); - Assert.assertEquals("stats", - vaadinElement( - "/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]") - .getText()); + assertEquals("stats", vaadinElement( + "/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]") + .getText()); vaadinElement( "/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]") .click(); - Assert.assertEquals("companies", - vaadinElement( - "/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]") - .getText()); + assertEquals("companies", vaadinElement( + "/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]") + .getText()); vaadinElement( "/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]") .click(); - Assert.assertEquals("stats", - vaadinElement( - "/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]") - .getText()); + assertEquals("stats", vaadinElement( + "/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]") + .getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/popupview/PopupViewCaptionTest.java b/uitest/src/test/java/com/vaadin/tests/components/popupview/PopupViewCaptionTest.java index 80dbb26320..cf373f27d0 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/popupview/PopupViewCaptionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/popupview/PopupViewCaptionTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.components.popupview; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -35,7 +37,7 @@ public class PopupViewCaptionTest extends MultiBrowserTest { openTestURL(); WebElement caption = driver.findElement(By.className("v-caption")); - Assert.assertNotNull(caption); + assertNotNull(caption); List<WebElement> elements = caption.findElements(By.xpath("*")); @@ -46,7 +48,7 @@ public class PopupViewCaptionTest extends MultiBrowserTest { break; } } - Assert.assertTrue("Unable to find caption text", foundCaptionText); + assertTrue("Unable to find caption text", foundCaptionText); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/popupview/PopupViewShortcutActionHandlerTest.java b/uitest/src/test/java/com/vaadin/tests/components/popupview/PopupViewShortcutActionHandlerTest.java index 63a0d71caa..8e8e0244c6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/popupview/PopupViewShortcutActionHandlerTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/popupview/PopupViewShortcutActionHandlerTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.popupview; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -44,7 +45,7 @@ public class PopupViewShortcutActionHandlerTest extends MultiBrowserTest { .findElement(By.className("v-textfield")); textField.sendKeys("a", Keys.ENTER); - Assert.assertTrue( + assertTrue( "Unable to find label component which is the result of" + " shortcut action handling.", isElementPresent(By.className("shortcut-result"))); diff --git a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/DisabledRadioButtonGroupTest.java b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/DisabledRadioButtonGroupTest.java index 67867eff11..71e4843814 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/DisabledRadioButtonGroupTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/DisabledRadioButtonGroupTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.radiobuttongroup; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.RadioButtonGroupElement; @@ -34,10 +35,10 @@ public class DisabledRadioButtonGroupTest extends MultiBrowserTest { openTestURL(); List<String> options = $(RadioButtonGroupElement.class).first() .getOptions(); - Assert.assertEquals(3, options.size()); - Assert.assertEquals("a", options.get(0)); - Assert.assertEquals("b", options.get(1)); - Assert.assertEquals("c", options.get(2)); + assertEquals(3, options.size()); + assertEquals("a", options.get(0)); + assertEquals("b", options.get(1)); + assertEquals("c", options.get(2)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusBlurTest.java b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusBlurTest.java index 8ee0932e88..d9ce2d649e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusBlurTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusBlurTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.components.radiobuttongroup; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -46,11 +48,11 @@ public class RadioButtonGroupFocusBlurTest extends MultiBrowserTest { radioButtonGroup.selectByText("1"); // Focus event is fired - Assert.assertTrue(logContainsText("1. Focus Event")); + assertTrue(logContainsText("1. Focus Event")); radioButtonGroup.selectByText("2"); // click on the second radio button doesn't fire anything - Assert.assertFalse(logContainsText("2.")); + assertFalse(logContainsText("2.")); // move the cursor to the middle of the first element, // offset to the middle of the two and perform click @@ -60,26 +62,26 @@ public class RadioButtonGroupFocusBlurTest extends MultiBrowserTest { - radioButtons.get(0).getLocation().y) / 2) .click().build().perform(); // no new events - Assert.assertFalse(logContainsText("2.")); + assertFalse(logContainsText("2.")); // click to label of a radio button radioButtonGroup.findElements(By.tagName("label")).get(2).click(); // no new events - Assert.assertFalse(logContainsText("2.")); + assertFalse(logContainsText("2.")); // click on log label => blur $(LabelElement.class).first().click(); // blur event is fired - Assert.assertTrue(logContainsText("2. Blur Event")); + assertTrue(logContainsText("2. Blur Event")); radioButtonGroup.selectByText("4"); // Focus event is fired - Assert.assertTrue(logContainsText("3. Focus Event")); + assertTrue(logContainsText("3. Focus Event")); // move keyboard focus to the next radio button radioButtons.get(3).sendKeys(Keys.ARROW_DOWN); // no new events - Assert.assertFalse(logContainsText("4.")); + assertFalse(logContainsText("4.")); // select the next radio button radioButtons.get(4).sendKeys(Keys.TAB); diff --git a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupInGridLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupInGridLayoutTest.java index 5d7aa373f4..a10e858377 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupInGridLayoutTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupInGridLayoutTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.radiobuttongroup; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.GridLayoutElement; @@ -27,6 +28,6 @@ public class RadioButtonGroupInGridLayoutTest extends MultiBrowserTest { ok = (before == after + 4); } - Assert.assertTrue("GridLayout size changed when selecting a value", ok); + assertTrue("GridLayout size changed when selecting a value", ok); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupTest.java b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupTest.java index 503d2d7692..81fd4904fd 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupTest.java @@ -90,20 +90,20 @@ public class RadioButtonGroupTest extends MultiBrowserTest { selectMenuPath("Component", "Listeners", "Selection listener"); getSelect().selectByText("Item 4"); - Assert.assertEquals("1. Selected: Optional[Item 4]", getLogRow(0)); + assertEquals("1. Selected: Optional[Item 4]", getLogRow(0)); getSelect().selectByText("Item 2"); - Assert.assertEquals("2. Selected: Optional[Item 2]", getLogRow(0)); + assertEquals("2. Selected: Optional[Item 2]", getLogRow(0)); getSelect().selectByText("Item 4"); - Assert.assertEquals("3. Selected: Optional[Item 4]", getLogRow(0)); + assertEquals("3. Selected: Optional[Item 4]", getLogRow(0)); } @Test public void disabled_clickToSelect() { selectMenuPath("Component", "State", "Enabled"); - Assert.assertTrue(getSelect().findElements(By.tagName("input")).stream() + assertTrue(getSelect().findElements(By.tagName("input")).stream() .allMatch(element -> element.getAttribute("disabled") != null)); selectMenuPath("Component", "Listeners", "Selection listener"); @@ -111,13 +111,13 @@ public class RadioButtonGroupTest extends MultiBrowserTest { String lastLogRow = getLogRow(0); getSelect().selectByText("Item 4"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); getSelect().selectByText("Item 2"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); getSelect().selectByText("Item 4"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); } @Test @@ -132,7 +132,7 @@ public class RadioButtonGroupTest extends MultiBrowserTest { assertEquals(20, icons.size()); for (int i = 0; i < icons.size(); i++) { - Assert.assertEquals(VaadinIcons.values()[i + 1].getCodepoint(), + assertEquals(VaadinIcons.values()[i + 1].getCodepoint(), icons.get(i).getText().charAt(0)); } } @@ -147,13 +147,13 @@ public class RadioButtonGroupTest extends MultiBrowserTest { selectMenuPath("Component", "State", "Enabled"); getSelect().selectByText("Item 5"); - Assert.assertEquals("3. Selected: Optional[Item 5]", getLogRow(0)); + assertEquals("3. Selected: Optional[Item 5]", getLogRow(0)); getSelect().selectByText("Item 2"); - Assert.assertEquals("4. Selected: Optional[Item 2]", getLogRow(0)); + assertEquals("4. Selected: Optional[Item 2]", getLogRow(0)); getSelect().selectByText("Item 4"); - Assert.assertEquals("5. Selected: Optional[Item 4]", getLogRow(0)); + assertEquals("5. Selected: Optional[Item 4]", getLogRow(0)); } @Test @@ -168,7 +168,7 @@ public class RadioButtonGroupTest extends MultiBrowserTest { selectMenuPath("Component", "Item Caption Generator", "Item Caption Generator", "Null Caption Generator"); for (String text : getSelect().getOptions()) { - Assert.assertEquals("", text); + assertEquals("", text); } } @@ -177,16 +177,16 @@ public class RadioButtonGroupTest extends MultiBrowserTest { selectMenuPath("Component", "Listeners", "Selection listener"); selectMenuPath("Component", "Selection", "Toggle Item 5"); - Assert.assertEquals("2. Selected: Optional[Item 5]", getLogRow(0)); + assertEquals("2. Selected: Optional[Item 5]", getLogRow(0)); assertSelected("Item 5"); selectMenuPath("Component", "Selection", "Toggle Item 1"); - Assert.assertEquals("4. Selected: Optional[Item 1]", getLogRow(0)); + assertEquals("4. Selected: Optional[Item 1]", getLogRow(0)); // DOM order assertSelected("Item 1"); selectMenuPath("Component", "Selection", "Toggle Item 5"); - Assert.assertEquals("6. Selected: Optional[Item 5]", getLogRow(0)); + assertEquals("6. Selected: Optional[Item 5]", getLogRow(0)); assertSelected("Item 5"); } @@ -199,7 +199,7 @@ public class RadioButtonGroupTest extends MultiBrowserTest { label = (TestBenchElement) findElements(By.tagName("label")).get(5); label.showTooltip(); - Assert.assertEquals("Tooltip should contain the same text as caption", + assertEquals("Tooltip should contain the same text as caption", label.getText(), getTooltipElement().getText()); selectMenuPath("Component", "Item Description Generator", @@ -207,13 +207,13 @@ public class RadioButtonGroupTest extends MultiBrowserTest { label = (TestBenchElement) findElements(By.tagName("label")).get(5); label.showTooltip(); - Assert.assertEquals("Tooltip should contain caption + ' Description'", + assertEquals("Tooltip should contain caption + ' Description'", label.getText() + " Description", getTooltipElement().getText()); } private void assertSelected(String expectedSelection) { - Assert.assertEquals(expectedSelection, getSelect().getValue()); + assertEquals(expectedSelection, getSelect().getValue()); } @Override diff --git a/uitest/src/test/java/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.java b/uitest/src/test/java/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.java index edeeec96fc..f086031820 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.richtextarea; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.By; @@ -45,9 +47,9 @@ public class RichTextAreaRelativeHeightResizeTest extends MultiBrowserTest { // Check that the component height changed and that the editor height // changed equally as much - Assert.assertTrue("RichTextArea height didn't change", + assertTrue("RichTextArea height didn't change", newHeight != originalHeight); - Assert.assertEquals( + assertEquals( "Editor height change didn't match the Component height change", newHeight - originalHeight, newEditorHeight - originalEditorHeight); diff --git a/uitest/src/test/java/com/vaadin/tests/components/select/EnumSelectTest.java b/uitest/src/test/java/com/vaadin/tests/components/select/EnumSelectTest.java index 0e64b0c9f9..9a15ace088 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/select/EnumSelectTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/select/EnumSelectTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.select; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.By; @@ -33,8 +34,8 @@ public class EnumSelectTest extends SingleBrowserTest { openTestURL(); NativeSelectElement ns = $(NativeSelectElement.class).first(); List<TestBenchElement> options = ns.getOptions(); - Assert.assertEquals("Some value", options.get(1).getText()); - Assert.assertEquals("Some other value", options.get(2).getText()); + assertEquals("Some value", options.get(1).getText()); + assertEquals("Some other value", options.get(2).getText()); } @Test @@ -43,8 +44,8 @@ public class EnumSelectTest extends SingleBrowserTest { ComboBoxElement cb = $(ComboBoxElement.class).first(); cb.openPopup(); List<String> options = cb.getPopupSuggestions(); - Assert.assertEquals("Some value", options.get(1)); - Assert.assertEquals("Some other value", options.get(2)); + assertEquals("Some value", options.get(1)); + assertEquals("Some other value", options.get(2)); } @Test @@ -53,9 +54,8 @@ public class EnumSelectTest extends SingleBrowserTest { ComboBoxElement cb = $(ComboBoxElement.class).first(); cb.findElement(By.vaadin("#textbox")).sendKeys(" other "); List<String> options = cb.getPopupSuggestions(); - Assert.assertEquals("Only one item should match filter", 1, - options.size()); - Assert.assertEquals("Invalid option matched filter", "Some other value", + assertEquals("Only one item should match filter", 1, options.size()); + assertEquals("Invalid option matched filter", "Some other value", options.get(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/select/SelectWithIntegersTest.java b/uitest/src/test/java/com/vaadin/tests/components/select/SelectWithIntegersTest.java index b2b9a3e153..b0f175258e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/select/SelectWithIntegersTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/select/SelectWithIntegersTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.select; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ListSelectElement; @@ -31,7 +32,7 @@ public class SelectWithIntegersTest extends SingleBrowserTest { ListSelectElement toStringSelect = $(ListSelectElement.class) .caption("ID_TOSTRING").first(); - Assert.assertEquals("2,014", defaultSelect.getOptions().get(0)); - Assert.assertEquals("2014", toStringSelect.getOptions().get(0)); + assertEquals("2,014", defaultSelect.getOptions().get(0)); + assertEquals("2014", toStringSelect.getOptions().get(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckboxTest.java b/uitest/src/test/java/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckboxTest.java index 1e0363717d..7a983d3677 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckboxTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckboxTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.splitpanel; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; @@ -65,10 +66,10 @@ public class GridLayoutWithCheckboxTest extends MultiBrowserTest { cbSize = cb.getSize(); cbSlotSize = cbSlot.getSize(); } else { - Assert.assertEquals(tfSize, tf.getSize()); - Assert.assertEquals(tfSlotSize, tfSlot.getSize()); - Assert.assertEquals(cbSize, cb.getSize()); - Assert.assertEquals(cbSlotSize, cbSlot.getSize()); + assertEquals(tfSize, tf.getSize()); + assertEquals(tfSlotSize, tfSlot.getSize()); + assertEquals(cbSize, cb.getSize()); + assertEquals(cbSlotSize, cbSlot.getSize()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/splitpanel/HorizontalSplitPanelHeightTest.java b/uitest/src/test/java/com/vaadin/tests/components/splitpanel/HorizontalSplitPanelHeightTest.java index 3ea404f104..c8398e3504 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/splitpanel/HorizontalSplitPanelHeightTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/splitpanel/HorizontalSplitPanelHeightTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.splitpanel; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -60,13 +62,13 @@ public class HorizontalSplitPanelHeightTest extends MultiBrowserTest { private void testSplitPanel(String id) { WebElement splitPanel = findElement(By.id(id)); WebElement label = splitPanel.findElement(By.className("target")); - Assert.assertTrue( + assertTrue( id + ": split panel height (" + splitPanel.getSize().getHeight() + ") is less than " + "height of second component (" + label.getSize().getHeight() + ")", splitPanel.getSize().getHeight() >= label.getSize() .getHeight()); - Assert.assertEquals("Label text in the second panel is not visible", - "Label", label.getText()); + assertEquals("Label text in the second panel is not visible", "Label", + label.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponentTest.java b/uitest/src/test/java/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponentTest.java index 8fe71c4623..8ab9b8c8c5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponentTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.splitpanel; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -29,11 +30,11 @@ public class SplitPanelMoveComponentTest extends MultiBrowserTest { @Test public void moveComponent() { openTestURL(); - Assert.assertEquals(BUTTON_TEXT, getFirstChild().getText()); + assertEquals(BUTTON_TEXT, getFirstChild().getText()); getFirstChild().click(); - Assert.assertEquals(BUTTON_TEXT, getSecondChild().getText()); + assertEquals(BUTTON_TEXT, getSecondChild().getText()); getSecondChild().click(); - Assert.assertEquals(BUTTON_TEXT, getFirstChild().getText()); + assertEquals(BUTTON_TEXT, getFirstChild().getText()); } private WebElement getFirstChild() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/splitpanel/SplitPositionChangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/splitpanel/SplitPositionChangeTest.java index c194ee69db..89fba2a13b 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/splitpanel/SplitPositionChangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/splitpanel/SplitPositionChangeTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.splitpanel; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -66,7 +68,7 @@ public class SplitPositionChangeTest extends MultiBrowserTest { } private void assertPosition(int original, int current) { - Assert.assertFalse("Position didn't change", original == current); + assertFalse("Position didn't change", original == current); } private void assertLogText(boolean horizontal) { @@ -74,7 +76,7 @@ public class SplitPositionChangeTest extends MultiBrowserTest { "1. Split position changed: %s, position: .*", horizontal ? "horizontal" : "vertical"); String actual = getLogRow(0); - Assert.assertTrue(String.format( + assertTrue(String.format( "Log content didn't match the expected format.\nexpected: '%s'\nwas: '%s'", expected, actual), actual.matches(expected)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/AddSelectionToRemovedRangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/AddSelectionToRemovedRangeTest.java index 67d8d3bfb8..e01696a4b6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/AddSelectionToRemovedRangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/AddSelectionToRemovedRangeTest.java @@ -15,10 +15,11 @@ */ package com.vaadin.tests.components.table; +import static org.junit.Assert.fail; + import java.io.IOException; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.NoSuchElementException; @@ -61,7 +62,7 @@ public class AddSelectionToRemovedRangeTest extends MultiBrowserTest { driver.findElement(By.className("v-button")).click(); try { driver.findElement(By.vaadin("Root/VNotification[0]")); - Assert.fail("Notification is shown"); + fail("Notification is shown"); } catch (NoSuchElementException e) { // All is well. } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/AsyncPushUpdatesTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/AsyncPushUpdatesTest.java index 38beca87aa..96e2d0fe17 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/AsyncPushUpdatesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/AsyncPushUpdatesTest.java @@ -15,13 +15,14 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.fail; + import org.junit.Test; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.tests.tb3.MultiBrowserTest; /** @@ -40,7 +41,7 @@ public class AsyncPushUpdatesTest extends MultiBrowserTest { button.click(); $(TableElement.class).first().getCell(12, 0); - Assert.fail("Duplicates are present."); + fail("Duplicates are present."); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java index d7d0b1c201..7e5c731442 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java @@ -15,16 +15,17 @@ */ package com.vaadin.tests.components.table; +import static org.junit.Assert.assertEquals; + import java.io.IOException; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; import com.vaadin.testbench.TestBenchElement; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.TableElement.ContextMenuElement; import com.vaadin.testbench.parallel.BrowserUtil; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -83,22 +84,22 @@ public class ColumnCollapsingAndColumnExpansionTest extends MultiBrowserTest { // Through menu table.openCollapseMenu().getItem(0).click(); - Assert.assertEquals("1. Collapse state for Col1 changed to true", + assertEquals("1. Collapse state for Col1 changed to true", getLogRow(0)); // Through button $(ButtonElement.class).caption("Collapse Col2").first().click(); - Assert.assertEquals("2. Collapse state for Col2 changed to true", + assertEquals("2. Collapse state for Col2 changed to true", getLogRow(0)); // Show through menu table.openCollapseMenu().getItem(1).click(); - Assert.assertEquals("3. Collapse state for Col1 changed to false", + assertEquals("3. Collapse state for Col1 changed to false", getLogRow(0)); // Show through button $(ButtonElement.class).caption("Show Col2").first().click(); - Assert.assertEquals("4. Collapse state for Col2 changed to false", + assertEquals("4. Collapse state for Col2 changed to false", getLogRow(0)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/ContainerSizeChangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/ContainerSizeChangeTest.java index 0f8050d804..2937e487a4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/ContainerSizeChangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/ContainerSizeChangeTest.java @@ -1,8 +1,8 @@ package com.vaadin.tests.components.table; -import static junit.framework.TestCase.fail; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.fail; import java.io.IOException; @@ -10,8 +10,8 @@ import org.junit.Test; import org.openqa.selenium.NoSuchElementException; import com.vaadin.testbench.By; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.tests.tb3.MultiBrowserTest; public class ContainerSizeChangeTest extends MultiBrowserTest { diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/DndTableTargetDetailsTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/DndTableTargetDetailsTest.java index 741d5d7b5b..ec099b0149 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/DndTableTargetDetailsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/DndTableTargetDetailsTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.table; +import static org.junit.Assert.assertEquals; + import java.io.IOException; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -41,7 +42,7 @@ public class DndTableTargetDetailsTest extends DndActionsTest { dragAndDrop(row, getTarget()); WebElement label = findElement(By.className("dnd-button-name")); - Assert.assertEquals("Button name=left", label.getText()); + assertEquals("Button name=left", label.getText()); } protected WebElement getTarget() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/EmptyTableTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/EmptyTableTest.java index 4be5c19985..2a9b79cd73 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/EmptyTableTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/EmptyTableTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.fail; + import org.junit.Test; import com.vaadin.testbench.elements.NotificationElement; @@ -33,7 +34,7 @@ public class EmptyTableTest extends MultiBrowserTest { private void ensureNoErrors() { if (isElementPresent(NotificationElement.class)) { - Assert.fail("Error notification was shown!"); + fail("Error notification was shown!"); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/FocusOnSelectedItemTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/FocusOnSelectedItemTest.java index c0588eb932..5ae5bc4697 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/FocusOnSelectedItemTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/FocusOnSelectedItemTest.java @@ -15,13 +15,14 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.tests.tb3.MultiBrowserTest; /** @@ -43,23 +44,22 @@ public class FocusOnSelectedItemTest extends MultiBrowserTest { WebElement selectedRow = null; WebElement focusedStyleRow = null; - Assert.assertTrue("No row was selected", + assertTrue("No row was selected", isElementPresent(By.className("v-selected"))); selectedRow = getDriver().findElement(By.className("v-selected")); supposedlyFocusedRow = $(TableElement.class).first().getCell(198, 0); - Assert.assertTrue("Incorrect row was selected", - selectedRow.getLocation().getY() == supposedlyFocusedRow - .getLocation().getY()); + assertTrue("Incorrect row was selected", selectedRow.getLocation() + .getY() == supposedlyFocusedRow.getLocation().getY()); - Assert.assertTrue("No row had the focused style.", + assertTrue("No row had the focused style.", isElementPresent(By.className("v-table-focus"))); focusedStyleRow = getDriver() .findElement(By.className("v-table-focus")); - Assert.assertTrue("Incorrect row has the focused style.", selectedRow + assertTrue("Incorrect row has the focused style.", selectedRow .getLocation().getY() == focusedStyleRow.getLocation().getY()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/LeftColumnAlignmentTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/LeftColumnAlignmentTest.java index b0da36c6fb..62af1daa39 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/LeftColumnAlignmentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/LeftColumnAlignmentTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -38,20 +40,19 @@ public class LeftColumnAlignmentTest extends MultiBrowserTest { WebElement webElement = driver.findElement(By.className("v-button")); webElement.click(); - Assert.assertTrue("Table caption is not aligned to the left", - isElementPresent( - By.className("v-table-caption-container-align-left"))); + assertTrue("Table caption is not aligned to the left", isElementPresent( + By.className("v-table-caption-container-align-left"))); WebElement footer = driver .findElement(By.className("v-table-footer-container")); - Assert.assertEquals("Table footer is not aligned to the left", "left", + assertEquals("Table footer is not aligned to the left", "left", footer.getCssValue("text-align")); WebElement cell = driver .findElement(By.className("v-table-cell-wrapper")); - Assert.assertEquals("Table cell is not aligned to the left", "left", + assertEquals("Table cell is not aligned to the left", "left", cell.getCssValue("text-align")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/OnlyCollapsibleInMenu.java b/uitest/src/test/java/com/vaadin/tests/components/table/OnlyCollapsibleInMenu.java index f87ee0102e..303e5e2e98 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/OnlyCollapsibleInMenu.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/OnlyCollapsibleInMenu.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.TableElement; @@ -36,19 +37,19 @@ public class OnlyCollapsibleInMenu extends SingleBrowserTest { selectMenuPath("Component", "Columns", "Property 3", "Collapsible"); table.getCollapseMenuToggle().click(); - Assert.assertEquals("Property 3 should still be in the context menu", + assertEquals("Property 3 should still be in the context menu", "Property 3", table.getContextMenu().getItem(2).getText()); selectMenuPath("Component", "Features", "Collapsible menu content", CollapseMenuContent.COLLAPSIBLE_COLUMNS.toString()); table.getCollapseMenuToggle().click(); - Assert.assertEquals("Property 3 should not be in the context menu", + assertEquals("Property 3 should not be in the context menu", "Property 4", table.getContextMenu().getItem(2).getText()); selectMenuPath("Component", "Features", "Collapsible menu content", CollapseMenuContent.ALL_COLUMNS.toString()); table.getCollapseMenuToggle().click(); - Assert.assertEquals("Property 3 should again be in the context menu", + assertEquals("Property 3 should again be in the context menu", "Property 3", table.getContextMenu().getItem(2).getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/ReloadWidgetsTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/ReloadWidgetsTest.java index e201b2ad96..49e356e3ce 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/ReloadWidgetsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/ReloadWidgetsTest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.components.table; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -38,7 +39,7 @@ public class ReloadWidgetsTest extends MultiBrowserTest { waitForScrollToFinish(); // Assert that we have the button widget. - Assert.assertTrue( + assertTrue( "Button widget was not found after scrolling for the first time", !findElements(By.id("46")).isEmpty()); @@ -51,7 +52,7 @@ public class ReloadWidgetsTest extends MultiBrowserTest { waitForScrollToFinish(); // Assert that we still get the button - Assert.assertTrue( + assertTrue( "Button widget was not found after refreshing container items.", !findElements(By.id("46")).isEmpty()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/SelectableEditableTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/SelectableEditableTest.java index 8b5b54cfaa..a161107f25 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/SelectableEditableTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/SelectableEditableTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.TableElement; @@ -12,7 +13,7 @@ public class SelectableEditableTest extends MultiBrowserTest { openTestURL(); TableElement table = $(TableElement.class).first(); table.getCell(0, 1).click(70, 12); - Assert.assertTrue("Element does not have the 'v-selected' css class", + assertTrue("Element does not have the 'v-selected' css class", hasCssClass(table.getRow(0), "v-selected")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndexTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndexTest.java index 4926c653fa..681fe59e1c 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndexTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndexTest.java @@ -17,18 +17,17 @@ package com.vaadin.tests.components.table; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.fail; import org.junit.Ignore; import org.junit.Test; import org.openqa.selenium.NoSuchElementException; import com.vaadin.testbench.TestBenchElement; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.tests.tb3.MultiBrowserTest; -import junit.framework.Assert; - /** * * @since @@ -57,7 +56,7 @@ public class SetCurrentPageFirstItemIndexTest extends MultiBrowserTest { assertThat(cell.getText(), is(Integer.toString(index + 1))); } catch (NoSuchElementException e) { - Assert.fail(String.format("Can't locate row for index: %s", index)); + fail(String.format("Can't locate row for index: %s", index)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/SortableHeaderStylesTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/SortableHeaderStylesTest.java index 53d4cfb849..019dc20793 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/SortableHeaderStylesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/SortableHeaderStylesTest.java @@ -15,11 +15,13 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.OptionGroupElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.tests.tb3.SingleBrowserTest; public class SortableHeaderStylesTest extends SingleBrowserTest { @@ -27,9 +29,9 @@ public class SortableHeaderStylesTest extends SingleBrowserTest { public void testSortableHeaderStyles() { openTestURL(); - Assert.assertFalse(hasSortableStyle(0)); + assertFalse(hasSortableStyle(0)); for (int i = 1; i < 8; i++) { - Assert.assertTrue(hasSortableStyle(i)); + assertTrue(hasSortableStyle(i)); } OptionGroupElement sortableSelector = $(OptionGroupElement.class) @@ -37,11 +39,11 @@ public class SortableHeaderStylesTest extends SingleBrowserTest { // Toggle sortability sortableSelector.selectByText("lastName"); - Assert.assertFalse(hasSortableStyle(3)); + assertFalse(hasSortableStyle(3)); // Toggle back sortableSelector.selectByText("lastName"); - Assert.assertTrue(hasSortableStyle(3)); + assertTrue(hasSortableStyle(3)); } private boolean hasSortableStyle(int column) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java index ceff8c1d82..0a8d7434f3 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.TableElement; @@ -44,7 +45,7 @@ public class TableColumnWidthsAndSortingTest extends MultiBrowserTest { // Assert all headers are correct height (37px according to default // Valo) for (int i = 0; i < 5; i++) { - Assert.assertEquals("Height of header cell " + i + " is wrong", 37, + assertEquals("Height of header cell " + i + " is wrong", 37, t.getHeaderCell(0).getSize().getHeight()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableDragColumnTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableDragColumnTest.java index fe061ae3e0..320a25686f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableDragColumnTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableDragColumnTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; @@ -46,14 +48,14 @@ public class TableDragColumnTest extends MultiBrowserTest { new Actions(getDriver()).moveToElement(dragged).clickAndHold() .moveByOffset(-6, 0).perform(); - Assert.assertTrue("No drag element visible", + assertTrue("No drag element visible", isElementPresent(By.className("v-table-header-drag"))); WebElement dragImage = findElement(By.className("v-table-header-drag")); String cellContent = dragged.getText(); - Assert.assertEquals("Drag image had different content than header cell", + assertEquals("Drag image had different content than header cell", cellContent, dragImage.getText()); - Assert.assertEquals("Drag image had different icon", imgSrc, + assertEquals("Drag image had different icon", imgSrc, dragImage.findElement(By.tagName("img")).getAttribute("src")); TableHeaderElement target = table.getHeaderCell(3); @@ -62,9 +64,9 @@ public class TableDragColumnTest extends MultiBrowserTest { .perform(); dragged = table.getHeaderCell(3); - Assert.assertEquals("Column was not dropped where expected.", - cellContent, dragged.getText()); - Assert.assertEquals("Drag image had different icon", imgSrc, + assertEquals("Column was not dropped where expected.", cellContent, + dragged.getText()); + assertEquals("Drag image had different icon", imgSrc, dragged.findElement(By.tagName("img")).getAttribute("src")); } @@ -89,14 +91,14 @@ public class TableDragColumnTest extends MultiBrowserTest { new Actions(getDriver()).moveToElement(dragged).clickAndHold() .moveByOffset(-6, 0).perform(); - Assert.assertTrue("No drag element visible", + assertTrue("No drag element visible", isElementPresent(By.className("v-table-header-drag"))); WebElement dragImage = findElement(By.className("v-table-header-drag")); String cellContent = dragged.getText(); - Assert.assertEquals("Drag image had different content than header cell", + assertEquals("Drag image had different content than header cell", cellContent, dragImage.getText()); - Assert.assertTrue("Missing CSS class " + styleName, + assertTrue("Missing CSS class " + styleName, hasCssClass(dragImage, styleName)); new Actions(getDriver()).release().perform(); diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableParentEnabledStateChangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableParentEnabledStateChangeTest.java index 3468060fa5..bb3c4b2a48 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableParentEnabledStateChangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableParentEnabledStateChangeTest.java @@ -15,11 +15,13 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.TableRowElement; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -34,19 +36,19 @@ public class TableParentEnabledStateChangeTest extends SingleBrowserTest { ButtonElement button = $(ButtonElement.class).first(); row.click(); - Assert.assertTrue(isSelected(row)); + assertTrue(isSelected(row)); // Disable button.click(); - Assert.assertTrue(isSelected(row)); + assertTrue(isSelected(row)); row.click(); // Should have no effect - Assert.assertTrue(isSelected(row)); + assertTrue(isSelected(row)); // Enable button.click(); - Assert.assertTrue(isSelected(row)); + assertTrue(isSelected(row)); row.click(); // Should deselect - Assert.assertFalse(isSelected(row)); + assertFalse(isSelected(row)); } private boolean isSelected(TableRowElement row) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableRequiredIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableRequiredIndicatorTest.java index 793b639e74..893e5d5da6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableRequiredIndicatorTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableRequiredIndicatorTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; @@ -32,7 +33,7 @@ public class TableRequiredIndicatorTest extends MultiBrowserTest { @Test public void testRequiredIndicatorIsVisible() { openTestURL(); - Assert.assertTrue( + assertTrue( isElementPresent(By.className("v-required-field-indicator"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java index a2a0ae0340..a74f53c0a2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java @@ -16,8 +16,8 @@ package com.vaadin.tests.components.table; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -61,7 +61,7 @@ public class TableScrollAfterAddRowTest extends MultiBrowserTest { scrollUp(); addRow(); sleep(200); - Assert.assertNotEquals("86", getCurrentPageFirstItemIndex()); + assertNotEquals("86", getCurrentPageFirstItemIndex()); } private void scrollUp() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableScrollUpOnSelectTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableScrollUpOnSelectTest.java index 5c5d2b1719..c0ae0945ab 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableScrollUpOnSelectTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableScrollUpOnSelectTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -54,6 +55,6 @@ public class TableScrollUpOnSelectTest extends MultiBrowserTest { row.click(); int newRowLocation = row.getLocation().getY(); - Assert.assertTrue("Table has scrolled.", rowLocation == newRowLocation); + assertTrue("Table has scrolled.", rowLocation == newRowLocation); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java index 7fa430208f..5646ed96d3 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java @@ -17,8 +17,8 @@ package com.vaadin.tests.components.table; import static com.vaadin.tests.components.table.TableSizeInTabsheet.TABLE; import static com.vaadin.tests.components.table.TableSizeInTabsheet.TABSHEET; +import static org.junit.Assert.assertEquals; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -35,7 +35,7 @@ public class TableSizeInTabsheetTest extends MultiBrowserTest { int tableHeight = getTableHeigth(); int tabSheetContentHeight = getTableSheetContentHeight(); - Assert.assertEquals(tableHeight, tabSheetContentHeight); + assertEquals(tableHeight, tabSheetContentHeight); } private int getTableHeigth() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableSortingIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableSortingIndicatorTest.java index b3ab909d47..ca307c0189 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableSortingIndicatorTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableSortingIndicatorTest.java @@ -15,11 +15,13 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.tests.tb3.MultiBrowserTest; /** @@ -39,28 +41,28 @@ public class TableSortingIndicatorTest extends MultiBrowserTest { ButtonElement button = $(ButtonElement.class).caption("Sort").first(); TableElement table = $(TableElement.class).first(); - Assert.assertFalse("Descending indicator was prematurely visible", + assertFalse("Descending indicator was prematurely visible", getHeaderClasses(table).contains(TABLE_HEADER_DESC_INDICATOR)); - Assert.assertFalse("Ascending indicator was prematurely visible", + assertFalse("Ascending indicator was prematurely visible", getHeaderClasses(table).contains(TABLE_HEADER_ASC_INDICATOR)); button.click(); - Assert.assertTrue("Indicator did not become visible", + assertTrue("Indicator did not become visible", getHeaderClasses(table).contains(TABLE_HEADER_DESC_INDICATOR)); - Assert.assertFalse("Ascending sort indicator was wrongly visible", + assertFalse("Ascending sort indicator was wrongly visible", getHeaderClasses(table).contains(TABLE_HEADER_ASC_INDICATOR)); table.getHeaderCell(0).click(); - Assert.assertFalse("Table sort indicator didn't change", + assertFalse("Table sort indicator didn't change", getHeaderClasses(table).contains(TABLE_HEADER_DESC_INDICATOR)); - Assert.assertTrue("Ascending sort indicator didn't become visible", + assertTrue("Ascending sort indicator didn't become visible", getHeaderClasses(table).contains(TABLE_HEADER_ASC_INDICATOR)); button.click(); - Assert.assertTrue( + assertTrue( "Descending sort indicator didn't appear on the second serverside sort.", getHeaderClasses(table).contains(TABLE_HEADER_DESC_INDICATOR)); - Assert.assertFalse("Ascending sort indicator didn't disappear", + assertFalse("Ascending sort indicator didn't disappear", getHeaderClasses(table).contains(TABLE_HEADER_ASC_INDICATOR)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableToggleColumnVisibilityTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableToggleColumnVisibilityTest.java index 8c02ce11b3..48f8e782c6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableToggleColumnVisibilityTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableToggleColumnVisibilityTest.java @@ -15,12 +15,14 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.TableHeaderElement; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -44,11 +46,11 @@ public class TableToggleColumnVisibilityTest extends MultiBrowserTest { checkHeaderAttributes(1); toggleVisibilityButton.click(); // hide column #1 - Assert.assertEquals("One column should be visible", + assertEquals("One column should be visible", findElements(By.className("v-table-header-cell")).size(), 1); toggleVisibilityButton.click(); // restore column #1 - Assert.assertEquals("Two columns should be visible", + assertEquals("Two columns should be visible", findElements(By.className("v-table-header-cell")).size(), 2); checkHeaderAttributes(1); @@ -65,16 +67,15 @@ public class TableToggleColumnVisibilityTest extends MultiBrowserTest { TableHeaderElement headerCell = $(TableElement.class).first() .getHeaderCell(columnNumber); - Assert.assertTrue("Column header text should be custom", + assertTrue("Column header text should be custom", headerCell.getText().equalsIgnoreCase("Hello World")); - Assert.assertTrue("Column should have an icon", + assertTrue("Column should have an icon", headerCell.findElements(By.className("v-icon")).size() > 0); - Assert.assertTrue("Column should have alignment to the right", - headerCell - .findElements(By.className( - "v-table-caption-container-align-right")) - .size() > 0); + assertTrue("Column should have alignment to the right", headerCell + .findElements( + By.className("v-table-caption-container-align-right")) + .size() > 0); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableToggleColumnVisibilityWidthTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableToggleColumnVisibilityWidthTest.java index 511bce3b34..0c8f029e53 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableToggleColumnVisibilityWidthTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableToggleColumnVisibilityWidthTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; @@ -40,17 +41,16 @@ public class TableToggleColumnVisibilityWidthTest extends MultiBrowserTest { ButtonElement toggleButton = $(ButtonElement.class).id("toggler"); toggleButton.click(); - Assert.assertEquals("One column should be visible", + assertEquals("One column should be visible", findElements(By.className("v-table-header-cell")).size(), 1); toggleButton.click(); - Assert.assertEquals("Two columns should be visible", + assertEquals("Two columns should be visible", findElements(By.className("v-table-header-cell")).size(), 2); int secondColumnWidthRestored = findElements( By.className("v-table-header-cell")).get(1).getSize() .getWidth(); - Assert.assertEquals( - "Column width should be the same as it was before hiding", + assertEquals("Column width should be the same as it was before hiding", secondColumnWidthInitial, secondColumnWidthRestored); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableWidthItemRemoveTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableWidthItemRemoveTest.java index d80e3496d9..2008982b25 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableWidthItemRemoveTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableWidthItemRemoveTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -39,7 +40,7 @@ public class TableWidthItemRemoveTest extends MultiBrowserTest { .findElement(By.vaadin("//Table[caption=\"My table\"]")); int original_width = table.getSize().getWidth(); populateButton.click(); - Assert.assertTrue("Width changed on item add.", + assertTrue("Width changed on item add.", original_width == table.getSize().getWidth()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TableWithPollingTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TableWithPollingTest.java index 091c9866ae..bf2d5ab435 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TableWithPollingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TableWithPollingTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -72,12 +73,12 @@ public class TableWithPollingTest extends MultiBrowserTest { private void assertHeaderCellWidth(int column, int width) throws AssertionError { - Assert.assertEquals(width, getHeaderCell(column).getSize().width); + assertEquals(width, getHeaderCell(column).getSize().width); } private void assertBodyCellWidth(int column, int width) throws AssertionError { - Assert.assertEquals(width, getBodyCell(column).getSize().width); + assertEquals(width, getBodyCell(column).getSize().width); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java index d71d2a7845..09c9d01cda 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.interactions.Actions; @@ -48,6 +49,6 @@ public class TextFieldValueGoesMissingTest extends MultiBrowserTest { new Actions(getDriver()).contextClick(textfield).perform(); - Assert.assertEquals("test", textfield.getValue()); + assertEquals("test", textfield.getValue()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java index 43328b2e99..27d8e8c300 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java @@ -17,11 +17,11 @@ package com.vaadin.tests.components.table; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; import java.util.Arrays; import org.junit.After; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.JavascriptExecutor; @@ -92,7 +92,7 @@ public class UnnecessaryScrollbarWhenZoomingTest extends MultiBrowserTest { try { Thread.sleep(1000); } catch (InterruptedException e) { - Assert.fail(); + fail(); } WebElement element = findElement( By.cssSelector(".v-table-body-wrapper")); diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/EmptyTabSheetTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/EmptyTabSheetTest.java index a22a777b5c..6f6f17be8c 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/EmptyTabSheetTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/EmptyTabSheetTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.tabsheet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -37,7 +38,7 @@ public class EmptyTabSheetTest extends MultiBrowserTest { WebElement deco = getDriver() .findElement(By.className("v-tabsheet-deco")); - Assert.assertEquals("none", deco.getCssValue("display")); + assertEquals("none", deco.getCssValue("display")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheetTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheetTest.java index 6603d2474f..12ece12146 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheetTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheetTest.java @@ -1,13 +1,13 @@ package com.vaadin.tests.components.tabsheet; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.TabSheetElement; import com.vaadin.tests.tb3.MultiBrowserTest; -import junit.framework.Assert; - public class FirstTabNotVisibleInTabsheetTest extends MultiBrowserTest { @Test public void testFirstTabIsVisibleAfterBeingInvisible() { @@ -18,7 +18,7 @@ public class FirstTabNotVisibleInTabsheetTest extends MultiBrowserTest { TabSheetElement tabSheet = $(TabSheetElement.class).first(); - Assert.assertTrue("TabSheet should have first tab visible", + assertTrue("TabSheet should have first tab visible", tabSheet.getTabCaptions().contains("first visible tab")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClippedTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClippedTest.java index 48e47d5619..20504b79f9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClippedTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClippedTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.tabsheet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -24,15 +25,13 @@ public class FirstTabNotVisibleWhenTabsheetNotClippedTest .findElement(By.className("v-tabsheet-tabitemcell-first")); String caption = firstTab.findElement(By.className("v-captiontext")) .getText(); - Assert.assertEquals("Tab with -first style should be Tab 1", "Tab 1", - caption); + assertEquals("Tab with -first style should be Tab 1", "Tab 1", caption); toggleNotClipped.click(); firstTab = notClippedTabSheet .findElement(By.className("v-tabsheet-tabitemcell-first")); caption = firstTab.findElement(By.className("v-captiontext")).getText(); - Assert.assertEquals("Tab with -first style should be Tab 0", "Tab 0", - caption); + assertEquals("Tab with -first style should be Tab 0", "Tab 0", caption); } @Test diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/HtmlInTabCaptionTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/HtmlInTabCaptionTest.java index 9505d8a7c8..0fdab188b2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/HtmlInTabCaptionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/HtmlInTabCaptionTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.tabsheet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -34,8 +35,8 @@ public class HtmlInTabCaptionTest extends SingleBrowserTest { public void tabsheetWithoutHtmlCaptions() { openTestURL(); TabSheetElement ts = $(TabSheetElement.class).get(0); - Assert.assertEquals(PLAIN_TEXT_RED, getTab(ts, 0).getText()); - Assert.assertEquals(PLAIN_TEXT_BLUE, getTab(ts, 1).getText()); + assertEquals(PLAIN_TEXT_RED, getTab(ts, 0).getText()); + assertEquals(PLAIN_TEXT_BLUE, getTab(ts, 1).getText()); } private WebElement getTab(TabSheetElement tabSheetElement, int i) { @@ -50,16 +51,16 @@ public class HtmlInTabCaptionTest extends SingleBrowserTest { public void tabsheetWithHtmlCaptions() { openTestURL(); TabSheetElement ts = $(TabSheetElement.class).get(1); - Assert.assertEquals(HTML_TEXT_RED, getTab(ts, 0).getText()); - Assert.assertEquals(HTML_TEXT_BLUE, getTab(ts, 1).getText()); + assertEquals(HTML_TEXT_RED, getTab(ts, 0).getText()); + assertEquals(HTML_TEXT_BLUE, getTab(ts, 1).getText()); } @Test public void accordionWithoutHtmlCaptions() { openTestURL(); AccordionElement acc = $(AccordionElement.class).get(0); - Assert.assertEquals(PLAIN_TEXT_RED, getTab(acc, 0).getText()); - Assert.assertEquals(PLAIN_TEXT_BLUE, getTab(acc, 1).getText()); + assertEquals(PLAIN_TEXT_RED, getTab(acc, 0).getText()); + assertEquals(PLAIN_TEXT_BLUE, getTab(acc, 1).getText()); } @@ -67,7 +68,7 @@ public class HtmlInTabCaptionTest extends SingleBrowserTest { public void accordionWithHtmlCaptions() { openTestURL(); AccordionElement acc = $(AccordionElement.class).get(1); - Assert.assertEquals(HTML_TEXT_RED, getTab(acc, 0).getText()); - Assert.assertEquals(HTML_TEXT_BLUE, getTab(acc, 1).getText()); + assertEquals(HTML_TEXT_RED, getTab(acc, 0).getText()); + assertEquals(HTML_TEXT_BLUE, getTab(acc, 1).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/NewSelectionAfterTabRemoveTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/NewSelectionAfterTabRemoveTest.java index 773749098e..2757f60694 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/NewSelectionAfterTabRemoveTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/NewSelectionAfterTabRemoveTest.java @@ -15,10 +15,11 @@ */ package com.vaadin.tests.components.tabsheet; +import static org.junit.Assert.assertTrue; + import java.io.IOException; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -44,11 +45,11 @@ public class NewSelectionAfterTabRemoveTest extends MultiBrowserTest { selectAndClose(tab(19)); - Assert.assertTrue("Tab 18 selected", isTabSelected(tab(18))); + assertTrue("Tab 18 selected", isTabSelected(tab(18))); selectAndClose(tab(16)); - Assert.assertTrue("Tab 17 selected", isTabSelected(tab(17))); + assertTrue("Tab 17 selected", isTabSelected(tab(17))); } /* diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/PreventTabChangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/PreventTabChangeTest.java index b400ca8a28..1360c77373 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/PreventTabChangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/PreventTabChangeTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.tabsheet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; @@ -32,18 +34,16 @@ public class PreventTabChangeTest extends MultiBrowserTest { clickTab(2); Thread.sleep(2000); assertTabSelected(2); - Assert.assertEquals("Tab 3 contents", - getSelectedTabContent().getText()); + assertEquals("Tab 3 contents", getSelectedTabContent().getText()); clickTab(0); clickTab(2); assertTabSelected(0); - Assert.assertEquals("Tab 1 contents", - getSelectedTabContent().getText()); + assertEquals("Tab 1 contents", getSelectedTabContent().getText()); } private void assertTabSelected(int i) throws NoSuchElementException { WebElement tabItem = findTab(i).findElement(By.xpath("..")); - Assert.assertTrue("Tab " + i + " should be selected but isn't", tabItem + assertTrue("Tab " + i + " should be selected but isn't", tabItem .getAttribute("class").contains("v-tabsheet-tabitem-selected")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java index 98604c2a6f..39b5bf07de 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.tabsheet; +import static org.junit.Assert.assertEquals; + import java.io.IOException; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -166,7 +167,7 @@ public class TabKeyboardNavigationTest extends MultiBrowserTest { waitForElementPresent(id); - Assert.assertEquals(labelCaption, labelCaption, labelElement.getText()); + assertEquals(labelCaption, labelCaption, labelElement.getText()); } /* @@ -179,7 +180,7 @@ public class TabKeyboardNavigationTest extends MultiBrowserTest { .findElements(by).get(index - 1); String expected = "Tab " + index; - Assert.assertEquals(expected, + assertEquals(expected, element.getText().substring(0, expected.length())); return element; diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSelectionRevertedByServerTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSelectionRevertedByServerTest.java index a36faf0c27..858b2d63e6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSelectionRevertedByServerTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSelectionRevertedByServerTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.components.tabsheet; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.io.IOException; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; @@ -57,14 +59,14 @@ public class TabSelectionRevertedByServerTest extends MultiBrowserTest { TestBenchElement tabExpected = tab(expectedIndex); String attributeClassExpected = tabExpected.getAttribute("class"); - Assert.assertTrue("Tab " + expectedIndex + " should be selected.", + assertTrue("Tab " + expectedIndex + " should be selected.", attributeClassExpected .contains("v-tabsheet-tabitemcell-selected")); TestBenchElement tabWrong = tab(wrongIndex); String attributeClassWrong = tabWrong.getAttribute("class"); - Assert.assertTrue( + assertTrue( "Tab " + wrongIndex + " should be selected when click on Tab 4", !attributeClassWrong .contains("v-tabsheet-tabitemcell-selected")); @@ -103,7 +105,7 @@ public class TabSelectionRevertedByServerTest extends MultiBrowserTest { .findElements(by).get(index - 1); String expected = "Tab " + index; - Assert.assertEquals(expected, + assertEquals(expected, element.getText().substring(0, expected.length())); return element; diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java index 31011b8837..17afe16a98 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java @@ -16,11 +16,11 @@ package com.vaadin.tests.components.tabsheet; import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import java.io.IOException; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -89,10 +89,10 @@ public class TabSheetErrorTooltipTest extends MultiBrowserTest { } private void assertTooltip(String tooltip) { - Assert.assertEquals(tooltip, getCurrentTooltip().getText()); + assertEquals(tooltip, getCurrentTooltip().getText()); } private void assertErrorMessage(String message) { - Assert.assertEquals(message, getCurrentErrorMessage().getText()); + assertEquals(message, getCurrentErrorMessage().getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetInDisabledParentTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetInDisabledParentTest.java index 0fe431243e..d1226769ad 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetInDisabledParentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetInDisabledParentTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.components.tabsheet; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -43,7 +45,7 @@ public class TabSheetInDisabledParentTest extends MultiBrowserTest { .findElements(By.className("v-tabsheet-tabitemcell")); tabHeaders.get(1).findElement(By.className("v-captiontext")).click(); - Assert.assertFalse( + assertFalse( "It's possible to activate TabSheet tab when its parent is disabled", tabHeaders.get(1).getAttribute("class") .contains("v-tabsheet-tabitemcell-selected")); @@ -54,15 +56,14 @@ public class TabSheetInDisabledParentTest extends MultiBrowserTest { // selected tab is still the same tabHeaders = getDriver() .findElements(By.className("v-tabsheet-tabitemcell")); - Assert.assertTrue( - "Tabsheet has wrong selected tab after enabling its parent", + assertTrue("Tabsheet has wrong selected tab after enabling its parent", tabHeaders.get(0).getAttribute("class") .contains("v-tabsheet-tabitemcell-selected")); // click to the second tab tabHeaders.get(1).findElement(By.className("v-captiontext")).click(); // check the second tab is selected - Assert.assertTrue( + assertTrue( "Second tab is not activated in the Tabsheet after clicking on it", tabHeaders.get(1).getAttribute("class") .contains("v-tabsheet-tabitemcell-selected")); diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java index 4db099fded..d8566057c0 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.tabsheet; +import static org.junit.Assert.assertEquals; + import java.io.IOException; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -48,7 +49,7 @@ public class TabSpaceNotScrollTest extends MultiBrowserTest { Point newLocation = tab.getLocation(); - Assert.assertEquals(oldLocation, newLocation); + assertEquals(oldLocation, newLocation); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollIntoViewTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollIntoViewTest.java index 074d952889..83ac4dfae3 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollIntoViewTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollIntoViewTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.tabsheet; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -46,12 +47,12 @@ public class TabsheetScrollIntoViewTest extends MultiBrowserTest { $(ButtonElement.class).id(TabsheetScrollIntoView.BTN_SELECT_LAST_TAB) .click(); TabSheetElement tabSheet = $(TabSheetElement.class).first(); - Assert.assertTrue("Select last should not hide other tabs", + assertTrue("Select last should not hide other tabs", tabSheet.getTabCaptions().contains("Tab 98")); List<WebElement> scrollerPrev = tabSheet .findElements(By.className("v-tabsheet-scrollerPrev")); - Assert.assertTrue("Select last should not disable tab scrolling", + assertTrue("Select last should not disable tab scrolling", !scrollerPrev.isEmpty() && scrollerPrev.get(0).isDisplayed()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java index db47d0bb4b..67f29a1a25 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.tabsheet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.Point; @@ -37,7 +39,7 @@ public class TabsheetScrollingTest extends MultiBrowserTest { sendKey(Keys.ARROW_RIGHT); } sendKey(Keys.SPACE); - Assert.assertEquals("Hide this tab (21)", getHideButtonText()); + assertEquals("Hide this tab (21)", getHideButtonText()); } private WebElement getTab(int index) { @@ -56,8 +58,8 @@ public class TabsheetScrollingTest extends MultiBrowserTest { private WebElement getTabByCaption(TabSheetElement ts, String caption) { WebElement tabBar = ts.findElement(By.className("v-tabsheet-tabs")); - return tabBar.findElement(By - .xpath("./tbody/tr/td[./div/div/div[contains(., normalize-space('" + return tabBar.findElement(By.xpath( + "./tbody/tr/td[./div/div/div[contains(., normalize-space('" + caption + "'))]]")); } @@ -72,10 +74,10 @@ public class TabsheetScrollingTest extends MultiBrowserTest { openTestURL(); $(ButtonElement.class).id(TabsheetScrolling.SELECT_LAST).click(); TabSheetElement tabsheetFixed = $(TabSheetElement.class).first(); - Assert.assertTrue("Select last should scroll last tab into view", + assertTrue("Select last should scroll last tab into view", isTabVisible(tabsheetFixed, "Tab 99")); $(ButtonElement.class).id(TabsheetScrolling.SELECT_FIRST).click(); - Assert.assertTrue("Select first should scroll first tab into view", + assertTrue("Select first should scroll first tab into view", isTabVisible(tabsheetFixed, "Tab 1")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/VetoTabChangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/VetoTabChangeTest.java index 8721db1589..7bc3dde9fe 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/VetoTabChangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/VetoTabChangeTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.tabsheet; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.LabelElement; @@ -28,16 +29,16 @@ public class VetoTabChangeTest extends SingleBrowserTest { openTestURL(); TabSheetElement tabSheet = $(TabSheetElement.class).first(); - Assert.assertEquals("Tab 1 should be there by default", "Tab 1", + assertEquals("Tab 1 should be there by default", "Tab 1", getTabContent(tabSheet)); tabSheet.openTab(1); - Assert.assertEquals("Tab should not have changed", "Tab 1", + assertEquals("Tab should not have changed", "Tab 1", getTabContent(tabSheet)); tabSheet.openTab(0); - Assert.assertEquals("Tab should still be there", "Tab 1", + assertEquals("Tab should still be there", "Tab 1", getTabContent(tabSheet)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/textarea/TextAreaTextFieldCursorPositionTest.java b/uitest/src/test/java/com/vaadin/tests/components/textarea/TextAreaTextFieldCursorPositionTest.java index 89065050dc..4d2e169d6d 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/textarea/TextAreaTextFieldCursorPositionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/textarea/TextAreaTextFieldCursorPositionTest.java @@ -15,7 +15,10 @@ */ package com.vaadin.tests.components.textarea; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -30,15 +33,15 @@ public class TextAreaTextFieldCursorPositionTest extends SingleBrowserTest { openTestURL(); $(ButtonElement.class).id(TextAreaTextFieldCursorPosition.GET_POSITION) .click(); - Assert.assertEquals("2. TextField position: -1", getLogRow(0)); - Assert.assertEquals("1. TextArea position: -1", getLogRow(1)); + assertEquals("2. TextField position: -1", getLogRow(0)); + assertEquals("1. TextArea position: -1", getLogRow(1)); $(TextFieldElement.class).first().focus(); $(TextAreaElement.class).first().focus(); $(ButtonElement.class).id(TextAreaTextFieldCursorPosition.GET_POSITION) .click(); - Assert.assertTrue(getLogRow(0).startsWith("4. TextField position:")); - Assert.assertNotEquals("4. TextField position: -1", getLogRow(0)); - Assert.assertNotEquals("3. TextArea position: -1", getLogRow(1)); + assertTrue(getLogRow(0).startsWith("4. TextField position:")); + assertNotEquals("4. TextField position: -1", getLogRow(0)); + assertNotEquals("3. TextArea position: -1", getLogRow(1)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/textfield/EnumTextFieldTest.java b/uitest/src/test/java/com/vaadin/tests/components/textfield/EnumTextFieldTest.java index b810de2e5f..4d77f3fc2e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/textfield/EnumTextFieldTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/textfield/EnumTextFieldTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.textfield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.Keys; @@ -28,20 +29,20 @@ public class EnumTextFieldTest extends SingleBrowserTest { openTestURL(); $(TextFieldElement.class).first().clear(); $(TextFieldElement.class).first().sendKeys("Value", Keys.TAB); - Assert.assertEquals("3. Value (valid)", getLogRow(0)); + assertEquals("3. Value (valid)", getLogRow(0)); $(TextFieldElement.class).first().clear(); $(TextFieldElement.class).first().sendKeys("VaLuE"); $(TextFieldElement.class).first().sendKeys(Keys.TAB); - Assert.assertEquals("5. Value (valid)", getLogRow(0)); + assertEquals("5. Value (valid)", getLogRow(0)); $(TextFieldElement.class).first().clear(); $(TextFieldElement.class).first().sendKeys("The last value"); $(TextFieldElement.class).first().sendKeys(Keys.TAB); - Assert.assertEquals("7. The last value (valid)", getLogRow(0)); + assertEquals("7. The last value (valid)", getLogRow(0)); $(TextFieldElement.class).first().clear(); - Assert.assertEquals("8. null (valid)", getLogRow(0)); + assertEquals("8. null (valid)", getLogRow(0)); } @@ -52,7 +53,7 @@ public class EnumTextFieldTest extends SingleBrowserTest { $(TextFieldElement.class).first().sendKeys("bar"); $(TextFieldElement.class).first().sendKeys(Keys.TAB); - Assert.assertEquals("3. bar (INVALID)", getLogRow(0)); + assertEquals("3. bar (INVALID)", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/textfield/InputPromptGetTextTest.java b/uitest/src/test/java/com/vaadin/tests/components/textfield/InputPromptGetTextTest.java index 8cd1970a38..a5bedae670 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/textfield/InputPromptGetTextTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/textfield/InputPromptGetTextTest.java @@ -15,8 +15,9 @@ */ package com.vaadin.tests.components.textfield; +import static org.junit.Assert.assertEquals; + import org.apache.commons.lang.RandomStringUtils; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -48,7 +49,7 @@ public class InputPromptGetTextTest extends MultiBrowserTest { WebElement label = getDriver() .findElement(By.id(InputPromptGetText.LABEL2)); - Assert.assertEquals("Your input was:", label.getText().trim()); + assertEquals("Your input was:", label.getText().trim()); } private String getRandomString() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/textfield/RequiredTextFieldTest.java b/uitest/src/test/java/com/vaadin/tests/components/textfield/RequiredTextFieldTest.java index cfef5a97d4..61e5592c79 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/textfield/RequiredTextFieldTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/textfield/RequiredTextFieldTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.components.textfield; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -35,12 +37,12 @@ public class RequiredTextFieldTest extends MultiBrowserTest { $(ButtonElement.class).first().click(); - Assert.assertTrue("Text field doesn't contain .v-required style", + assertTrue("Text field doesn't contain .v-required style", getStyles().contains("v-required")); $(ButtonElement.class).first().click(); - Assert.assertFalse( + assertFalse( "Text field contains .v-required style for non-required field", getStyles().contains("v-required")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/textfield/SelectionAndCursorPositionTest.java b/uitest/src/test/java/com/vaadin/tests/components/textfield/SelectionAndCursorPositionTest.java index 950c64c8b2..1350258ee5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/textfield/SelectionAndCursorPositionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/textfield/SelectionAndCursorPositionTest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.components.textfield; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -68,8 +69,7 @@ public class SelectionAndCursorPositionTest extends SingleBrowserTest { } private void assertSelection(int start, int length) { - Assert.assertEquals(new Selection(start, length), - getSelection(textField)); + assertEquals(new Selection(start, length), getSelection(textField)); } private WebElement getSelectAll() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/textfield/TextChangeEventsTest.java b/uitest/src/test/java/com/vaadin/tests/components/textfield/TextChangeEventsTest.java index 1d01c35409..dd39944af2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/textfield/TextChangeEventsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/textfield/TextChangeEventsTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.textfield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.TextAreaElement; @@ -16,13 +18,13 @@ public class TextChangeEventsTest extends SingleBrowserTest { TextAreaElement taDefault = $(TextAreaElement.class) .caption("Default text area").first(); taDefault.sendKeys("abc"); - Assert.assertEquals(getLogRow(0), + assertEquals(getLogRow(0), "1. Text change event for Default text area, text content currently:'abc' Cursor at index:3"); TextAreaElement taTimeout = $(TextAreaElement.class) .caption("Timeout 3s").first(); taTimeout.sendKeys("abc"); - Assert.assertEquals(getLogRow(0), + assertEquals(getLogRow(0), "2. Text change event for Timeout 3s, text content currently:'abc' Cursor at index:3"); } @@ -33,19 +35,19 @@ public class TextChangeEventsTest extends SingleBrowserTest { TextFieldElement tfDefault = $(TextFieldElement.class) .caption("Default").first(); tfDefault.sendKeys("abc"); - Assert.assertEquals(getLogRow(0), + assertEquals(getLogRow(0), "1. Text change event for Default, text content currently:'abc' Cursor at index:3"); TextFieldElement tfEager = $(TextFieldElement.class).caption("Eager") .first(); tfEager.sendKeys("abc"); - Assert.assertTrue(getLogRow(0).contains( + assertTrue(getLogRow(0).contains( "Text change event for Eager, text content currently:'abc' Cursor at index:3")); TextFieldElement tfTimeout = $(TextFieldElement.class) .caption("Timeout 3s").first(); tfTimeout.sendKeys("abc"); - Assert.assertTrue(getLogRow(0).contains( + assertTrue(getLogRow(0).contains( "Text change event for Timeout 3s, text content currently:'abc' Cursor at index:3")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeModeTest.java b/uitest/src/test/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeModeTest.java index fcc681bc0b..3054b68b6a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeModeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeModeTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.textfield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Ignore; import org.junit.Test; import org.openqa.selenium.By; @@ -113,7 +114,7 @@ public class TextFieldsValueChangeModeTest extends MultiBrowserTest { if (tail != -1) { log = log.substring(0, tail); } - Assert.assertEquals(expected, log); + assertEquals(expected, log); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java index d7c25e60a5..3bcfac4462 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java @@ -1,10 +1,13 @@ package com.vaadin.tests.components.tree; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.io.IOException; import java.util.Arrays; import java.util.function.Predicate; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -50,9 +53,9 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { public void tree_expand_and_collapse() { TreeElement tree = $(TreeElement.class).first(); tree.expand(0); - Assert.assertEquals("1 | 0", tree.getItem(1).getText()); + assertEquals("1 | 0", tree.getItem(1).getText()); tree.collapse(0); - Assert.assertEquals("0 | 1", tree.getItem(1).getText()); + assertEquals("0 | 1", tree.getItem(1).getText()); assertNoErrorNotifications(); } @@ -66,8 +69,8 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { @Test public void tree_expand_all_with_icons() throws IOException { selectMenuPath("Component", "Icons", "By Depth"); - Assert.assertTrue("Icon not present", $(TreeElement.class).first() - .getItem(0).isElementPresent(By.tagName("img"))); + assertTrue("Icon not present", $(TreeElement.class).first().getItem(0) + .isElementPresent(By.tagName("img"))); expandAll(); assertAllExpanded(true); assertNoErrorNotifications(); @@ -92,25 +95,24 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { int n = 0; for (int i = 0; i < 3; ++i) { item = tree.getItem(n++); - Assert.assertEquals("0 | " + i, item.getText()); + assertEquals("0 | " + i, item.getText()); - Assert.assertEquals("Unexpected icon state", shouldHaveIcon, + assertEquals("Unexpected icon state", shouldHaveIcon, THEME_RESOURCE.test(item)); for (int j = 0; j < 3; ++j) { item = tree.getItem(n++); - Assert.assertEquals( - (shouldHaveIcon ? "\ue92d" : "") + "1 | " + j, + assertEquals((shouldHaveIcon ? "\ue92d" : "") + "1 | " + j, item.getText()); - Assert.assertEquals("Unexpected icon state", shouldHaveIcon, + assertEquals("Unexpected icon state", shouldHaveIcon, VAADIN_ICON.test(item)); for (int k = 0; k < 3; ++k) { item = tree.getItem(n++); - Assert.assertEquals("2 | " + k, item.getText()); + assertEquals("2 | " + k, item.getText()); - Assert.assertEquals("Unexpected icon state", shouldHaveIcon, + assertEquals("Unexpected icon state", shouldHaveIcon, CLASS_RESOURCE.test(item)); } } @@ -125,19 +127,17 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { selectMenuPath("Component", "Captions", "Custom caption"); TreeElement tree = $(TreeElement.class).first(); - Assert.assertEquals("Id: /0/0\nDepth: 0, Index: 0", - tree.getItem(0).getText()); - Assert.assertEquals("Id: /0/1\nDepth: 0, Index: 1", - tree.getItem(1).getText()); + assertEquals("Id: /0/0\nDepth: 0, Index: 0", tree.getItem(0).getText()); + assertEquals("Id: /0/1\nDepth: 0, Index: 1", tree.getItem(1).getText()); tree.expand(0); - Assert.assertEquals("Id: /0/0/1/0\nDepth: 1, Index: 0", + assertEquals("Id: /0/0/1/0\nDepth: 1, Index: 0", tree.getItem(1).getText()); - Assert.assertEquals("Id: /0/0/1/1\nDepth: 1, Index: 1", + assertEquals("Id: /0/0/1/1\nDepth: 1, Index: 1", tree.getItem(2).getText()); tree.expand(1); - Assert.assertEquals("Id: /0/0/1/0/2/0\nDepth: 2, Index: 0", + assertEquals("Id: /0/0/1/0/2/0\nDepth: 2, Index: 0", tree.getItem(2).getText()); - Assert.assertEquals("Id: /0/0/1/0/2/1\nDepth: 2, Index: 1", + assertEquals("Id: /0/0/1/0/2/1\nDepth: 2, Index: 1", tree.getItem(3).getText()); assertNoErrorNotifications(); @@ -151,10 +151,9 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { selectMenuPath("Component", "Captions", "HTML caption"); TreeElement tree = $(TreeElement.class).first(); - Assert.assertEquals("Id: /0/0\nDepth: 0\nIndex: 0", - tree.getItem(0).getText()); + assertEquals("Id: /0/0\nDepth: 0\nIndex: 0", tree.getItem(0).getText()); - Assert.assertEquals("Expander element not aligned to top", + assertEquals("Expander element not aligned to top", tree.getExpandElement(0).getLocation().getY(), tree.getItem(0).getLocation().getY()); @@ -168,7 +167,7 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { selectMenuPath("Component", "ContentMode", "TEXT"); TreeElement tree = $(TreeElement.class).first(); - Assert.assertEquals("Id: /0/0<br/>Depth: 0<br/>Index: 0", + assertEquals("Id: /0/0<br/>Depth: 0<br/>Index: 0", tree.getItem(0).getText()); assertNoErrorNotifications(); @@ -178,24 +177,21 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { public void tree_item_click() { selectMenuPath("Component", "Item Click Listener"); $(TreeElement.class).first().getItem(1).click(); - Assert.assertTrue(logContainsText("ItemClick: 0 | 1")); + assertTrue(logContainsText("ItemClick: 0 | 1")); } @Test public void tree_style_generator() { selectMenuPath("Component", "Style Generator"); TreeElement tree = $(TreeElement.class).first(); - Assert.assertTrue("Style name not present", - tree.wrap(TreeGridElement.class).getRow(0).getAttribute("class") - .contains("level0")); + assertTrue("Style name not present", tree.wrap(TreeGridElement.class) + .getRow(0).getAttribute("class").contains("level0")); tree.expand(0); - Assert.assertTrue("Style name not present", - tree.wrap(TreeGridElement.class).getRow(1).getAttribute("class") - .contains("level1")); + assertTrue("Style name not present", tree.wrap(TreeGridElement.class) + .getRow(1).getAttribute("class").contains("level1")); tree.expand(1); - Assert.assertTrue("Style name not present", - tree.wrap(TreeGridElement.class).getRow(2).getAttribute("class") - .contains("level2")); + assertTrue("Style name not present", tree.wrap(TreeGridElement.class) + .getRow(2).getAttribute("class").contains("level2")); } @Test @@ -204,10 +200,10 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { TreeElement tree = $(TreeElement.class).first(); tree.expand(0); tree.expand(1); - Assert.assertEquals("2 | 0", tree.getItem(2).getText()); + assertEquals("2 | 0", tree.getItem(2).getText()); tree.collapse(1); - Assert.assertEquals("Tree should prevent collapsing all nodes.", - "2 | 0", tree.getItem(2).getText()); + assertEquals("Tree should prevent collapsing all nodes.", "2 | 0", + tree.getItem(2).getText()); } @Test @@ -216,17 +212,13 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { TreeElement tree = $(TreeElement.class).first(); tree.getItem(0).click(); TreeGridElement wrap = tree.wrap(TreeGridElement.class); - Assert.assertFalse( - "Tree MultiSelection shouldn't have selection column", + assertFalse("Tree MultiSelection shouldn't have selection column", wrap.getCell(0, 0).isElementPresent(By.tagName("input"))); - Assert.assertTrue("First row was not selected", - wrap.getRow(0).isSelected()); + assertTrue("First row was not selected", wrap.getRow(0).isSelected()); new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN, Keys.SPACE) .perform(); - Assert.assertTrue("First row was deselected", - wrap.getRow(0).isSelected()); - Assert.assertTrue("Second row was not selected", - wrap.getRow(1).isSelected()); + assertTrue("First row was deselected", wrap.getRow(0).isSelected()); + assertTrue("Second row was not selected", wrap.getRow(1).isSelected()); } @Test @@ -235,15 +227,12 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { TreeElement tree = $(TreeElement.class).first(); TreeGridElement wrap = tree.wrap(TreeGridElement.class); tree.getItem(0).click(); - Assert.assertTrue("First row was not selected", - wrap.getRow(0).isSelected()); + assertTrue("First row was not selected", wrap.getRow(0).isSelected()); tree.getItem(1).click(); - Assert.assertTrue("First row was deselected", - wrap.getRow(0).isSelected()); - Assert.assertTrue("Second row was not selected", - wrap.getRow(1).isSelected()); + assertTrue("First row was deselected", wrap.getRow(0).isSelected()); + assertTrue("Second row was not selected", wrap.getRow(1).isSelected()); tree.getItem(0).click(); - Assert.assertFalse("First row was not deselected", + assertFalse("First row was not deselected", wrap.getRow(0).isSelected()); } @@ -254,7 +243,7 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { Arrays.stream(TreeBasicFeatures.ROW_HEIGHTS).boxed() .map(String::valueOf).forEach(height -> { selectMenuPath("Component", "Row Height", height); - Assert.assertTrue(wrap.getCell(0, 0).getAttribute("style") + assertTrue(wrap.getCell(0, 0).getAttribute("style") .contains("height: " + height + "px;")); }); } @@ -264,6 +253,6 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { selectMenuPath("Component", "Descriptions", "String.valueOf"); $(TreeElement.class).first().getItem(0).showTooltip(); - Assert.assertEquals("", "0 | 0", getTooltipElement().getText()); + assertEquals("", "0 | 0", getTooltipElement().getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeOnBrowserResizeTest.java b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeOnBrowserResizeTest.java index 153f389850..5d7bd25626 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeOnBrowserResizeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeOnBrowserResizeTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.tree; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.Dimension; @@ -18,7 +19,7 @@ public class TreeOnBrowserResizeTest extends MultiBrowserTest { getDriver().manage().window().setSize(new Dimension(600, 800)); - Assert.assertTrue("Tree size should decrease.", + assertTrue("Tree size should decrease.", originalWidth > $(TreeGridElement.class).first() .getTableWrapper().getSize().getWidth()); } @@ -33,7 +34,7 @@ public class TreeOnBrowserResizeTest extends MultiBrowserTest { getDriver().manage().window().setSize(new Dimension(800, 800)); - Assert.assertTrue("Tree size should increase.", + assertTrue("Tree size should increase.", originalWidth < $(TreeGridElement.class).first() .getTableWrapper().getSize().getWidth()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeWideContentTest.java b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeWideContentTest.java index da353b545b..fd43d7ab8f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeWideContentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeWideContentTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.tree; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -16,9 +17,8 @@ public class TreeWideContentTest extends SingleBrowserTest { TreeGridElement tree = $(TreeElement.class).first() .wrap(TreeGridElement.class); - Assert.assertTrue("Row should be wider than tree", - tree.getTableWrapper().getSize().getWidth() < tree.getRow(0) - .getSize().getWidth()); + assertTrue("Row should be wider than tree", tree.getTableWrapper() + .getSize().getWidth() < tree.getRow(0).getSize().getWidth()); } @Test @@ -28,7 +28,7 @@ public class TreeWideContentTest extends SingleBrowserTest { TreeElement tree = $(TreeElement.class).first(); tree.collapse(0); TreeGridElement treeGrid = tree.wrap(TreeGridElement.class); - Assert.assertTrue("Row should be as wide as tree", + assertTrue("Row should be as wide as tree", treeGrid.getTableWrapper().getSize().getWidth() == treeGrid .getRow(0).getSize().getWidth()); } @@ -41,7 +41,7 @@ public class TreeWideContentTest extends SingleBrowserTest { TreeElement tree = $(TreeElement.class).first(); TreeGridElement treeGrid = tree.wrap(TreeGridElement.class); - Assert.assertTrue("Row should be as wide as tree", + assertTrue("Row should be as wide as tree", treeGrid.getTableWrapper().getSize().getWidth() == treeGrid .getRow(0).getSize().getWidth()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridCollapseDisabledTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridCollapseDisabledTest.java index dbb8e38b2a..896289c7c9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridCollapseDisabledTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridCollapseDisabledTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.treegrid; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; @@ -79,7 +81,7 @@ public class TreeGridCollapseDisabledTest extends SingleBrowserTest { selectMenuPath("Component", "Features", "Collapse allowed", "depth 1 disabled"); - Assert.assertTrue("First row should still be expanded", + assertTrue("First row should still be expanded", grid.isRowExpanded(0, 0)); // Assert second row expands but does not collapse @@ -91,21 +93,20 @@ public class TreeGridCollapseDisabledTest extends SingleBrowserTest { } private void assertExpandRow(int row) { - Assert.assertFalse(grid.isRowExpanded(row, 0)); + assertFalse(grid.isRowExpanded(row, 0)); grid.expandWithClick(row); - Assert.assertTrue(grid.isRowExpanded(row, 0)); + assertTrue(grid.isRowExpanded(row, 0)); } private void assertCollapseRow(int row) { - Assert.assertTrue("Row not expanded", grid.isRowExpanded(row, 0)); + assertTrue("Row not expanded", grid.isRowExpanded(row, 0)); grid.collapseWithClick(row); - Assert.assertFalse("Row did not collapse", grid.isRowExpanded(row, 0)); + assertFalse("Row did not collapse", grid.isRowExpanded(row, 0)); } private void assertCollapseRowDisabled(int row) { - Assert.assertTrue("Row not expanded", grid.isRowExpanded(row, 0)); + assertTrue("Row not expanded", grid.isRowExpanded(row, 0)); grid.collapseWithClick(row); - Assert.assertTrue("Row should not collapse", - grid.isRowExpanded(row, 0)); + assertTrue("Row should not collapse", grid.isRowExpanded(row, 0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridCollapseToLastRowInCacheTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridCollapseToLastRowInCacheTest.java index f24fcc2e76..e053191d4e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridCollapseToLastRowInCacheTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridCollapseToLastRowInCacheTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.treegrid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -31,14 +32,14 @@ public class TreeGridCollapseToLastRowInCacheTest extends SingleBrowserTest { assertNoErrorNotifications(); - Assert.assertEquals("0 | 0", grid.getCell(0, 0).getText()); - Assert.assertEquals("1 | 0", grid.getCell(1, 0).getText()); - Assert.assertEquals("2 | 0", grid.getCell(2, 0).getText()); + assertEquals("0 | 0", grid.getCell(0, 0).getText()); + assertEquals("1 | 0", grid.getCell(1, 0).getText()); + assertEquals("2 | 0", grid.getCell(2, 0).getText()); grid.collapseWithClick(0); - Assert.assertEquals("0 | 0", grid.getCell(0, 0).getText()); - Assert.assertEquals("0 | 1", grid.getCell(1, 0).getText()); + assertEquals("0 | 0", grid.getCell(0, 0).getText()); + assertEquals("0 | 1", grid.getCell(1, 0).getText()); assertNoErrorNotifications(); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridExpandDataRequestTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridExpandDataRequestTest.java index 677a395e1c..947770920d 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridExpandDataRequestTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridExpandDataRequestTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.treegrid; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Before; import org.junit.Test; @@ -32,21 +33,20 @@ public class TreeGridExpandDataRequestTest extends SingleBrowserTest { @Test public void expand_node0_does_not_request_root_nodes() { grid.expandWithClick(0); - Assert.assertFalse("Log should not contain request for root nodes.", + assertFalse("Log should not contain request for root nodes.", logContainsText("Root node request: ")); } @Test public void expand_node0_after_node1_does_not_request_children_of_node1() { grid.expandWithClick(1); - Assert.assertFalse("Log should not contain request for root nodes.", + assertFalse("Log should not contain request for root nodes.", logContainsText("Root node request: ")); clearLog(); grid.expandWithClick(0); - Assert.assertFalse( - "Log should not contain request for children of '0 | 1'.", + assertFalse("Log should not contain request for children of '0 | 1'.", logContainsText("Children request: 0 | 1")); - Assert.assertFalse("Log should not contain request for root nodes.", + assertFalse("Log should not contain request for root nodes.", logContainsText("Root node request: ")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridHugeTreeTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridHugeTreeTest.java index 1d99534719..ebf0aed6b1 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridHugeTreeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridHugeTreeTest.java @@ -1,7 +1,8 @@ package com.vaadin.tests.components.treegrid; +import static org.junit.Assert.assertEquals; + import org.apache.commons.lang3.StringUtils; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -86,7 +87,7 @@ public class TreeGridHugeTreeTest extends SingleBrowserTest { String[] cellTexts) { int index = startRowIndex; for (String cellText : cellTexts) { - Assert.assertEquals(cellText, + assertEquals(cellText, grid.getRow(index).getCell(cellIndex).getText()); index++; } diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridScrollingTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridScrollingTest.java index b4bc65e1ce..90d69f3895 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridScrollingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridScrollingTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.treegrid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.TreeGridElement; @@ -16,8 +17,7 @@ public class TreeGridScrollingTest extends SingleBrowserTest { TreeGridElement grid = $(TreeGridElement.class).first(); - Assert.assertEquals(grid.getRowCount(), - TreeGridScrolling.DEFAULT_NODES); + assertEquals(grid.getRowCount(), TreeGridScrolling.DEFAULT_NODES); verifyRow(0, 0, 0); verifyRow(10, 0, 10); @@ -156,7 +156,7 @@ public class TreeGridScrollingTest extends SingleBrowserTest { private void verifyRow(int rowActualIndex, int depth, int levelIndex) { TreeGridElement grid = $(TreeGridElement.class).first(); - Assert.assertEquals("Invalid row at index " + rowActualIndex, + assertEquals("Invalid row at index " + rowActualIndex, depth + " | " + levelIndex, grid.getCell(rowActualIndex, 0).getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridSelectTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridSelectTest.java index e167dc6ac5..f6c62ed1e2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridSelectTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridSelectTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.treegrid; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.By; @@ -44,13 +46,13 @@ public class TreeGridSelectTest extends SingleBrowserTest { private void assertAllRowsSelected(TreeGridElement grid) { for (int i = 0; i < grid.getRowCount(); i++) { - Assert.assertTrue(grid.getRow(i).isSelected()); + assertTrue(grid.getRow(i).isSelected()); } } private void assertAllRowsDeselected(TreeGridElement grid) { for (int i = 0; i < grid.getRowCount(); i++) { - Assert.assertFalse(grid.getRow(i).isSelected()); + assertFalse(grid.getRow(i).isSelected()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/treetable/TreeTableRowHeaderModeTest.java b/uitest/src/test/java/com/vaadin/tests/components/treetable/TreeTableRowHeaderModeTest.java index ccce20ac9d..cbde7e172a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/treetable/TreeTableRowHeaderModeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/treetable/TreeTableRowHeaderModeTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.treetable; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Test; import org.openqa.selenium.By; @@ -32,8 +33,7 @@ public class TreeTableRowHeaderModeTest extends MultiBrowserTest { public void testIconRowHeaderMode() { openTestURL(); - Assert.assertFalse( - "Unexpected row header for icons is found in TreeTable", + assertFalse("Unexpected row header for icons is found in TreeTable", isElementPresent( By.className("v-table-header-cell-rowheader"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/twincolselect/TwinColSelectTest.java b/uitest/src/test/java/com/vaadin/tests/components/twincolselect/TwinColSelectTest.java index cc819a2744..cba81126be 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/twincolselect/TwinColSelectTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/twincolselect/TwinColSelectTest.java @@ -1,5 +1,6 @@ package com.vaadin.tests.components.twincolselect; +import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -8,7 +9,6 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -70,28 +70,27 @@ public class TwinColSelectTest extends MultiBrowserTest { selectMenuPath("Component", "Listeners", "Selection listener"); selectItems("Item 4"); - Assert.assertEquals("1. Selected: [Item 4]", getLogRow(0)); + assertEquals("1. Selected: [Item 4]", getLogRow(0)); assertSelected("Item 4"); // the previous item stays selected selectItems("Item 2"); // Selection order (most recently selected is last) - Assert.assertEquals("2. Selected: [Item 4, Item 2]", getLogRow(0)); + assertEquals("2. Selected: [Item 4, Item 2]", getLogRow(0)); assertSelected("Item 2", "Item 4"); deselectItems("Item 4"); - Assert.assertEquals("3. Selected: [Item 2]", getLogRow(0)); + assertEquals("3. Selected: [Item 2]", getLogRow(0)); assertSelected("Item 2"); selectItems("Item 10", "Item 0", "Item 9", "Item 4"); - Assert.assertEquals( - "4. Selected: [Item 2, Item 0, Item 4, Item 10, Item 9]", + assertEquals("4. Selected: [Item 2, Item 0, Item 4, Item 10, Item 9]", getLogRow(0)); assertSelected("Item 0", "Item 2", "Item 4", "Item 9", "Item 10"); deselectItems("Item 0", "Item 2", "Item 9"); - Assert.assertEquals("5. Selected: [Item 4, Item 10]", getLogRow(0)); + assertEquals("5. Selected: [Item 4, Item 10]", getLogRow(0)); assertSelected("Item 4", "Item 10"); } @@ -101,14 +100,14 @@ public class TwinColSelectTest extends MultiBrowserTest { List<WebElement> selects = getTwinColSelect() .findElements(By.tagName("select")); - Assert.assertEquals(2, selects.size()); - Assert.assertTrue(selects.stream() + assertEquals(2, selects.size()); + assertTrue(selects.stream() .allMatch(element -> element.getAttribute("disabled") != null)); List<WebElement> buttons = getTwinColSelect() .findElements(By.className("v-button")); - Assert.assertEquals(2, buttons.size()); - buttons.forEach(button -> Assert.assertEquals("v-button v-disabled", + assertEquals(2, buttons.size()); + buttons.forEach(button -> assertEquals("v-button v-disabled", button.getAttribute("className"))); selectMenuPath("Component", "Listeners", "Selection listener"); @@ -116,16 +115,16 @@ public class TwinColSelectTest extends MultiBrowserTest { String lastLogRow = getLogRow(0); selectItems("Item 4"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); assertNothingSelected(); selectItems("Item 2"); // Selection order (most recently selected is last) - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); assertNothingSelected(); selectItems("Item 4"); - Assert.assertEquals(lastLogRow, getLogRow(0)); + assertEquals(lastLogRow, getLogRow(0)); assertNothingSelected(); } @@ -136,14 +135,14 @@ public class TwinColSelectTest extends MultiBrowserTest { List<WebElement> selects = getTwinColSelect() .findElements(By.tagName("select")); - Assert.assertEquals(2, selects.size()); - Assert.assertTrue(selects.stream() + assertEquals(2, selects.size()); + assertTrue(selects.stream() .allMatch(element -> element.getAttribute("disabled") != null)); List<WebElement> buttons = getTwinColSelect() .findElements(By.className("v-button")); - Assert.assertEquals(2, buttons.size()); - buttons.forEach(button -> Assert.assertEquals("v-button v-disabled", + assertEquals(2, buttons.size()); + buttons.forEach(button -> assertEquals("v-button v-disabled", button.getAttribute("className"))); selectItems("Item 4"); @@ -154,15 +153,15 @@ public class TwinColSelectTest extends MultiBrowserTest { assertElementNotPresent(By.className("v-disabled")); selectItems("Item 5"); - Assert.assertEquals("3. Selected: [Item 5]", getLogRow(0)); + assertEquals("3. Selected: [Item 5]", getLogRow(0)); assertSelected("Item 5"); selectItems("Item 2"); - Assert.assertEquals("4. Selected: [Item 5, Item 2]", getLogRow(0)); + assertEquals("4. Selected: [Item 5, Item 2]", getLogRow(0)); assertSelected("Item 2", "Item 5"); deselectItems("Item 5"); - Assert.assertEquals("5. Selected: [Item 2]", getLogRow(0)); + assertEquals("5. Selected: [Item 2]", getLogRow(0)); assertSelected("Item 2"); } @@ -178,7 +177,7 @@ public class TwinColSelectTest extends MultiBrowserTest { selectMenuPath("Component", "Item Generator", "Item Caption Generator", "Null Caption Generator"); for (String text : getTwinColSelect().getOptions()) { - Assert.assertEquals("", text); + assertEquals("", text); } } @@ -187,36 +186,35 @@ public class TwinColSelectTest extends MultiBrowserTest { selectMenuPath("Component", "Listeners", "Selection listener"); selectMenuPath("Component", "Selection", "Toggle Item 5"); - Assert.assertEquals("2. Selected: [Item 5]", getLogRow(0)); + assertEquals("2. Selected: [Item 5]", getLogRow(0)); assertSelected("Item 5"); selectMenuPath("Component", "Selection", "Toggle Item 1"); // Selection order (most recently selected is last) - Assert.assertEquals("4. Selected: [Item 5, Item 1]", getLogRow(0)); + assertEquals("4. Selected: [Item 5, Item 1]", getLogRow(0)); // DOM order assertSelected("Item 1", "Item 5"); selectMenuPath("Component", "Selection", "Toggle Item 5"); - Assert.assertEquals("6. Selected: [Item 1]", getLogRow(0)); + assertEquals("6. Selected: [Item 1]", getLogRow(0)); assertSelected("Item 1"); selectMenuPath("Component", "Selection", "Toggle items 0, 1, 5, 10, 25"); // currently non-existing items are added to selection! - Assert.assertEquals( - "8. Selected: [Item 1, Item 0, Item 5, Item 10, Item 25]", + assertEquals("8. Selected: [Item 1, Item 0, Item 5, Item 10, Item 25]", getLogRow(0)); assertSelected("Item 0", "Item 1", "Item 5", "Item 10"); } private void assertSelected(String... expectedSelection) { - Assert.assertEquals(Arrays.asList(expectedSelection), + assertEquals(Arrays.asList(expectedSelection), getTwinColSelect().getValues()); } private void assertNothingSelected() { - Assert.assertEquals(0, getTwinColSelect().getValues().size()); + assertEquals(0, getTwinColSelect().getValues().size()); } @Override @@ -284,7 +282,7 @@ public class TwinColSelectTest extends MultiBrowserTest { protected void assertOptionTexts(String... items) { List<String> optionTexts = getOptionsElement().getOptions().stream() .map(element -> element.getText()).collect(Collectors.toList()); - Assert.assertArrayEquals(items, optionTexts.toArray()); + assertArrayEquals(items, optionTexts.toArray()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java index 08e2a248b3..09549d0dba 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.ui; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -45,7 +46,7 @@ public class DynamicViewportEmptyTest extends MultiBrowserTest { List<WebElement> viewportElements = findElements( By.cssSelector("meta[name=viewport]")); - Assert.assertTrue("There should be no viewport tags", + assertTrue("There should be no viewport tags", viewportElements.isEmpty()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportTest.java index 56f365702e..73a4837119 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -31,7 +32,7 @@ public class DynamicViewportTest extends SingleBrowserTest { WebElement viewportElement = findElement( By.cssSelector("meta[name=viewport]")); - Assert.assertTrue( + assertTrue( viewportElement.getAttribute("content").contains("PhantomJS")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java index fc948ab3db..5d7e05ac85 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -25,6 +26,6 @@ public class InitiallyEmptyFragmentTest extends MultiBrowserTest { } private void assertLogText(String expected) { - Assert.assertEquals("Unexpected log contents,", expected, getLogRow(0)); + assertEquals("Unexpected log contents,", expected, getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/InvalidViewportTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/InvalidViewportTest.java index b6f8d6762c..470c24e5b4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/InvalidViewportTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/InvalidViewportTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -30,7 +31,7 @@ public class InvalidViewportTest extends SingleBrowserTest { WebElement heading = findElement(By.tagName("h2")); - Assert.assertEquals("HTTP ERROR 500", heading.getText()); + assertEquals("HTTP ERROR 500", heading.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java index 5470a8c229..d29f4f8759 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -20,8 +21,7 @@ public class RpcInvocationHandlerToStringTest extends MultiBrowserTest { $(ButtonElement.class) .caption("Exec " + method + " for an invocation proxy").first() .click(); - Assert.assertFalse( - method + " for invocation proxy caused a notification", + assertFalse(method + " for invocation proxy caused a notification", $(NotificationElement.class).exists()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/StaticViewportTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/StaticViewportTest.java index 5e4cd165fb..2828ad4d34 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/StaticViewportTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/StaticViewportTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -31,7 +32,6 @@ public class StaticViewportTest extends SingleBrowserTest { WebElement viewportElement = findElement( By.cssSelector("meta[name=viewport]")); - Assert.assertEquals("myViewport", - viewportElement.getAttribute("content")); + assertEquals("myViewport", viewportElement.getAttribute("content")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java index 2786e52849..ce26ab535d 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.ui; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; @@ -45,7 +46,7 @@ public class TextAreaEventPropagationModifierKeysTest extends MultiBrowserTest { builder.perform(); // Should have triggered shortcut - Assert.assertEquals("1. Shift-Enter button pressed", getLogRow(0)); + assertEquals("1. Shift-Enter button pressed", getLogRow(0)); } @Test @@ -64,7 +65,7 @@ public class TextAreaEventPropagationModifierKeysTest extends MultiBrowserTest { builder.perform(); // Should have triggered shortcut - Assert.assertEquals("1. Ctrl-Enter button pressed", getLogRow(0)); + assertEquals("1. Ctrl-Enter button pressed", getLogRow(0)); } @Override diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java index b49de55a56..8745f78e42 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -33,7 +34,6 @@ public class UIAccessExceptionHandlingTest extends MultiBrowserTest { } private void assertLogText(int index, String expected) { - Assert.assertEquals("Unexpected log contents,", expected, - getLogRow(index)); + assertEquals("Unexpected log contents,", expected, getLogRow(index)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java index 14975c63f6..73dfc8f77e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.ui; +import static org.junit.Assert.assertTrue; + import java.util.Locale; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -35,13 +36,12 @@ public class UIAutoGeneratedStyleNameTest extends MultiBrowserTest { public void testUiStyleName() { openTestURL(); - Assert.assertTrue( - "UI div element doesn't contain autogenerated style name", + assertTrue("UI div element doesn't contain autogenerated style name", containsStyle(getDriver().findElement(By.className("v-app")), UIAutoGeneratedStyleName.class.getSimpleName() .toLowerCase(Locale.ENGLISH))); - Assert.assertTrue( + assertTrue( "Overlays div element doesn't contain autogenerated style name", containsStyle( getDriver().findElement( diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java index 641ac6d82a..71d6871883 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + import org.junit.Test; import com.vaadin.testbench.elements.LabelElement; @@ -37,7 +39,7 @@ public class UIInitBrowserDetailsTest extends MultiBrowserTest { private void compareRequestAndBrowserValue(String paramName, String browserName, String errorValue) { assertTextNotEquals(browserName, errorValue); - Assert.assertEquals( + assertEquals( String.format("Browser and request values differ in '%s',", browserName), getLabelText(paramName), getLabelText(browserName)); @@ -53,7 +55,7 @@ public class UIInitBrowserDetailsTest extends MultiBrowserTest { private void assertTextNotEquals(String id, String notExpected) { String actual = getLabelText(id); - Assert.assertNotEquals(String.format("Unexpected value for '%s'", id), + assertNotEquals(String.format("Unexpected value for '%s'", id), notExpected, actual); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitExceptionTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitExceptionTest.java index 064132d4c7..dea9a22d7f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitExceptionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitExceptionTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -9,7 +10,7 @@ public class UIInitExceptionTest extends SingleBrowserTest { @Test public void testExceptionOnUIInit() throws Exception { openTestURL(); - Assert.assertTrue("Page does not contain the given text", + assertTrue("Page does not contain the given text", driver.getPageSource().contains("Catch me if you can")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIPollingTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIPollingTest.java index bfc856d1b1..11b343b3fa 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIPollingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIPollingTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.TextFieldElement; @@ -14,12 +16,12 @@ public class UIPollingTest extends MultiBrowserTest { getTextField().setValue("500"); sleep(2000); /* Ensure polling has taken place */ - Assert.assertTrue("Page does not contain the given text", + assertTrue("Page does not contain the given text", driver.getPageSource().contains("2. 1000ms has passed")); getTextField().setValue("-1"); sleep(2000); /* Ensure polling has stopped */ - Assert.assertFalse("Page contains the given text", + assertFalse("Page contains the given text", driver.getPageSource().contains("20. 10000ms has passed")); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIRefreshTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIRefreshTest.java index 3d038a2a5a..adc7da1a0d 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIRefreshTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIRefreshTest.java @@ -16,7 +16,9 @@ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.By; @@ -27,10 +29,10 @@ public class UIRefreshTest extends MultiBrowserTest { @Test public void testUIRefresh() { openTestURL(); - Assert.assertFalse(reinitLabelExists()); + assertFalse(reinitLabelExists()); // Reload the page; UI.refresh should be invoked openTestURL(); - Assert.assertTrue(reinitLabelExists()); + assertTrue(reinitLabelExists()); } private boolean reinitLabelExists() { diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UITabIndexTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UITabIndexTest.java index 390907ee8a..c5c9dc1ace 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UITabIndexTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UITabIndexTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -22,7 +23,7 @@ public class UITabIndexTest extends MultiBrowserTest { } private void assertTabIndex(String expected) { - Assert.assertEquals("Unexpected tab index,", expected, + assertEquals("Unexpected tab index,", expected, $(UIElement.class).first().getAttribute("tabIndex")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java index e703deb634..b053ef3880 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.LabelElement; @@ -19,7 +20,7 @@ public class UIsInMultipleTabsTest extends MultiBrowserTest { } private void assertUI(int i) { - Assert.assertEquals("Unexpected UI found,", "This is UI number " + i, + assertEquals("Unexpected UI found,", "This is UI number " + i, $(LabelElement.class).first().getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java index f74c5fa396..794d8f9bc2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; @@ -29,7 +30,7 @@ public class UiDependenciesInHtmlTest extends SingleBrowserTest { String statusText = findElement(By.id("statusBox")).getText(); - Assert.assertEquals( + assertEquals( "Script loaded before vaadinBootstrap.js: true\nStyle tag before vaadin theme: true\nStyle tags in correct order: true", statusText); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/VaadinFinderLocatorUISearchTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/VaadinFinderLocatorUISearchTest.java index 07362af46e..e65e2221b2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/VaadinFinderLocatorUISearchTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/VaadinFinderLocatorUISearchTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertNotNull; + import org.junit.Test; import com.vaadin.testbench.elements.UIElement; @@ -38,6 +39,6 @@ public class VaadinFinderLocatorUISearchTest extends MultiBrowserTest { public void getUIElementTest() { openTestURL(); UIElement ui = $(UIElement.class).first(); - Assert.assertNotNull("Couldn't find the UI Element on the page", ui); + assertNotNull("Couldn't find the UI Element on the page", ui); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java index 715025bf5e..1473918cdf 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.ui; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -40,10 +41,9 @@ public class WindowAndUIShortcutsTest extends SingleBrowserTest { window.$(TextFieldElement.class).first().sendKeys(Keys.ESCAPE); // Window should have been closed - Assert.assertTrue($(WindowElement.class).all().isEmpty()); + assertTrue($(WindowElement.class).all().isEmpty()); // "Close page" should not have been clicked - Assert.assertTrue( - $(ButtonElement.class).caption("Close page").exists()); + assertTrue($(ButtonElement.class).caption("Close page").exists()); } @Test @@ -56,8 +56,7 @@ public class WindowAndUIShortcutsTest extends SingleBrowserTest { By.className("v-window-modalitycurtain")); curtain.sendKeys(Keys.ESCAPE); // "Close page" should not have been clicked - Assert.assertTrue( - $(ButtonElement.class).caption("Close page").exists()); + assertTrue($(ButtonElement.class).caption("Close page").exists()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/upload/TestFileUploadTest.java b/uitest/src/test/java/com/vaadin/tests/components/upload/TestFileUploadTest.java index d3a4a39d05..5f17003090 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/upload/TestFileUploadTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/upload/TestFileUploadTest.java @@ -15,6 +15,8 @@ */ package com.vaadin.tests.components.upload; +import static org.junit.Assert.assertEquals; + import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; @@ -24,7 +26,6 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -59,7 +60,7 @@ public class TestFileUploadTest extends MultiBrowserTest { md5(getTempFileContents())); String actual = getLogRow(0); - Assert.assertEquals("Upload log row does not match expected", expected, + assertEquals("Upload log row does not match expected", expected, actual); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/upload/UploadNoSelectionTest.java b/uitest/src/test/java/com/vaadin/tests/components/upload/UploadNoSelectionTest.java index 3b7a208d27..35616e1ec7 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/upload/UploadNoSelectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/upload/UploadNoSelectionTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.upload; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -29,7 +30,7 @@ public class UploadNoSelectionTest extends MultiBrowserTest { openTestURL(); // empty content is populated by com.vaadin.tests.util.Log - Assert.assertEquals(" ", getLogRow(0)); + assertEquals(" ", getLogRow(0)); getSubmitButton().click(); @@ -50,7 +51,7 @@ public class UploadNoSelectionTest extends MultiBrowserTest { private void assertLogRow(int index, int expentedRowNo, String expectedValueWithoutRowNo) { - Assert.assertEquals(expentedRowNo + ". " + expectedValueWithoutRowNo, + assertEquals(expentedRowNo + ". " + expectedValueWithoutRowNo, getLogRow(index)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/upload/UploadTitleWithTooltipTest.java b/uitest/src/test/java/com/vaadin/tests/components/upload/UploadTitleWithTooltipTest.java index 5e0582d6d8..e4c9078a13 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/upload/UploadTitleWithTooltipTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/upload/UploadTitleWithTooltipTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.upload; +import static org.junit.Assert.assertNotNull; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -43,8 +44,7 @@ public class UploadTitleWithTooltipTest extends TooltipTest { } } - Assert.assertNotNull("Input element with type 'file' is not found", - input); + assertNotNull("Input element with type 'file' is not found", input); checkTooltip(input, "tooltip"); diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/CloseModalSubWindowTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/CloseModalSubWindowTest.java index 44cb094975..9058b142b1 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/CloseModalSubWindowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/CloseModalSubWindowTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.components.window; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -35,12 +36,12 @@ public class CloseModalSubWindowTest extends MultiBrowserTest { List<WebElement> buttons = getDriver() .findElements(By.id(CloseModalSubWindow.DELETE_BUTTON + "0")); int deleteButtonCount = buttons.size(); - Assert.assertEquals(1, deleteButtonCount); + assertEquals(1, deleteButtonCount); // assert that there's no sub-windows open List<WebElement> subWindows = getDriver() .findElements(By.id(CloseModalSubWindow.SUB_WINDOW)); - Assert.assertEquals(0, subWindows.size()); + assertEquals(0, subWindows.size()); // click the first delete button getFirstDeteleButton(0).click(); @@ -48,7 +49,7 @@ public class CloseModalSubWindowTest extends MultiBrowserTest { // assert that there's ONE sub-window open subWindows = getDriver() .findElements(By.id(CloseModalSubWindow.SUB_WINDOW)); - Assert.assertEquals(1, subWindows.size()); + assertEquals(1, subWindows.size()); WebElement confirm = getDriver() .findElement(By.id(CloseModalSubWindow.CONFIRM_BUTTON)); @@ -59,12 +60,12 @@ public class CloseModalSubWindowTest extends MultiBrowserTest { // assert that there's no sub-windows open subWindows = getDriver() .findElements(By.id(CloseModalSubWindow.SUB_WINDOW)); - Assert.assertEquals(0, subWindows.size()); + assertEquals(0, subWindows.size()); // assert that there's no button with 'del-btn0' id anymore buttons = getDriver() .findElements(By.id(CloseModalSubWindow.DELETE_BUTTON + "0")); - Assert.assertEquals(0, buttons.size()); + assertEquals(0, buttons.size()); } private WebElement getFirstDeteleButton(int index) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/CloseSubWindowTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/CloseSubWindowTest.java index 48ac923082..532b9ab419 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/CloseSubWindowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/CloseSubWindowTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; @@ -41,7 +42,7 @@ public class CloseSubWindowTest extends MultiBrowserTest { } private void assertLogText() { - Assert.assertEquals("Unexpected log contents,", + assertEquals("Unexpected log contents,", "1. Window 'Sub-window' closed", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/ExtraWindowShownTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/ExtraWindowShownTest.java index abbc7ddac0..88f5215514 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/ExtraWindowShownTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/ExtraWindowShownTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -31,7 +32,7 @@ public class ExtraWindowShownTest extends MultiBrowserTest { } private void assertNoWindow() { - Assert.assertFalse("Window found when there should be none.", + assertFalse("Window found when there should be none.", $(WindowElement.class).exists()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/MaximizeRestoreWindowWithManagedLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/MaximizeRestoreWindowWithManagedLayoutTest.java index a3a43b218b..bb402cd91a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/MaximizeRestoreWindowWithManagedLayoutTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/MaximizeRestoreWindowWithManagedLayoutTest.java @@ -15,12 +15,13 @@ */ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.Dimension; -import com.vaadin.testbench.elements.WindowElement; import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.testbench.elements.WindowElement; import com.vaadin.tests.tb3.MultiBrowserTest; public class MaximizeRestoreWindowWithManagedLayoutTest @@ -54,6 +55,6 @@ public class MaximizeRestoreWindowWithManagedLayoutTest private void assertSameWidth(WindowElement window, TextFieldElement field) { Dimension windowSize = window.getSize(); Dimension fieldSize = field.getSize(); - Assert.assertEquals(windowSize.getWidth(), fieldSize.getWidth()); + assertEquals(windowSize.getWidth(), fieldSize.getWidth()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/RepaintWindowContentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/RepaintWindowContentsTest.java index d097aa183c..2fa30b36f2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/RepaintWindowContentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/RepaintWindowContentsTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -26,7 +27,7 @@ public class RepaintWindowContentsTest extends MultiBrowserTest { } private void assertWindowContents(String expected) { - Assert.assertEquals("Unexpected window contents,", expected, + assertEquals("Unexpected window contents,", expected, getWindowButton().getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/ShortcutInWindowTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/ShortcutInWindowTest.java index 26041d8531..da4ea7b6a4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/ShortcutInWindowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/ShortcutInWindowTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.Keys; @@ -29,6 +30,6 @@ public class ShortcutInWindowTest extends SingleBrowserTest { openTestURL(); TextFieldElement tf = $(TextFieldElement.class).first(); tf.sendKeys("foo" + Keys.ENTER); - Assert.assertEquals("2. Submitted value: foo", getLogRow(0)); + assertEquals("2. Submitted value: foo", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java index dae3267d70..04ed75cb39 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.components.window; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; @@ -71,12 +73,12 @@ public class SubWindowsTextSelectionTest extends MultiBrowserTest { .executeScript("return document.getSelection().toString();") .toString(); - Assert.assertTrue("Text selection was not empty:" + selection, + assertTrue("Text selection was not empty:" + selection, selection.isEmpty()); // Verify also that window was really moved Point location2 = element.getLocation(); - Assert.assertEquals(location.getX() + (4 * 10), location2.getX()); + assertEquals(location.getX() + (4 * 10), location2.getX()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/WindowCaptionTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/WindowCaptionTest.java index 9807790330..8e960f7c2d 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/WindowCaptionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/WindowCaptionTest.java @@ -15,14 +15,15 @@ */ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.ExpectedCondition; -import com.vaadin.testbench.elements.WindowElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.WindowElement; import com.vaadin.tests.tb3.SingleBrowserTest; public class WindowCaptionTest extends SingleBrowserTest { @@ -41,9 +42,9 @@ public class WindowCaptionTest extends SingleBrowserTest { @Test public void htmlCaption() { - Assert.assertEquals("HtmlWindow's caption didn't match,", + assertEquals("HtmlWindow's caption didn't match,", "This may or may not be red", htmlWindow.getCaption()); - Assert.assertEquals("TextWindow's caption didn't match,", + assertEquals("TextWindow's caption didn't match,", "<font style='color: red;'>This may or may not be red</font>", textWindow.getCaption()); } @@ -86,7 +87,7 @@ public class WindowCaptionTest extends SingleBrowserTest { }); - Assert.assertEquals("TextWindow's caption didn't match,", - expectedCaption, textWindow.getCaption()); + assertEquals("TextWindow's caption didn't match,", expectedCaption, + textWindow.getCaption()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/WindowInUiWithNoContentTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/WindowInUiWithNoContentTest.java index c20207a6fd..089b6ed1f4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/WindowInUiWithNoContentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/WindowInUiWithNoContentTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -37,7 +38,7 @@ public class WindowInUiWithNoContentTest extends MultiBrowserTest { WebElement window = driver.findElement(By.className("v-window")); String position = window.getCssValue("position"); - Assert.assertEquals("Window element has non-absolute position and " + assertEquals("Window element has non-absolute position and " + "is broken in the UI", "absolute", position); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/WindowMaxHeightTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/WindowMaxHeightTest.java index 450d72dc91..74e8d8611e 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/WindowMaxHeightTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/WindowMaxHeightTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.Dimension; @@ -29,8 +30,7 @@ public class WindowMaxHeightTest extends SingleBrowserTest { openTestURL(); WindowElement window = $(WindowElement.class).first(); Dimension size = window.getSize(); - Assert.assertTrue( - "Window should be 200-250px high, was " + size.getHeight(), + assertTrue("Window should be 200-250px high, was " + size.getHeight(), size.getHeight() < 250); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/WindowOrderTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/WindowOrderTest.java index 1ab131a920..0fafc6afe9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/WindowOrderTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/WindowOrderTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -46,25 +47,25 @@ public class WindowOrderTest extends MultiBrowserTest { // Bring the first window to front and check order positions of the // windows findElement(By.className("bring-to-front-first")).click(); - Assert.assertTrue( + assertTrue( "The first window has wrong order position after bring first to front", hasOrder("window1", 2)); - Assert.assertTrue( + assertTrue( "The first window position is incorrectly updated via UI listener after bring first to front", hasOrderInUi("window1", 2)); - Assert.assertTrue( + assertTrue( "The second window has wrong order position after bring first to front", hasOrder("window2", 0)); - Assert.assertTrue( + assertTrue( "The second window position is incorrectly updated via UI after bring first to front", hasOrderInUi("window2", 0)); - Assert.assertTrue( + assertTrue( "The third window has wrong order position after bring first to front", hasOrder("window3", 1)); - Assert.assertTrue( + assertTrue( "The third window position is incorrectly updated via UI after bring first to front", hasOrderInUi("window3", 1)); - Assert.assertTrue( + assertTrue( "Last window is not attached and should have '-1' position, but hasn't.", lastWindowHasOrder(-1)); } @@ -75,25 +76,25 @@ public class WindowOrderTest extends MultiBrowserTest { // windows findElement(By.className("bring-to-front-all")).click(); - Assert.assertTrue( + assertTrue( "The first window has wrong order position after bring all to front", hasOrder("window2", 2)); - Assert.assertTrue( + assertTrue( "The first window position is incorrectly updated via UI after bring all to front", hasOrderInUi("window2", 2)); - Assert.assertTrue( + assertTrue( "The second window has wrong order position after bring all to front", hasOrder("window1", 1)); - Assert.assertTrue( + assertTrue( "The second window position is incorrectly updated via UI after bring all to front", hasOrderInUi("window1", 1)); - Assert.assertTrue( + assertTrue( "The third window has wrong order position after bring all to front", hasOrder("window3", 0)); - Assert.assertTrue( + assertTrue( "The third window position is incorrectly updated via UI after bring all to front", hasOrderInUi("window3", 0)); - Assert.assertTrue( + assertTrue( "Last window is not attached and should have '-1' position, but hasn't.", lastWindowHasOrder(-1)); } @@ -103,25 +104,25 @@ public class WindowOrderTest extends MultiBrowserTest { // windows findElement(By.className("detach-window")).click(); - Assert.assertTrue( + assertTrue( "The first window has wrong order position after detach last window", hasOrder("window2", 1)); - Assert.assertTrue( + assertTrue( "The first window position is incorrectly updated after detach last window", hasOrderInUi("window2", 1)); - Assert.assertTrue( + assertTrue( "The second window has wrong order position after detach last window", hasOrder("window1", 0)); - Assert.assertTrue( + assertTrue( "The second window position is incorrectly updated after detach last window", hasOrderInUi("window1", 0)); WebElement thirdWindowInfo = findElement(By.className("w3-detached")); - Assert.assertTrue("The third window has wrong order after detach", + assertTrue("The third window has wrong order after detach", thirdWindowInfo.getAttribute("class").contains("w3--1")); - Assert.assertTrue( + assertTrue( "The third window position is incorrectly updated after detach last window", hasOrderInUi("window3", -1)); - Assert.assertTrue( + assertTrue( "Last window is not attached and should have '-1' position, but hasn't.", lastWindowHasOrder(-1)); } @@ -131,22 +132,22 @@ public class WindowOrderTest extends MultiBrowserTest { // windows findElement(By.className("add-window")).click(); - Assert.assertTrue( + assertTrue( "The first window has wrong order position after add new window", hasOrder("window2", 1)); - Assert.assertTrue( + assertTrue( "The first window position is incorrectly updated after add new window", hasOrderInUi("window2", 1)); - Assert.assertTrue( + assertTrue( "The second window has wrong order position after add new window", hasOrder("window1", 0)); - Assert.assertTrue( + assertTrue( "The second window position is incorrectly updated after add new window", hasOrderInUi("window1", 0)); - Assert.assertTrue( + assertTrue( "The last window has wrong order position after add new window", hasOrder("window4", 2)); - Assert.assertTrue( + assertTrue( "The last window position is incorrectly updated after add new window", hasOrderInUi("window4", 2)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/WindowShouldRemoveActionHandlerTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/WindowShouldRemoveActionHandlerTest.java index 179e904d0e..b36b9567d2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/WindowShouldRemoveActionHandlerTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/WindowShouldRemoveActionHandlerTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -45,7 +46,7 @@ public class WindowShouldRemoveActionHandlerTest extends MultiBrowserTest { } private void assertState(String expected) { - Assert.assertEquals("Unexpected state,", expected, + assertEquals("Unexpected state,", expected, $(LabelElement.class).id("state").getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/WindowWithInvalidCloseListenerTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/WindowWithInvalidCloseListenerTest.java index b77eced9cc..6cffb9ac45 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/WindowWithInvalidCloseListenerTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/WindowWithInvalidCloseListenerTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Test; import org.openqa.selenium.By; @@ -13,7 +14,7 @@ public class WindowWithInvalidCloseListenerTest extends MultiBrowserTest { openTestURL(); $(WindowElement.class).first() .findElement(By.className("v-window-closebox")).click(); - Assert.assertFalse("Window found when there should be none.", + assertFalse("Window found when there should be none.", $(WindowElement.class).exists()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/contextclick/AbstractContextClickTest.java b/uitest/src/test/java/com/vaadin/tests/contextclick/AbstractContextClickTest.java index 8497ec8eed..db31e89064 100644 --- a/uitest/src/test/java/com/vaadin/tests/contextclick/AbstractContextClickTest.java +++ b/uitest/src/test/java/com/vaadin/tests/contextclick/AbstractContextClickTest.java @@ -16,12 +16,12 @@ package com.vaadin.tests.contextclick; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.Point; @@ -87,10 +87,8 @@ public abstract class AbstractContextClickTest extends MultiBrowserTest { Point l = component.getLocation(); Matcher matcher = defaultLog.matcher(getLogRow(0)); - Assert.assertTrue( - "Log row content did not match default listener output: " - + getLogRow(0), - matcher.find()); + assertTrue("Log row content did not match default listener output: " + + getLogRow(0), matcher.find()); int xCoord = Integer.parseInt(matcher.group(1)); int yCoord = Integer.parseInt(matcher.group(2)); @@ -98,11 +96,11 @@ public abstract class AbstractContextClickTest extends MultiBrowserTest { int xExpected = l.getX() + x; int yExpected = l.getY() + y; - Assert.assertTrue( + assertTrue( "X Coordinate differs too much from expected. Expected: " + xExpected + ", actual: " + xCoord, Math.abs(xExpected - xCoord) <= 1); - Assert.assertTrue( + assertTrue( "Y Coordinate differs too much from expected. Expected: " + yExpected + ", actual: " + yCoord, Math.abs(yExpected - yCoord) <= 1); diff --git a/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java b/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java index 12cfb45d07..158167c8d9 100644 --- a/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.core; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -17,17 +18,15 @@ public class SpecialCharactersEncodingUITest extends SingleBrowserTest { openTestURL(); String textFieldValue = $(TextFieldElement.class).id("textfield") .getValue(); - Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj, - textFieldValue); + assertEquals(SpecialCharactersEncodingUI.textWithZwnj, textFieldValue); LabelElement label = $(LabelElement.class).id("label"); String labelValue = getHtml(label); // getText() strips some characters - Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj, - labelValue); + assertEquals(SpecialCharactersEncodingUI.textWithZwnj, labelValue); MenuBarElement menubar = $(MenuBarElement.class).first(); WebElement menuItem = menubar .findElement(By.className("v-menubar-menuitem-caption")); - Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj, + assertEquals(SpecialCharactersEncodingUI.textWithZwnj, getHtml(menuItem)); } diff --git a/uitest/src/test/java/com/vaadin/tests/data/DataProviderRefreshTest.java b/uitest/src/test/java/com/vaadin/tests/data/DataProviderRefreshTest.java index f32ec543a8..bbb31535a8 100644 --- a/uitest/src/test/java/com/vaadin/tests/data/DataProviderRefreshTest.java +++ b/uitest/src/test/java/com/vaadin/tests/data/DataProviderRefreshTest.java @@ -1,6 +1,9 @@ package com.vaadin.tests.data; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -13,25 +16,24 @@ public class DataProviderRefreshTest extends SingleBrowserTest { public void select_and_replace() { openTestURL(); GridElement grid = $(GridElement.class).first(); - Assert.assertFalse("Row should not be initially selected", + assertFalse("Row should not be initially selected", grid.getRow(0).isSelected()); // Select item before replace $(ButtonElement.class).caption("Select old").first().click(); - Assert.assertTrue("Row should be selected", - grid.getRow(0).isSelected()); + assertTrue("Row should be selected", grid.getRow(0).isSelected()); $(ButtonElement.class).caption("Replace item").first().click(); - Assert.assertTrue("Row should still be selected after item replace", + assertTrue("Row should still be selected after item replace", grid.getRow(0).isSelected()); - Assert.assertEquals("Grid content was not updated.", "{ Bar, 10 }", + assertEquals("Grid content was not updated.", "{ Bar, 10 }", grid.getCell(0, 0).getText()); // Deselect row grid.getCell(0, 0).click(); - Assert.assertFalse("Row should be deselected after click", + assertFalse("Row should be deselected after click", grid.getRow(0).isSelected()); - Assert.assertEquals("Second row was affected", "{ Baz, 11 }", + assertEquals("Second row was affected", "{ Baz, 11 }", grid.getCell(1, 0).getText()); } @@ -39,28 +41,27 @@ public class DataProviderRefreshTest extends SingleBrowserTest { public void replace_and_select() { openTestURL(); GridElement grid = $(GridElement.class).first(); - Assert.assertFalse("Row should not be initially selected", + assertFalse("Row should not be initially selected", grid.getRow(0).isSelected()); // Replace item before select $(ButtonElement.class).caption("Replace item").first().click(); - Assert.assertFalse("Row should not be selected after item replace", + assertFalse("Row should not be selected after item replace", grid.getRow(0).isSelected()); - Assert.assertEquals("Grid content was not updated.", "{ Bar, 10 }", + assertEquals("Grid content was not updated.", "{ Bar, 10 }", grid.getCell(0, 0).getText()); $(ButtonElement.class).caption("Select old").first().click(); - Assert.assertTrue("Row should be selected", - grid.getRow(0).isSelected()); - Assert.assertEquals("Grid content should not update.", "{ Bar, 10 }", + assertTrue("Row should be selected", grid.getRow(0).isSelected()); + assertEquals("Grid content should not update.", "{ Bar, 10 }", grid.getCell(0, 0).getText()); // Deselect row grid.getCell(0, 0).click(); - Assert.assertFalse("Row should be deselected after click", + assertFalse("Row should be deselected after click", grid.getRow(0).isSelected()); - Assert.assertEquals("Second row was affected", "{ Baz, 11 }", + assertEquals("Second row was affected", "{ Baz, 11 }", grid.getCell(1, 0).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/data/GridRefreshWithGetIdTest.java b/uitest/src/test/java/com/vaadin/tests/data/GridRefreshWithGetIdTest.java index c3bda4f3ca..83da78712e 100644 --- a/uitest/src/test/java/com/vaadin/tests/data/GridRefreshWithGetIdTest.java +++ b/uitest/src/test/java/com/vaadin/tests/data/GridRefreshWithGetIdTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.data; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -15,13 +17,11 @@ public class GridRefreshWithGetIdTest extends SingleBrowserTest { // Select item GridElement grid = $(GridElement.class).first(); grid.getCell(2, 0).click(); - Assert.assertTrue("Row should be selected", - grid.getRow(2).isSelected()); - Assert.assertEquals("green", grid.getCell(2, 0).getText()); + assertTrue("Row should be selected", grid.getRow(2).isSelected()); + assertEquals("green", grid.getCell(2, 0).getText()); $(ButtonElement.class).first().click(); - Assert.assertTrue("Row was no longer selected", - grid.getRow(2).isSelected()); - Assert.assertEquals("black", grid.getCell(2, 0).getText()); + assertTrue("Row was no longer selected", grid.getRow(2).isSelected()); + assertEquals("black", grid.getCell(2, 0).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/data/ReplaceDataProviderTest.java b/uitest/src/test/java/com/vaadin/tests/data/ReplaceDataProviderTest.java index 41731296ac..c64a06600e 100644 --- a/uitest/src/test/java/com/vaadin/tests/data/ReplaceDataProviderTest.java +++ b/uitest/src/test/java/com/vaadin/tests/data/ReplaceDataProviderTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.data; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import org.junit.Before; import org.junit.Test; @@ -21,19 +23,19 @@ public class ReplaceDataProviderTest extends SingleBrowserTest { ButtonElement replaceDataProviderButton = $(ButtonElement.class) .first(); - Assert.assertEquals(20, grid.getRowCount()); + assertEquals(20, grid.getRowCount()); grid.getCell(0, 0).click(); assertCellText("a", 0, 0); replaceDataProviderButton.click(); - Assert.assertEquals(10, grid.getRowCount()); + assertEquals(10, grid.getRowCount()); assertCellText("b", 0, 0); for (int i = 1; i < 10; i++) { assertCellText("a", i, 0); } - Assert.assertFalse(grid.getRow(0).isSelected()); + assertFalse(grid.getRow(0).isSelected()); grid.getCell(0, 0).click(); assertCellText("b", 0, 0); @@ -47,6 +49,6 @@ public class ReplaceDataProviderTest extends SingleBrowserTest { private void assertCellText(String text, int rowIndex, int colIndex) { String firstCellText = $(GridElement.class).first() .getCell(rowIndex, colIndex).getText(); - Assert.assertEquals(text, firstCellText); + assertEquals(text, firstCellText); } } diff --git a/uitest/src/test/java/com/vaadin/tests/dd/DDInterruptTest.java b/uitest/src/test/java/com/vaadin/tests/dd/DDInterruptTest.java index b34a56ac09..856ab7bba9 100644 --- a/uitest/src/test/java/com/vaadin/tests/dd/DDInterruptTest.java +++ b/uitest/src/test/java/com/vaadin/tests/dd/DDInterruptTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.dd; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; @@ -69,13 +70,12 @@ public class DDInterruptTest extends MultiBrowserTest { } private void assertNoNotifications() { - Assert.assertEquals( - "Notification found when there should have been none,", 0, + assertEquals("Notification found when there should have been none,", 0, findElements(By.className("v-Notification")).size()); } private void assertDragged(boolean dragged) { - Assert.assertEquals("Unexpected drag state,", dragged ? 1 : 0, + assertEquals("Unexpected drag state,", dragged ? 1 : 0, findElements(By.className("v-ddwrapper-over-bottom")).size()); } diff --git a/uitest/src/test/java/com/vaadin/tests/debug/PreserveCustomDebugSectionOpenTest.java b/uitest/src/test/java/com/vaadin/tests/debug/PreserveCustomDebugSectionOpenTest.java index c8a7fa3d22..32c772b67b 100644 --- a/uitest/src/test/java/com/vaadin/tests/debug/PreserveCustomDebugSectionOpenTest.java +++ b/uitest/src/test/java/com/vaadin/tests/debug/PreserveCustomDebugSectionOpenTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.debug; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -36,12 +37,12 @@ public class PreserveCustomDebugSectionOpenTest extends SingleBrowserTest { By.cssSelector(".v-debugwindow-content")); // Sanity check - Assert.assertEquals("Dummy debug window section", content.getText()); + assertEquals("Dummy debug window section", content.getText()); // Open page again, should still have the same section open openTestURL(); content = findElement(By.cssSelector(".v-debugwindow-content")); - Assert.assertEquals("Dummy debug window section", content.getText()); + assertEquals("Dummy debug window section", content.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/debug/ProfilerZeroOverheadTest.java b/uitest/src/test/java/com/vaadin/tests/debug/ProfilerZeroOverheadTest.java index fff3f012cf..d4df441ac3 100644 --- a/uitest/src/test/java/com/vaadin/tests/debug/ProfilerZeroOverheadTest.java +++ b/uitest/src/test/java/com/vaadin/tests/debug/ProfilerZeroOverheadTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.debug; -import org.junit.Assert; +import static org.junit.Assert.fail; + import org.junit.Test; import org.openqa.selenium.By; @@ -45,7 +46,7 @@ public class ProfilerZeroOverheadTest extends SingleBrowserTest { // Method body shouldn't contain anything else than whitespace if (!methodBody.replaceAll("\\s", "").isEmpty()) { - Assert.fail("Canary method is not empty: " + canaryMethodString); + fail("Canary method is not empty: " + canaryMethodString); } } } diff --git a/uitest/src/test/java/com/vaadin/tests/debug/PushVersionInfoTest.java b/uitest/src/test/java/com/vaadin/tests/debug/PushVersionInfoTest.java index 9e9d1e969c..351cfa1e59 100644 --- a/uitest/src/test/java/com/vaadin/tests/debug/PushVersionInfoTest.java +++ b/uitest/src/test/java/com/vaadin/tests/debug/PushVersionInfoTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.debug; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -39,9 +41,9 @@ public class PushVersionInfoTest extends SingleBrowserTest { openTestURL(); selectInfoTab(); - Assert.assertNull("Found push info server string for disabled Push", + assertNull("Found push info server string for disabled Push", getPushRowValue("Push server version")); - Assert.assertNull("Found push info client string for disabled Push", + assertNull("Found push info client string for disabled Push", getPushRowValue("Push client version")); } @@ -54,13 +56,12 @@ public class PushVersionInfoTest extends SingleBrowserTest { WebElement pushRow = getPushRowValue("Push server version"); String atmVersion = findElement(By.className("atmosphere-version")) .getText(); - Assert.assertTrue("Push row doesn't contain Atmosphere version", + assertTrue("Push row doesn't contain Atmosphere version", pushRow.getText().contains(atmVersion)); String jsString = getPushRowValue("Push client version").getText(); - Assert.assertTrue("Push client version doesn't contain 'vaadin' string", + assertTrue("Push client version doesn't contain 'vaadin' string", jsString.contains("vaadin")); - Assert.assertTrue( - "Push client version doesn't contain 'javascript' string", + assertTrue("Push client version doesn't contain 'javascript' string", jsString.contains("javascript")); } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityComponentElementGetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityComponentElementGetValueTest.java index 0dd504732b..3903876386 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityComponentElementGetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityComponentElementGetValueTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.elements; +import static org.junit.Assert.assertEquals; + import java.text.SimpleDateFormat; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -47,7 +48,7 @@ public class CompatibilityComponentElementGetValueTest ComboBoxElement elem = $(ComboBoxElement.class).get(0); String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -55,7 +56,7 @@ public class CompatibilityComponentElementGetValueTest ListSelectElement elem = $(ListSelectElement.class).get(0); String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -63,7 +64,7 @@ public class CompatibilityComponentElementGetValueTest NativeSelectElement elem = $(NativeSelectElement.class).get(0); String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -71,7 +72,7 @@ public class CompatibilityComponentElementGetValueTest OptionGroupElement elem = $(OptionGroupElement.class).get(0); String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -79,7 +80,7 @@ public class CompatibilityComponentElementGetValueTest TwinColSelectElement elem = $(TwinColSelectElement.class).get(0); String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -105,7 +106,7 @@ public class CompatibilityComponentElementGetValueTest CheckBoxElement cb = $(CheckBoxElement.class).get(0); String expected = "checked"; String actual = cb.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -115,12 +116,12 @@ public class CompatibilityComponentElementGetValueTest String expected = format1 .format(CompatibilityComponentElementGetValue.TEST_DATE_VALUE); String actual = df.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } private void checkValue(AbstractTextFieldElement elem) { String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityElementComponentGetCaptionBaseTest.java b/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityElementComponentGetCaptionBaseTest.java index a44534102f..bbebfc6c01 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityElementComponentGetCaptionBaseTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityElementComponentGetCaptionBaseTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.elements; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; @@ -128,7 +129,7 @@ public abstract class CompatibilityElementComponentGetCaptionBaseTest private void testCaption(AbstractComponentElement elem, int caption_index) { String actual = elem.getCaption(); String expected = CompatibilityElementComponentGetCaptionBase.DEFAULT_CAPTIONS[caption_index]; - Assert.assertTrue("Error with class:" + elem.getAttribute("class"), + assertTrue("Error with class:" + elem.getAttribute("class"), expected.equals(actual)); } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/ComponentElementGetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/ComponentElementGetValueTest.java index de4a6785c4..bd1ea57eaf 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/ComponentElementGetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/ComponentElementGetValueTest.java @@ -15,11 +15,12 @@ */ package com.vaadin.tests.elements; +import static org.junit.Assert.assertEquals; + import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.List; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -49,7 +50,7 @@ public class ComponentElementGetValueTest extends MultiBrowserTest { ComboBoxElement elem = $(ComboBoxElement.class).get(0); String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -57,7 +58,7 @@ public class ComponentElementGetValueTest extends MultiBrowserTest { ListSelectElement elem = $(ListSelectElement.class).get(0); String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -65,7 +66,7 @@ public class ComponentElementGetValueTest extends MultiBrowserTest { NativeSelectElement elem = $(NativeSelectElement.class).get(0); String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -74,7 +75,7 @@ public class ComponentElementGetValueTest extends MultiBrowserTest { List<String> expected = Collections .singletonList(ComponentElementGetValue.TEST_STRING_VALUE); List<String> actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -82,7 +83,7 @@ public class ComponentElementGetValueTest extends MultiBrowserTest { RadioButtonGroupElement elem = $(RadioButtonGroupElement.class).get(0); String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -90,7 +91,7 @@ public class ComponentElementGetValueTest extends MultiBrowserTest { TwinColSelectElement elem = $(TwinColSelectElement.class).get(0); String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -116,7 +117,7 @@ public class ComponentElementGetValueTest extends MultiBrowserTest { CheckBoxElement cb = $(CheckBoxElement.class).get(0); String expected = "checked"; String actual = cb.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } @Test @@ -126,12 +127,12 @@ public class ComponentElementGetValueTest extends MultiBrowserTest { String expected = formatter .format(ComponentElementGetValue.TEST_DATE_VALUE); String actual = df.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } private void checkValue(AbstractTextFieldElement elem) { String expected = ComponentElementGetValue.TEST_STRING_VALUE; String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/ElementComponentGetCaptionBaseTest.java b/uitest/src/test/java/com/vaadin/tests/elements/ElementComponentGetCaptionBaseTest.java index 6e6a9c2b4a..412900b368 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/ElementComponentGetCaptionBaseTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/ElementComponentGetCaptionBaseTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.elements; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; @@ -189,7 +190,7 @@ public abstract class ElementComponentGetCaptionBaseTest private void testCaption(AbstractComponentElement elem, int caption_index) { String actual = elem.getCaption(); String expected = ElementComponentGetCaptionBase.DEFAULT_CAPTIONS[caption_index]; - Assert.assertTrue("Error with class:" + elem.getAttribute("class"), + assertTrue("Error with class:" + elem.getAttribute("class"), expected.equals(actual)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/ElementQueryUITest.java b/uitest/src/test/java/com/vaadin/tests/elements/ElementQueryUITest.java index b8f3d8d207..786d98991e 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/ElementQueryUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/ElementQueryUITest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.elements; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -13,16 +14,14 @@ public class ElementQueryUITest extends MultiBrowserTest { @Test public void firstGetAllLast() { openTestURL(); - Assert.assertEquals("Button 0", - $(ButtonElement.class).first().getCaption()); - Assert.assertEquals("Button 9", - $(ButtonElement.class).last().getCaption()); + assertEquals("Button 0", $(ButtonElement.class).first().getCaption()); + assertEquals("Button 9", $(ButtonElement.class).last().getCaption()); List<ButtonElement> all = $(ButtonElement.class).all(); for (int i = 0; i < 10; i++) { - Assert.assertEquals("Button " + i, all.get(i).getCaption()); - Assert.assertEquals("Button " + i, + assertEquals("Button " + i, all.get(i).getCaption()); + assertEquals("Button " + i, $(ButtonElement.class).get(i).getCaption()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/TestBenchElementClearValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/TestBenchElementClearValueTest.java index 9237a541e0..e20963edde 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/TestBenchElementClearValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/TestBenchElementClearValueTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.elements; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.time.format.DateTimeFormatter; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -70,7 +72,7 @@ public class TestBenchElementClearValueTest extends MultiBrowserTest { public void clearTextField() { TextFieldElement elem = $(TextFieldElement.class).get(0); checkElementValue(elem); - Assert.assertEquals(ComponentElementGetValue.FIELD_VALUES[0], + assertEquals(ComponentElementGetValue.FIELD_VALUES[0], labelChangeValue.getText()); } @@ -78,7 +80,7 @@ public class TestBenchElementClearValueTest extends MultiBrowserTest { public void clearTextArea() { TextAreaElement elem = $(TextAreaElement.class).get(0); checkElementValue(elem); - Assert.assertEquals(ComponentElementGetValue.FIELD_VALUES[1], + assertEquals(ComponentElementGetValue.FIELD_VALUES[1], labelChangeValue.getText()); } @@ -86,7 +88,7 @@ public class TestBenchElementClearValueTest extends MultiBrowserTest { public void clearPasswordField() { PasswordFieldElement elem = $(PasswordFieldElement.class).get(0); checkElementValue(elem); - Assert.assertEquals(ComponentElementGetValue.FIELD_VALUES[2], + assertEquals(ComponentElementGetValue.FIELD_VALUES[2], labelChangeValue.getText()); } @@ -97,10 +99,10 @@ public class TestBenchElementClearValueTest extends MultiBrowserTest { String expected = formatter .format(ComponentElementGetValue.TEST_DATE_VALUE); String initial = df.getValue(); - Assert.assertEquals(expected, initial); + assertEquals(expected, initial); df.clear(); - Assert.assertEquals("", df.getValue()); - Assert.assertEquals(ComponentElementGetValue.DATEFIELD_VALUE_CHANGE, + assertEquals("", df.getValue()); + assertEquals(ComponentElementGetValue.DATEFIELD_VALUE_CHANGE, labelChangeValue.getText()); } @@ -134,8 +136,8 @@ public class TestBenchElementClearValueTest extends MultiBrowserTest { public void clearCheckBox() { CheckBoxElement elem = $(CheckBoxElement.class).get(0); elem.clear(); - Assert.assertTrue(elem.getValue().equals("unchecked")); - Assert.assertEquals(ComponentElementGetValue.CHECKBOX_VALUE_CHANGE, + assertTrue(elem.getValue().equals("unchecked")); + assertEquals(ComponentElementGetValue.CHECKBOX_VALUE_CHANGE, labelChangeValue.getText()); } @@ -143,8 +145,8 @@ public class TestBenchElementClearValueTest extends MultiBrowserTest { public void clearTwinCol() { TwinColSelectElement elem = $(TwinColSelectElement.class).get(0); elem.clear(); - Assert.assertEquals("", elem.getValue()); - Assert.assertEquals(ComponentElementGetValue.MULTI_SELECT_VALUE_CHANGE, + assertEquals("", elem.getValue()); + assertEquals(ComponentElementGetValue.MULTI_SELECT_VALUE_CHANGE, labelChangeValue.getText()); } @@ -158,11 +160,11 @@ public class TestBenchElementClearValueTest extends MultiBrowserTest { String expected) { // check initial element value String actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); // check cleared element value elem.clear(); expected = ""; actual = elem.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/TestBenchElementRightClickTest.java b/uitest/src/test/java/com/vaadin/tests/elements/TestBenchElementRightClickTest.java index 866776c70b..3dc83e04b9 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/TestBenchElementRightClickTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/TestBenchElementRightClickTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -25,8 +26,7 @@ public class TestBenchElementRightClickTest extends MultiBrowserTest { cell.contextClick(); String actual = label.getText(); String expected = "RightClick"; - Assert.assertEquals("TestBenchElement right click fails", expected, - actual); + assertEquals("TestBenchElement right click fails", expected, actual); } @@ -35,7 +35,6 @@ public class TestBenchElementRightClickTest extends MultiBrowserTest { cell.doubleClick(); String actual = label.getText(); String expected = "DoubleClick"; - Assert.assertEquals("TestBenchElement double click fails", expected, - actual); + assertEquals("TestBenchElement double click fails", expected, actual); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/TreeElementGetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/TreeElementGetValueTest.java index 151992ce63..67ba411c6d 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/TreeElementGetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/TreeElementGetValueTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.elements; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -31,7 +32,6 @@ public class TreeElementGetValueTest extends MultiBrowserTest { @Test public void testGetValue() { TreeElement tree = $(TreeElement.class).get(0); - Assert.assertEquals(tree.getValue(), - TreeElementGetValue.TEST_VALUE_LVL2); + assertEquals(tree.getValue(), TreeElementGetValue.TEST_VALUE_LVL2); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/abstracttextfield/AbstractTextElementSetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/abstracttextfield/AbstractTextElementSetValueTest.java index 587836fa6a..e1b9960908 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/abstracttextfield/AbstractTextElementSetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/abstracttextfield/AbstractTextElementSetValueTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.elements.abstracttextfield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -65,7 +66,7 @@ public class AbstractTextElementSetValueTest extends MultiBrowserTest { // we can type any string in date field element elem.setValue(TYPED_STRING); // invalid values should stay unchanged - Assert.assertEquals(TYPED_STRING, elem.getValue()); + assertEquals(TYPED_STRING, elem.getValue()); } // helper methods @@ -73,15 +74,15 @@ public class AbstractTextElementSetValueTest extends MultiBrowserTest { private void checkType(AbstractTextFieldElement elem, LabelElement eventCount) { // check first that the initial value is set - Assert.assertEquals(AbstractTextElementSetValue.INITIAL_VALUE, + assertEquals(AbstractTextElementSetValue.INITIAL_VALUE, elem.getValue()); elem.setValue(TYPED_STRING); // check that typed value is the same - Assert.assertEquals(TYPED_STRING, elem.getValue()); + assertEquals(TYPED_STRING, elem.getValue()); // checks that there was only one change value event - Assert.assertEquals("1", eventCount.getText()); + assertEquals("1", eventCount.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/abstracttextfield/CompatibilityAbstractTextElementSetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/abstracttextfield/CompatibilityAbstractTextElementSetValueTest.java index d96f5df84a..5f1b20ee31 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/abstracttextfield/CompatibilityAbstractTextElementSetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/abstracttextfield/CompatibilityAbstractTextElementSetValueTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.elements.abstracttextfield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -60,8 +61,8 @@ public class CompatibilityAbstractTextElementSetValueTest LabelElement eventCount = $(LabelElement.class).get(4); // we can type any string in date field element elem.setValue(TYPED_STRING); - Assert.assertEquals(TYPED_STRING, elem.getValue()); - Assert.assertEquals("1", eventCount.getText()); + assertEquals(TYPED_STRING, elem.getValue()); + assertEquals("1", eventCount.getText()); } // helper methods @@ -69,16 +70,15 @@ public class CompatibilityAbstractTextElementSetValueTest private void checkType(AbstractTextFieldElement elem, LabelElement eventCount) { // check first that the initial value is set - Assert.assertEquals( - CompatibilityAbstractTextElementSetValue.INITIAL_VALUE, + assertEquals(CompatibilityAbstractTextElementSetValue.INITIAL_VALUE, elem.getValue()); elem.setValue(TYPED_STRING); // check that typed value is the same - Assert.assertEquals(TYPED_STRING, elem.getValue()); + assertEquals(TYPED_STRING, elem.getValue()); // checks that there was only one change value event - Assert.assertEquals("1", eventCount.getText()); + assertEquals("1", eventCount.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/button/ButtonUITest.java b/uitest/src/test/java/com/vaadin/tests/elements/button/ButtonUITest.java index c5a166f8f5..f6c92c7870 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/button/ButtonUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/button/ButtonUITest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.button; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -21,7 +22,7 @@ public class ButtonUITest extends MultiBrowserTest { .id(ButtonUI.QUIET_BUTTON_ID); TextFieldElement field = $(TextFieldElement.class).first(); button.click(); - Assert.assertEquals("Clicked", field.getValue()); + assertEquals("Clicked", field.getValue()); } @Test @@ -30,7 +31,7 @@ public class ButtonUITest extends MultiBrowserTest { .id(ButtonUI.QUIET_BUTTON_NO_CAPTION_ID); TextFieldElement field = $(TextFieldElement.class).first(); button.click(); - Assert.assertEquals("Clicked", field.getValue()); + assertEquals("Clicked", field.getValue()); } @Test @@ -41,7 +42,7 @@ public class ButtonUITest extends MultiBrowserTest { TextFieldElement field = $(TextFieldElement.class) .id(ButtonUI.TEXT_FIELD_ID); button.click(); - Assert.assertEquals("Clicked", field.getValue()); + assertEquals("Clicked", field.getValue()); } @Test @@ -52,6 +53,6 @@ public class ButtonUITest extends MultiBrowserTest { LabelElement label = $(LabelElement.class).id(ButtonUI.LABEL_ID); button.click(); - Assert.assertEquals("Clicked", label.getText()); + assertEquals("Clicked", label.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/checkboxgroup/CheckBoxGroupSetSelectionTest.java b/uitest/src/test/java/com/vaadin/tests/elements/checkboxgroup/CheckBoxGroupSetSelectionTest.java index cb244873d8..0eedf14b38 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/checkboxgroup/CheckBoxGroupSetSelectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/checkboxgroup/CheckBoxGroupSetSelectionTest.java @@ -1,10 +1,11 @@ package com.vaadin.tests.elements.checkboxgroup; +import static org.junit.Assert.assertEquals; + import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -27,22 +28,20 @@ public class CheckBoxGroupSetSelectionTest extends MultiBrowserTest { @Test public void testSetSelection() { group.setValue(NEW_VALUE); - Assert.assertEquals(Collections.singletonList(NEW_VALUE), - group.getValue()); + assertEquals(Collections.singletonList(NEW_VALUE), group.getValue()); } @Test public void testSelectByText() { group.selectByText(NEW_VALUE); - Assert.assertEquals(Collections.singletonList(NEW_VALUE), - group.getValue()); + assertEquals(Collections.singletonList(NEW_VALUE), group.getValue()); } @Test public void testSelectAll() { List<String> value = Arrays.asList("item1", "item2", "item3"); group.setValue(value); - Assert.assertEquals(value, group.getValue()); + assertEquals(value, group.getValue()); } @Test @@ -50,7 +49,7 @@ public class CheckBoxGroupSetSelectionTest extends MultiBrowserTest { testSelectByText(); group.setValue(); - Assert.assertEquals(Collections.emptyList(), group.getValue()); + assertEquals(Collections.emptyList(), group.getValue()); } @Test diff --git a/uitest/src/test/java/com/vaadin/tests/elements/combobox/ComboBoxGetSuggestionsTest.java b/uitest/src/test/java/com/vaadin/tests/elements/combobox/ComboBoxGetSuggestionsTest.java index 1a527d8e9a..6794319ccb 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/combobox/ComboBoxGetSuggestionsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/combobox/ComboBoxGetSuggestionsTest.java @@ -1,9 +1,10 @@ package com.vaadin.tests.elements.combobox; +import static org.junit.Assert.assertEquals; + import java.util.ArrayList; import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.ComboBoxElement; @@ -19,6 +20,6 @@ public class ComboBoxGetSuggestionsTest extends MultiBrowserTest { for (int i = 1; i < 11; i++) { expectedSuggestions.add("item" + i); } - Assert.assertEquals(expectedSuggestions, suggestions); + assertEquals(expectedSuggestions, suggestions); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/combobox/ComboBoxInputNotAllowedTest.java b/uitest/src/test/java/com/vaadin/tests/elements/combobox/ComboBoxInputNotAllowedTest.java index b2e4ee0151..003c659d9b 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/combobox/ComboBoxInputNotAllowedTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/combobox/ComboBoxInputNotAllowedTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.combobox; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Ignore; import org.junit.Test; @@ -23,8 +24,7 @@ public class ComboBoxInputNotAllowedTest extends MultiBrowserTest { openTestURL(); ComboBoxElement cb = $(ComboBoxElement.class).first(); - String[] optionsToTest = { - ComboBoxInputNotAllowed.ITEM_ON_FIRST_PAGE, + String[] optionsToTest = { ComboBoxInputNotAllowed.ITEM_ON_FIRST_PAGE, ComboBoxInputNotAllowed.ITEM_ON_SECOND_PAGE, ComboBoxInputNotAllowed.ITEM_ON_LAST_PAGE, ComboBoxInputNotAllowed.ITEM_LAST_WITH_PARENTHESIS, @@ -32,9 +32,9 @@ public class ComboBoxInputNotAllowedTest extends MultiBrowserTest { for (String option : optionsToTest) { cb.selectByText(option); - Assert.assertEquals("Value is now: " + option, + assertEquals("Value is now: " + option, $(LabelElement.class).last().getText()); - Assert.assertEquals(option, cb.getValue()); + assertEquals(option, cb.getValue()); } } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/datefield/DateFieldPopupSetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/datefield/DateFieldPopupSetValueTest.java index 831ec1371a..5465bbbaf5 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/datefield/DateFieldPopupSetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/datefield/DateFieldPopupSetValueTest.java @@ -1,9 +1,10 @@ package com.vaadin.tests.elements.datefield; +import static org.junit.Assert.assertEquals; + import java.text.SimpleDateFormat; import java.util.Date; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -28,7 +29,7 @@ public class DateFieldPopupSetValueTest extends MultiBrowserTest { @Test public void testGetValue() { String value = df.getValue(); - Assert.assertEquals("04/12/15", value); + assertEquals("04/12/15", value); } @Test @@ -36,7 +37,7 @@ public class DateFieldPopupSetValueTest extends MultiBrowserTest { Date date = DateFieldPopupSetValue.changedDate; String value = (new SimpleDateFormat("MM/dd/yy")).format(date); df.setValue(value); - Assert.assertEquals("06/11/15", df.getValue()); + assertEquals("06/11/15", df.getValue()); } @Test @@ -45,6 +46,6 @@ public class DateFieldPopupSetValueTest extends MultiBrowserTest { String value = (new SimpleDateFormat("MM/dd/yy")).format(date); df.setValue(value); counter.waitForVaadin(); - Assert.assertEquals("1", counter.getText()); + assertEquals("1", counter.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/grid/GridUITest.java b/uitest/src/test/java/com/vaadin/tests/elements/grid/GridUITest.java index 8ac0aae0fe..b045bf2874 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/grid/GridUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/grid/GridUITest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.NoSuchElementException; @@ -13,13 +14,13 @@ public class GridUITest extends MultiBrowserTest { @Test public void testRowCount() { openTestURL("rowCount=0"); - Assert.assertEquals(0, getRowCount()); + assertEquals(0, getRowCount()); openTestURL("rowCount=1&restartApplication"); - Assert.assertEquals(1, getRowCount()); + assertEquals(1, getRowCount()); openTestURL("rowCount=10&restartApplication"); - Assert.assertEquals(10, getRowCount()); + assertEquals(10, getRowCount()); openTestURL("rowCount=1000&restartApplication"); - Assert.assertEquals(1000, getRowCount()); + assertEquals(1000, getRowCount()); } private long getRowCount() { @@ -33,13 +34,13 @@ public class GridUITest extends MultiBrowserTest { @Test public void testGetRows() { openTestURL("rowCount=0"); - Assert.assertEquals(0, checkRows()); + assertEquals(0, checkRows()); openTestURL("rowCount=1&restartApplication"); - Assert.assertEquals(1, checkRows()); + assertEquals(1, checkRows()); openTestURL("rowCount=10&restartApplication"); - Assert.assertEquals(10, checkRows()); + assertEquals(10, checkRows()); openTestURL("rowCount=100&restartApplication"); - Assert.assertEquals(100, checkRows()); + assertEquals(100, checkRows()); } @Test @@ -87,8 +88,8 @@ public class GridUITest extends MultiBrowserTest { private int checkRows() { int rowCount = 0; for (final GridRowElement row : getRows()) { - Assert.assertEquals("foo " + rowCount, row.getCell(0).getText()); - Assert.assertEquals("bar " + rowCount, row.getCell(1).getText()); + assertEquals("foo " + rowCount, row.getCell(0).getText()); + assertEquals("bar " + rowCount, row.getCell(1).getText()); rowCount++; } return rowCount; diff --git a/uitest/src/test/java/com/vaadin/tests/elements/gridlayout/GridLayoutUITest.java b/uitest/src/test/java/com/vaadin/tests/elements/gridlayout/GridLayoutUITest.java index 78d1fe8deb..c6bcae1864 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/gridlayout/GridLayoutUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/gridlayout/GridLayoutUITest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.elements.gridlayout; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import org.junit.Test; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; @@ -28,18 +30,18 @@ public class GridLayoutUITest extends SingleBrowserTest { @Test public void getRows() { openTestURL(); - Assert.assertEquals(1, $(GridLayoutElement.class) + assertEquals(1, $(GridLayoutElement.class) .id(GridLayoutUI.ONE_ROW_ONE_COL).getRowCount()); - Assert.assertEquals(10, $(GridLayoutElement.class) + assertEquals(10, $(GridLayoutElement.class) .id(GridLayoutUI.TEN_ROWS_TEN_COLS).getRowCount()); } @Test public void getColumns() { openTestURL(); - Assert.assertEquals(1, $(GridLayoutElement.class) + assertEquals(1, $(GridLayoutElement.class) .id(GridLayoutUI.ONE_ROW_ONE_COL).getColumnCount()); - Assert.assertEquals(10, $(GridLayoutElement.class) + assertEquals(10, $(GridLayoutElement.class) .id(GridLayoutUI.TEN_ROWS_TEN_COLS).getColumnCount()); } @@ -50,22 +52,22 @@ public class GridLayoutUITest extends SingleBrowserTest { .id(GridLayoutUI.TEN_ROWS_TEN_COLS); WebElement cell55 = grid.getCell(5, 5); - Assert.assertEquals("v-gridlayout-slot", cell55.getAttribute("class")); - Assert.assertEquals("5-5", cell55.getText()); + assertEquals("v-gridlayout-slot", cell55.getAttribute("class")); + assertEquals("5-5", cell55.getText()); try { grid.getCell(4, 4); - Assert.fail("Should throw for empty cell"); + fail("Should throw for empty cell"); } catch (NoSuchElementException e) { } WebElement cell77 = grid.getCell(7, 7); - Assert.assertEquals("v-gridlayout-slot", cell77.getAttribute("class")); - Assert.assertEquals("7-7 8-8", cell77.getText()); + assertEquals("v-gridlayout-slot", cell77.getAttribute("class")); + assertEquals("7-7 8-8", cell77.getText()); try { grid.getCell(7, 8); - Assert.fail("Should throw for merged cell"); + fail("Should throw for merged cell"); } catch (NoSuchElementException e) { } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/link/LinkUITest.java b/uitest/src/test/java/com/vaadin/tests/elements/link/LinkUITest.java index 1560dc64d5..a3ab7346b6 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/link/LinkUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/link/LinkUITest.java @@ -1,6 +1,9 @@ package com.vaadin.tests.elements.link; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; @@ -19,12 +22,11 @@ public class LinkUITest extends MultiBrowserTest { @Test public void testLinkClick() { String currentUrl = getDriver().getCurrentUrl(); - Assert.assertTrue( - "Current URL " + currentUrl + " should end with LinkUI?", + assertTrue("Current URL " + currentUrl + " should end with LinkUI?", currentUrl.endsWith("LinkUI")); link.click(); currentUrl = getDriver().getCurrentUrl(); - Assert.assertFalse( + assertFalse( "Current URL " + currentUrl + " should not end with LinkUI?", currentUrl.endsWith("LinkUI")); @@ -32,7 +34,7 @@ public class LinkUITest extends MultiBrowserTest { @Test public void getLinkCaption() { - Assert.assertEquals("server root", link.getCaption()); + assertEquals("server root", link.getCaption()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/listselect/ListSelectOptionClickTest.java b/uitest/src/test/java/com/vaadin/tests/elements/listselect/ListSelectOptionClickTest.java index ce7eca6322..def4da1c62 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/listselect/ListSelectOptionClickTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/listselect/ListSelectOptionClickTest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.elements.listselect; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -43,23 +44,23 @@ public class ListSelectOptionClickTest extends MultiBrowserTest { @Test public void testMultiSelectDeselectByText() { select.selectByText("item2"); - Assert.assertEquals("1: [item1, item2]", counterLbl.getText()); + assertEquals("1: [item1, item2]", counterLbl.getText()); select.selectByText("item3"); - Assert.assertEquals("2: [item1, item2, item3]", counterLbl.getText()); + assertEquals("2: [item1, item2, item3]", counterLbl.getText()); select.deselectByText("item2"); - Assert.assertEquals("3: [item1, item3]", counterLbl.getText()); + assertEquals("3: [item1, item3]", counterLbl.getText()); } @Test public void testDeselectSelectByText() { select.deselectByText("item1"); - Assert.assertEquals("1: []", counterLbl.getText()); + assertEquals("1: []", counterLbl.getText()); select.selectByText("item1"); - Assert.assertEquals("2: [item1]", counterLbl.getText()); + assertEquals("2: [item1]", counterLbl.getText()); select.selectByText("item3"); - Assert.assertEquals("3: [item1, item3]", counterLbl.getText()); + assertEquals("3: [item1, item3]", counterLbl.getText()); select.deselectByText("item1"); - Assert.assertEquals("4: [item3]", counterLbl.getText()); + assertEquals("4: [item3]", counterLbl.getText()); } /* @@ -69,10 +70,9 @@ public class ListSelectOptionClickTest extends MultiBrowserTest { private void checkValueChanged() { String actual = select.getValue(); String actualCounter = counterLbl.getText(); - Assert.assertEquals("The value of the ListSelect has not changed", - "item2", actual); - Assert.assertEquals( - "The number of list select valueChange events is not one.", + assertEquals("The value of the ListSelect has not changed", "item2", + actual); + assertEquals("The number of list select valueChange events is not one.", "1: item2", actualCounter); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/nativeselect/NativeSelectSetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/nativeselect/NativeSelectSetValueTest.java index 0ce358e727..282feee67d 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/nativeselect/NativeSelectSetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/nativeselect/NativeSelectSetValueTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.nativeselect; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -35,8 +36,8 @@ public class NativeSelectSetValueTest extends MultiBrowserTest { private void checkTestValue() { // checks value has changed String actual = select.getValue(); - Assert.assertEquals("item 2", actual); + assertEquals("item 2", actual); // checks change value event occures - Assert.assertEquals("1", counter.getText()); + assertEquals("1", counter.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationCloseTest.java b/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationCloseTest.java index 2640c1a5e7..333fd7e8e3 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationCloseTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationCloseTest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.elements.notification; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -46,7 +47,6 @@ public class NotificationCloseTest extends MultiBrowserTest { List<NotificationElement> notifications = $(NotificationElement.class) .all(); // check that all notifications are closed - Assert.assertTrue("There are open notifications", - notifications.isEmpty()); + assertTrue("There are open notifications", notifications.isEmpty()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationGetTypeAndDescriptionTest.java b/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationGetTypeAndDescriptionTest.java index ae0ea0e757..55f4d6947d 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationGetTypeAndDescriptionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationGetTypeAndDescriptionTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.notification; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -38,14 +39,13 @@ public class NotificationGetTypeAndDescriptionTest extends MultiBrowserTest { NotificationElement notification = $(NotificationElement.class).get(0); String eCaption = NotificationGetTypeAndDescription.captions[index]; String aCaption = notification.getCaption(); - Assert.assertEquals("Test captions fail", eCaption, aCaption); + assertEquals("Test captions fail", eCaption, aCaption); String eDescription = NotificationGetTypeAndDescription.descriptions[index]; String aDescription = notification.getDescription(); - Assert.assertEquals("Test descriptions fail", eDescription, - aDescription); + assertEquals("Test descriptions fail", eDescription, aDescription); String eType = NotificationGetTypeAndDescription.type_names[index]; String aType = notification.getType(); - Assert.assertEquals("Test types fail", eType, aType); + assertEquals("Test types fail", eType, aType); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/optiongroup/OptionGroupSetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/optiongroup/OptionGroupSetValueTest.java index a4fc3932db..241f7c6ffc 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/optiongroup/OptionGroupSetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/optiongroup/OptionGroupSetValueTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.optiongroup; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -22,13 +23,13 @@ public class OptionGroupSetValueTest extends MultiBrowserTest { @Test public void testSetValue() { group.setValue(NEW_VALUE); - Assert.assertEquals(NEW_VALUE, group.getValue()); + assertEquals(NEW_VALUE, group.getValue()); } @Test public void testSelectByText() { group.selectByText(NEW_VALUE); - Assert.assertEquals(NEW_VALUE, group.getValue()); + assertEquals(NEW_VALUE, group.getValue()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/panel/PanelScrollTest.java b/uitest/src/test/java/com/vaadin/tests/elements/panel/PanelScrollTest.java index 97b35b2e63..c8267c595f 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/panel/PanelScrollTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/panel/PanelScrollTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.panel; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -15,7 +16,7 @@ public class PanelScrollTest extends MultiBrowserTest { openTestURL(); PanelElement panel = $(PanelElement.class).get(0); panel.scrollLeft(SCROLL_VALUE); - Assert.assertEquals(SCROLL_VALUE, getScrollLeftValue(panel)); + assertEquals(SCROLL_VALUE, getScrollLeftValue(panel)); } @Test @@ -23,7 +24,7 @@ public class PanelScrollTest extends MultiBrowserTest { openTestURL(); PanelElement panel = $(PanelElement.class).get(0); panel.scroll(SCROLL_VALUE); - Assert.assertEquals(SCROLL_VALUE, getScrollTopValue(panel)); + assertEquals(SCROLL_VALUE, getScrollTopValue(panel)); } // helper functions diff --git a/uitest/src/test/java/com/vaadin/tests/elements/radiobuttongroup/RadioButtonGroupSetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/radiobuttongroup/RadioButtonGroupSetValueTest.java index 03bc2d8379..05f00fdf41 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/radiobuttongroup/RadioButtonGroupSetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/radiobuttongroup/RadioButtonGroupSetValueTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.radiobuttongroup; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -22,13 +23,13 @@ public class RadioButtonGroupSetValueTest extends MultiBrowserTest { @Test public void testSetValue() { group.setValue(NEW_VALUE); - Assert.assertEquals(NEW_VALUE, group.getValue()); + assertEquals(NEW_VALUE, group.getValue()); } @Test public void testSelectByText() { group.selectByText(NEW_VALUE); - Assert.assertEquals(NEW_VALUE, group.getValue()); + assertEquals(NEW_VALUE, group.getValue()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/slider/SliderGetHandleTest.java b/uitest/src/test/java/com/vaadin/tests/elements/slider/SliderGetHandleTest.java index bd4e567b70..191707a0cb 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/slider/SliderGetHandleTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/slider/SliderGetHandleTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.slider; -import org.junit.Assert; +import static org.junit.Assert.assertNotEquals; + import org.junit.Test; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; @@ -31,7 +32,7 @@ public class SliderGetHandleTest extends MultiBrowserTest { String initial = "" + (int) SliderGetHandle.INITIAL_VALUE; String actual = slider.getValue(); - Assert.assertNotEquals(initial, actual); + assertNotEquals(initial, actual); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/slider/SliderGetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/slider/SliderGetValueTest.java index ef41ab8a0f..30eec5ba7d 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/slider/SliderGetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/slider/SliderGetValueTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.slider; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; @@ -25,6 +26,6 @@ public class SliderGetValueTest extends MultiBrowserTest { SliderElement pb = $(SliderElement.class).get(0); String expected = "" + ComponentElementGetValue.TEST_SLIDER_VALUE; String actual = pb.getValue(); - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/table/GetRowHeaderTest.java b/uitest/src/test/java/com/vaadin/tests/elements/table/GetRowHeaderTest.java index 742fd33947..ee8fedfa62 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/table/GetRowHeaderTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/table/GetRowHeaderTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.elements.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.JavascriptExecutor; @@ -34,8 +36,7 @@ public class GetRowHeaderTest extends MultiBrowserTest { TableHeaderElement header = table.getHeaderCell(COLUMN_INDEX); String expected = "property0"; String actual = header.getCaption(); - Assert.assertEquals( - "TableHeaderElement.getCaption() returns wrong value.", + assertEquals("TableHeaderElement.getCaption() returns wrong value.", expected, actual); } @@ -51,10 +52,8 @@ public class GetRowHeaderTest extends MultiBrowserTest { table.waitForVaadin(); String expected = "col=0 row=99"; String actual = table.getCell(0, COLUMN_INDEX).getText(); - Assert.assertEquals( - "TableHeaderElement.toggleSort() did not sort column " - + COLUMN_INDEX, - expected, actual); + assertEquals("TableHeaderElement.toggleSort() did not sort column " + + COLUMN_INDEX, expected, actual); } @Test @@ -82,7 +81,7 @@ public class GetRowHeaderTest extends MultiBrowserTest { } header = table.getHeaderCell(COLUMN_INDEX); int widthAfterResize = header.getSize().width; - Assert.assertTrue( + assertTrue( "The column with index " + COLUMN_INDEX + " was not resized.", initialWidth > widthAfterResize); } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/table/TableElementContextMenuTest.java b/uitest/src/test/java/com/vaadin/tests/elements/table/TableElementContextMenuTest.java index 6a05730814..e2975564e5 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/table/TableElementContextMenuTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/table/TableElementContextMenuTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.table; -import org.junit.Assert; +import static org.junit.Assert.assertNotNull; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.NoSuchElementException; @@ -23,7 +24,7 @@ public class TableElementContextMenuTest extends MultiBrowserTest { tableElement.contextClick(); TableElement.ContextMenuElement contextMenu = tableElement .getContextMenu(); - Assert.assertNotNull( + assertNotNull( "There is no context menu open by tableElement.contextClick()", contextMenu); } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/table/TableGetRowTest.java b/uitest/src/test/java/com/vaadin/tests/elements/table/TableGetRowTest.java index 8068c5aabd..43ffca87d5 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/table/TableGetRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/table/TableGetRowTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.NoSuchElementException; @@ -38,7 +39,7 @@ public class TableGetRowTest extends MultiBrowserTest { String expected = "col=0 row=0"; String actual = cell.getText(); - Assert.assertEquals(GET_ROW_ERROR_MESSAGE, expected, actual); + assertEquals(GET_ROW_ERROR_MESSAGE, expected, actual); } @Test @@ -47,14 +48,14 @@ public class TableGetRowTest extends MultiBrowserTest { WebElement cell = row.getCell(1); String expected = "col=1 row=4"; String actual = cell.getText(); - Assert.assertEquals(GET_ROW_ERROR_MESSAGE, expected, actual); + assertEquals(GET_ROW_ERROR_MESSAGE, expected, actual); } @Test public void rowGetCellTest() { TestBenchElement cellFromTable = table.getCell(firstRow, firstCol); WebElement cellFromRow = table.getRow(firstRow).getCell(firstCol); - Assert.assertEquals( + assertEquals( "Table.getCell() and Row.getCell() return different values", cellFromRow.getText(), cellFromTable.getText()); } @@ -64,7 +65,7 @@ public class TableGetRowTest extends MultiBrowserTest { TestBenchElement cell = table.getCell(firstRow, firstCol); String actual = cell.getText(); String expected = "col=0 row=0"; - Assert.assertEquals(GET_CELL_ERROR_MESSAGE, expected, actual); + assertEquals(GET_CELL_ERROR_MESSAGE, expected, actual); } @Test(expected = NoSuchElementException.class) diff --git a/uitest/src/test/java/com/vaadin/tests/elements/table/TableScrollTest.java b/uitest/src/test/java/com/vaadin/tests/elements/table/TableScrollTest.java index f607db2fc3..06d34131bf 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/table/TableScrollTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/table/TableScrollTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.table; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; @@ -16,7 +17,7 @@ public class TableScrollTest extends MultiBrowserTest { openTestURL(); TableElement table = $(TableElement.class).get(0); table.scrollLeft(SCROLL_VALUE); - Assert.assertEquals(SCROLL_VALUE, getScrollLeftValue(table)); + assertEquals(SCROLL_VALUE, getScrollLeftValue(table)); } @Test @@ -24,7 +25,7 @@ public class TableScrollTest extends MultiBrowserTest { openTestURL(); TableElement table = $(TableElement.class).get(0); table.scroll(SCROLL_VALUE); - Assert.assertEquals(SCROLL_VALUE, getScrollTopValue(table)); + assertEquals(SCROLL_VALUE, getScrollTopValue(table)); } // helper functions diff --git a/uitest/src/test/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRowTest.java b/uitest/src/test/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRowTest.java index e20a6dd4ab..0f007c4eac 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRowTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.elements.treetable; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -53,6 +54,6 @@ public class TreeTableElementExpandRowTest extends MultiBrowserTest { } errorMessage += "Return value of row=" + rowIndex + " cell=0 should be " + expectedValue + "."; - Assert.assertEquals(errorMessage, expectedValue, cell.getText()); + assertEquals(errorMessage, expectedValue, cell.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/twincolselect/TwinColSelectUITest.java b/uitest/src/test/java/com/vaadin/tests/elements/twincolselect/TwinColSelectUITest.java index 66be8c2aa9..1a0c197195 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/twincolselect/TwinColSelectUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/twincolselect/TwinColSelectUITest.java @@ -1,8 +1,10 @@ package com.vaadin.tests.elements.twincolselect; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -24,20 +26,19 @@ public class TwinColSelectUITest extends MultiBrowserTest { @Test public void testSelectDeselectByText() { multiSelect.selectByText("item2"); - Assert.assertEquals("1: [item1, item2]", multiCounterLbl.getText()); + assertEquals("1: [item1, item2]", multiCounterLbl.getText()); multiSelect.selectByText("item3"); - Assert.assertEquals("2: [item1, item2, item3]", - multiCounterLbl.getText()); + assertEquals("2: [item1, item2, item3]", multiCounterLbl.getText()); multiSelect.deselectByText("item2"); - Assert.assertEquals("3: [item1, item3]", multiCounterLbl.getText()); + assertEquals("3: [item1, item3]", multiCounterLbl.getText()); } @Test public void testDeselectSelectByText() { multiSelect.deselectByText("item1"); - Assert.assertEquals("1: []", multiCounterLbl.getText()); + assertEquals("1: []", multiCounterLbl.getText()); multiSelect.selectByText("item1"); - Assert.assertEquals("2: [item1]", multiCounterLbl.getText()); + assertEquals("2: [item1]", multiCounterLbl.getText()); } @Test @@ -51,6 +52,6 @@ public class TwinColSelectUITest extends MultiBrowserTest { private void assertAvailableOptions(String... items) { List<String> optionTexts = multiSelect.getAvailableOptions(); - Assert.assertArrayEquals(items, optionTexts.toArray()); + assertArrayEquals(items, optionTexts.toArray()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/extensions/IframeIsOpenedInNonIOSTest.java b/uitest/src/test/java/com/vaadin/tests/extensions/IframeIsOpenedInNonIOSTest.java index 408dcd28e0..821d95a8a9 100644 --- a/uitest/src/test/java/com/vaadin/tests/extensions/IframeIsOpenedInNonIOSTest.java +++ b/uitest/src/test/java/com/vaadin/tests/extensions/IframeIsOpenedInNonIOSTest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.extensions; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; @@ -26,7 +27,7 @@ public class IframeIsOpenedInNonIOSTest extends MultiBrowserTest { .contains(IframeIsOpenedInNonIOS.FILE_NAME); } - Assert.assertTrue("page doesn't contain iframe with the file", + assertTrue("page doesn't contain iframe with the file", containsFileIframe); } diff --git a/uitest/src/test/java/com/vaadin/tests/extensions/UnknownExtensionHandlingTest.java b/uitest/src/test/java/com/vaadin/tests/extensions/UnknownExtensionHandlingTest.java index 855b7ed789..dc1eb24499 100644 --- a/uitest/src/test/java/com/vaadin/tests/extensions/UnknownExtensionHandlingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/extensions/UnknownExtensionHandlingTest.java @@ -15,9 +15,11 @@ */ package com.vaadin.tests.extensions; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -34,10 +36,9 @@ public class UnknownExtensionHandlingTest extends SingleBrowserTest { openDebugLogTab(); - Assert.assertTrue( - hasMessageContaining(MyExtension.class.getCanonicalName())); + assertTrue(hasMessageContaining(MyExtension.class.getCanonicalName())); - Assert.assertFalse(hasMessageContaining("Hierachy claims")); + assertFalse(hasMessageContaining("Hierachy claims")); } private boolean hasMessageContaining(String needle) { diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java index 8a0d63ecd4..f23f087b40 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java @@ -16,8 +16,9 @@ package com.vaadin.tests.fieldgroup; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -25,9 +26,9 @@ import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.CheckBoxElement; import com.vaadin.testbench.elements.DateFieldElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.GridElement.GridCellElement; import com.vaadin.testbench.elements.GridElement.GridEditorElement; import com.vaadin.testbench.parallel.TestCategory; @@ -67,11 +68,10 @@ public class BasicCrudGridEditorRowTest extends MultiBrowserTest { input.sendKeys("Invalid", Keys.TAB); editor.save(); - Assert.assertTrue("Editor wasn't displayed.", editor.isDisplayed()); - Assert.assertTrue("DateField wasn't displayed.", - dateField.isDisplayed()); + assertTrue("Editor wasn't displayed.", editor.isDisplayed()); + assertTrue("DateField wasn't displayed.", dateField.isDisplayed()); - Assert.assertTrue("DateField didn't have 'v-invalid' css class.", + assertTrue("DateField didn't have 'v-invalid' css class.", hasCssClass(dateField, "v-datefield-error")); } @@ -88,8 +88,7 @@ public class BasicCrudGridEditorRowTest extends MultiBrowserTest { // Check values String value = cb.getValue(); cb.click(5, 5); - Assert.assertNotEquals("Checkbox value did not change", value, - cb.getValue()); + assertNotEquals("Checkbox value did not change", value, cb.getValue()); } @Test diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridTest.java index 6b737c8278..f77242ed5a 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridTest.java @@ -15,14 +15,16 @@ */ package com.vaadin.tests.fieldgroup; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.AbstractHasTestBenchCommandExecutor; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.AbstractComponentElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2; @@ -35,7 +37,7 @@ public class BasicCrudGridTest extends SingleBrowserTestPhantomJS2 { .$(TextFieldElement.class).all(); for (TextFieldElement e : textFields) { - Assert.assertEquals("TextField should be empty", "", e.getValue()); + assertEquals("TextField should be empty", "", e.getValue()); } } @@ -54,15 +56,14 @@ public class BasicCrudGridTest extends SingleBrowserTestPhantomJS2 { .$(TextFieldElement.class).all(); for (TextFieldElement e : textFields) { - Assert.assertNotEquals("TextField should not be empty", "", - e.getValue()); + assertNotEquals("TextField should not be empty", "", e.getValue()); } // Deselect row $(GridElement.class).first().getCell(2, 2).click(); for (TextFieldElement e : textFields) { - Assert.assertEquals("TextField should be empty", "", e.getValue()); + assertEquals("TextField should be empty", "", e.getValue()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudTableTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudTableTest.java index 3ca03717a1..6acdbdf85c 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudTableTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudTableTest.java @@ -15,14 +15,16 @@ */ package com.vaadin.tests.fieldgroup; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.AbstractHasTestBenchCommandExecutor; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.AbstractComponentElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -35,7 +37,7 @@ public class BasicCrudTableTest extends SingleBrowserTest { .$(TextFieldElement.class).all(); for (TextFieldElement e : textFields) { - Assert.assertEquals("TextField should be empty", "", e.getValue()); + assertEquals("TextField should be empty", "", e.getValue()); } } @@ -54,15 +56,14 @@ public class BasicCrudTableTest extends SingleBrowserTest { .$(TextFieldElement.class).all(); for (TextFieldElement e : textFields) { - Assert.assertNotEquals("TextField should not be empty", "", - e.getValue()); + assertNotEquals("TextField should not be empty", "", e.getValue()); } // Deselect row $(TableElement.class).first().getCell(2, 2).click(); for (TextFieldElement e : textFields) { - Assert.assertEquals("TextField should be empty", "", e.getValue()); + assertEquals("TextField should be empty", "", e.getValue()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java index ddf97d8727..7dbfc03b5a 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java @@ -15,13 +15,14 @@ */ package com.vaadin.tests.fieldgroup; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import com.vaadin.testbench.TestBenchElement; -import com.vaadin.testbench.elements.NotificationElement; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.NotificationElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.TableRowElement; import com.vaadin.testbench.elements.TextAreaElement; import com.vaadin.testbench.elements.TextFieldElement; @@ -115,14 +116,13 @@ public abstract class BasicPersonFormTest extends MultiBrowserTest { private void assertFieldValue(String caption, String expected, TestBenchElement field) { - Assert.assertEquals( - String.format("Unexpected value for field '%s',", caption), + assertEquals(String.format("Unexpected value for field '%s',", caption), expected, field.getAttribute("value")); } protected void assertSelectedSex(Sex sex) { TableRowElement row = getGenderTable().getRow(getIndex(sex)); - Assert.assertTrue( + assertTrue( String.format("Given sex (%s) isn't selected.", sex.getStringRepresentation()), hasCssClass(row, "v-selected")); @@ -164,8 +164,8 @@ public abstract class BasicPersonFormTest extends MultiBrowserTest { protected void assertLogText(String expected) { ++logCounter; - Assert.assertEquals("Unexpected log contents,", - logCounter + ". " + expected, getLogRow(0)); + assertEquals("Unexpected log contents,", logCounter + ". " + expected, + getLogRow(0)); } protected void assertDefaults() { diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BooleanTextFieldTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BooleanTextFieldTest.java index abbe4128dd..e5ff31f9e1 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BooleanTextFieldTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BooleanTextFieldTest.java @@ -1,8 +1,10 @@ package com.vaadin.tests.fieldgroup; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -32,15 +34,15 @@ public class BooleanTextFieldTest extends BasicPersonFormTest { getDeceasedField().sendKeys("false", Keys.ENTER); /* error indicator */ - Assert.assertEquals("Incorrect amount of error indicators on page.", 1, + assertEquals("Incorrect amount of error indicators on page.", 1, findElements(By.className("v-errorindicator")).size()); - Assert.assertEquals("false", getDeceasedField().getAttribute("value")); + assertEquals("false", getDeceasedField().getAttribute("value")); assertBeanValuesUnchanged(); /* error message in tooltip */ getDeceasedField().showTooltip(); - Assert.assertEquals("Could not convert value to Boolean", + assertEquals("Could not convert value to Boolean", getTooltipErrorElement().getText()); getDeceasedField().click(); @@ -50,13 +52,13 @@ public class BooleanTextFieldTest extends BasicPersonFormTest { getDeceasedField().sendKeys("YAY!", Keys.ENTER); /* no error indicator */ - Assert.assertFalse(isElementPresent(By.className("v-errorindicator"))); + assertFalse(isElementPresent(By.className("v-errorindicator"))); assertCommitSuccessful(); /* commit last name and new deceased status */ showBeanValues(); - Assert.assertEquals( + assertEquals( "4. Person [firstName=John, lastName=Dover, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=true, salary=null, salaryDouble=null, rent=null]", getLogRow(0)); } diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java index 5bad4aa98c..4a0b95fc73 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.fieldgroup; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -15,17 +17,16 @@ public class DateFormTest extends MultiBrowserTest { @Test public void testCorrectDateFormat() throws Exception { openTestURL(); - Assert.assertEquals("Unexpected DateField value,", "1/20/84", + assertEquals("Unexpected DateField value,", "1/20/84", getDateFieldValue()); - Assert.assertEquals("Unexpected PopupDateField value,", "1/21/84", + assertEquals("Unexpected PopupDateField value,", "1/21/84", getPopupDateFieldValue()); WebElement day20 = getInlineDateFieldCalendarPanel() .findElement(By.vaadin("#day20")); - Assert.assertTrue( - "Unexpected InlineDateField state, 20th not selected.", + assertTrue("Unexpected InlineDateField state, 20th not selected.", hasCssClass(day20, "v-inline-datefield-calendarpanel-day-selected")); - Assert.assertEquals("Unexpected TextField contents,", + assertEquals("Unexpected TextField contents,", "Jan 20, 1984 4:34:49 PM", $(TextFieldElement.class).first().getValue()); } diff --git a/uitest/src/test/java/com/vaadin/tests/fields/TabIndexesTest.java b/uitest/src/test/java/com/vaadin/tests/fields/TabIndexesTest.java index 16ea0d051f..db61d72d8f 100644 --- a/uitest/src/test/java/com/vaadin/tests/fields/TabIndexesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fields/TabIndexesTest.java @@ -1,9 +1,10 @@ package com.vaadin.tests.fields; +import static org.junit.Assert.assertEquals; + import java.util.ArrayList; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -80,12 +81,12 @@ public class TabIndexesTest extends SingleBrowserTest { } private void assertLogText(String expected) { - Assert.assertEquals("Unexpected log contents,", expected, getLogRow(0)); + assertEquals("Unexpected log contents,", expected, getLogRow(0)); } private void assertTabIndex(String expected, WebElement element) { if (!expected.equals(element.getAttribute("tabIndex"))) { - Assert.assertEquals( + assertEquals( "Unexpected tab index for element " + element.getAttribute("outerHTML"), expected, element.getAttribute("tabIndex")); @@ -118,7 +119,7 @@ public class TabIndexesTest extends SingleBrowserTest { List<AbstractComponentElement> components = $( VerticalLayoutElement.class).id(TabIndexes.FIELD_CONTAINER_ID) .$(AbstractComponentElement.class).all(); - Assert.assertEquals(components.size(), focusElements.size()); + assertEquals(components.size(), focusElements.size()); return focusElements; } diff --git a/uitest/src/test/java/com/vaadin/tests/fonticon/GridLayoutOnFontLoadTest.java b/uitest/src/test/java/com/vaadin/tests/fonticon/GridLayoutOnFontLoadTest.java index db5c08c653..fdf82ff02e 100644 --- a/uitest/src/test/java/com/vaadin/tests/fonticon/GridLayoutOnFontLoadTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fonticon/GridLayoutOnFontLoadTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.fonticon; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -23,11 +24,11 @@ public class GridLayoutOnFontLoadTest extends MultiBrowserTest { TextAreaElement textarea = $(TextAreaElement.class).first(); GridElement grid = $(GridElement.class).first(); - Assert.assertTrue( + assertTrue( "Button overlaps with checkbox (layout done before fonts loaded)", button.getLocation().getX() + button.getSize().width <= checkbox .getLocation().getX()); - Assert.assertTrue( + assertTrue( "TextArea overlaps with grid caption (layout done before fonts loaded)", textarea.getLocation().getY() + textarea.getSize().height + 10 < grid.getLocation().getY()); diff --git a/uitest/src/test/java/com/vaadin/tests/htmlimport/HtmlImportUITest.java b/uitest/src/test/java/com/vaadin/tests/htmlimport/HtmlImportUITest.java index b830552c27..3ba04b64b2 100644 --- a/uitest/src/test/java/com/vaadin/tests/htmlimport/HtmlImportUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/htmlimport/HtmlImportUITest.java @@ -15,12 +15,15 @@ */ package com.vaadin.tests.htmlimport; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; @@ -55,13 +58,13 @@ public class HtmlImportUITest extends MultiBrowserTest { WebElement log = findElement(By.id("clientlog")); // Defined by ui.js List<WebElement> messages = log.findElements(By.className("message")); - // Assert.assertEquals("Some log messages are missing or extra", 3, + // assertEquals("Some log messages are missing or extra", 3, // messages.size()); // JS before HTML, UI deps in bootstrap, rest dynamically // ui.js just sets up the logging - Assert.assertEquals("ui.html", messages.get(0).getText()); + assertEquals("ui.html", messages.get(0).getText()); // Apparently Chrome does not guarantee that "label.js" is executed // before "label.html", at least in the way we are loading HTML and JS. @@ -78,14 +81,14 @@ public class HtmlImportUITest extends MultiBrowserTest { // HTML import String href = e.getAttribute("href"); String file = href.substring(href.lastIndexOf('/') + 1); - Assert.assertFalse("Multiple HTML imports for " + file, + assertFalse("Multiple HTML imports for " + file, htmlImportIndexes.containsKey(file)); htmlImportIndexes.put(file, i); } else if (e.getTagName().equalsIgnoreCase("script")) { // JS String src = e.getAttribute("src"); String file = src.substring(src.lastIndexOf('/') + 1); - Assert.assertFalse("Multiple script tags for " + file, + assertFalse("Multiple script tags for " + file, jsIndexes.containsKey(file)); jsIndexes.put(file, i); } @@ -102,13 +105,13 @@ public class HtmlImportUITest extends MultiBrowserTest { int otherJsIndex = jsIndexes.get("labelX.js"); int otherHtmlIndex = htmlImportIndexes.get("labelX.html"); - Assert.assertTrue("super js should be before super html", + assertTrue("super js should be before super html", superJsIndex < superHtmlIndex); - Assert.assertTrue("super dependencies should be before sub js", + assertTrue("super dependencies should be before sub js", superHtmlIndex < subJsIndex); - Assert.assertTrue("sub js should be before sub html", + assertTrue("sub js should be before sub html", subJsIndex < subHtmlIndex); } } diff --git a/uitest/src/test/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdateTest.java b/uitest/src/test/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdateTest.java index 1d601b6fb1..ba184ce0ab 100644 --- a/uitest/src/test/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdateTest.java +++ b/uitest/src/test/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdateTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.layoutmanager; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -30,7 +31,7 @@ public class LayoutDuringStateUpdateTest extends SingleBrowserTest { WebElement label = findElement(By.className("gwt-Label")); - Assert.assertEquals("Layout phase count: 1", label.getText()); + assertEquals("Layout phase count: 1", label.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/layouts/CssLayoutAbsoluteUrlTest.java b/uitest/src/test/java/com/vaadin/tests/layouts/CssLayoutAbsoluteUrlTest.java index 82ddc53fbf..57b2285f10 100644 --- a/uitest/src/test/java/com/vaadin/tests/layouts/CssLayoutAbsoluteUrlTest.java +++ b/uitest/src/test/java/com/vaadin/tests/layouts/CssLayoutAbsoluteUrlTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.layouts; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -33,7 +34,7 @@ public class CssLayoutAbsoluteUrlTest extends SingleBrowserTest { // Not testing string equality since some browsers return the style with // quotes around the url argument and some without quotes. - Assert.assertTrue(backgroundImage + " does not contain 'about:blank'", + assertTrue(backgroundImage + " does not contain 'about:blank'", backgroundImage.contains("about:blank")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/layouts/CssLayoutRemoveComponentTest.java b/uitest/src/test/java/com/vaadin/tests/layouts/CssLayoutRemoveComponentTest.java index 789f15e5e4..bd66164d08 100644 --- a/uitest/src/test/java/com/vaadin/tests/layouts/CssLayoutRemoveComponentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/layouts/CssLayoutRemoveComponentTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.layouts; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -40,7 +41,7 @@ public class CssLayoutRemoveComponentTest extends SingleBrowserTestPhantomJS2 { Long mutationEvents = (Long) executeScript( "return document.mutationEventCount;"); - Assert.assertEquals( + assertEquals( "Parent should only have two mutation events (remove field and its caption)", 2, mutationEvents.intValue()); } diff --git a/uitest/src/test/java/com/vaadin/tests/layouts/HorizontalLayoutAndCaretPositionTest.java b/uitest/src/test/java/com/vaadin/tests/layouts/HorizontalLayoutAndCaretPositionTest.java index 132845a74c..36e201feab 100644 --- a/uitest/src/test/java/com/vaadin/tests/layouts/HorizontalLayoutAndCaretPositionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/layouts/HorizontalLayoutAndCaretPositionTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.layouts; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + import org.junit.Test; import com.vaadin.testbench.elements.TextFieldElement; @@ -31,14 +33,14 @@ public class HorizontalLayoutAndCaretPositionTest extends MultiBrowserTest { first.click(); first.sendKeys("test"); // make sure that the field could be focused and text typed - Assert.assertEquals("Field must be focused on click", "test", + assertEquals("Field must be focused on click", "test", first.getValue()); // now move the focus to the next text field $(TextFieldElement.class).get(1).click(); // and back to the first one first.click(30, 10); first.sendKeys("do_not_put_in_beginning_"); - Assert.assertNotEquals("The caret position must be maintained", + assertNotEquals("The caret position must be maintained", "do_not_put_in_beginning_test", first.getValue()); } diff --git a/uitest/src/test/java/com/vaadin/tests/layouts/RelativeSizeInUndefinedCssLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/layouts/RelativeSizeInUndefinedCssLayoutTest.java index 02c9a5a3df..2d2f764297 100644 --- a/uitest/src/test/java/com/vaadin/tests/layouts/RelativeSizeInUndefinedCssLayoutTest.java +++ b/uitest/src/test/java/com/vaadin/tests/layouts/RelativeSizeInUndefinedCssLayoutTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.layouts; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.FormLayoutElement; @@ -29,9 +31,9 @@ public class RelativeSizeInUndefinedCssLayoutTest public void relativeSizeInUndefinedCssLayout() { openTestURL(); int w = $(FormLayoutElement.class).first().getSize().getWidth(); - Assert.assertEquals(w, 520); + assertEquals(w, 520); int w2 = $(TextFieldElement.class).first().getSize().getWidth(); - Assert.assertTrue(w2 > 400); + assertTrue(w2 > 400); } } diff --git a/uitest/src/test/java/com/vaadin/tests/layouts/TestLayoutClickListenersTest.java b/uitest/src/test/java/com/vaadin/tests/layouts/TestLayoutClickListenersTest.java index 9d3bf43ff8..a9517d5504 100644 --- a/uitest/src/test/java/com/vaadin/tests/layouts/TestLayoutClickListenersTest.java +++ b/uitest/src/test/java/com/vaadin/tests/layouts/TestLayoutClickListenersTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.layouts; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.interactions.Actions; @@ -195,6 +196,6 @@ public class TestLayoutClickListenersTest extends MultiBrowserTest { private void assertLogText(String message, String expected) { String actual = $(LabelElement.class).first().getText(); - Assert.assertEquals(message, expected, actual); + assertEquals(message, expected, actual); } } diff --git a/uitest/src/test/java/com/vaadin/tests/layouts/VerticalLayoutRemoveComponentTest.java b/uitest/src/test/java/com/vaadin/tests/layouts/VerticalLayoutRemoveComponentTest.java index 5ce565230d..39d9cc673d 100644 --- a/uitest/src/test/java/com/vaadin/tests/layouts/VerticalLayoutRemoveComponentTest.java +++ b/uitest/src/test/java/com/vaadin/tests/layouts/VerticalLayoutRemoveComponentTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.layouts; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -41,8 +42,7 @@ public class VerticalLayoutRemoveComponentTest Long mutationEvents = (Long) executeScript( "return document.mutationEventCount;"); - Assert.assertEquals( - "Parent should only have one mutation event (remove slot)", 1, - mutationEvents.intValue()); + assertEquals("Parent should only have one mutation event (remove slot)", + 1, mutationEvents.intValue()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmationTest.java b/uitest/src/test/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmationTest.java index b3f7053cda..3e652bd0d3 100644 --- a/uitest/src/test/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmationTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.navigator; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -97,17 +98,16 @@ public class DelayedViewLeaveConfirmationTest extends SingleBrowserTest { } private void assertOnOtherView() { - Assert.assertEquals("Just another view", + assertEquals("Just another view", $(LabelElement.class).first().getText()); } private void assertOnMainView() { - Assert.assertEquals("Saved value", - $(LabelElement.class).first().getCaption()); + assertEquals("Saved value", $(LabelElement.class).first().getCaption()); } private void assertLoggedOut() { - Assert.assertEquals("You have been logged out", + assertEquals("You have been logged out", $(LabelElement.class).first().getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/performance/MemoryIT.java b/uitest/src/test/java/com/vaadin/tests/performance/MemoryIT.java index d3082ec336..f80fe7bbc5 100644 --- a/uitest/src/test/java/com/vaadin/tests/performance/MemoryIT.java +++ b/uitest/src/test/java/com/vaadin/tests/performance/MemoryIT.java @@ -15,11 +15,13 @@ */ package com.vaadin.tests.performance; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.StringUtils; -import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -45,7 +47,6 @@ public class MemoryIT extends SingleBrowserTest { performTest(TreeGridMemory.PATH + "?items=1", "tree-grid-one-item-"); performTest(TreeTableMemory.PATH + "?items=1", "tree-table-one-item-"); - performTest(TreeGridMemory.PATH + "?items=100&initiallyExpanded", "tree-grid-100-items-initially-expanded-"); performTest(TreeTableMemory.PATH + "?items=100&initiallyExpanded", @@ -89,7 +90,7 @@ public class MemoryIT extends SingleBrowserTest { return; } if (i == MAX_ITERATIONS) { - Assert.fail("Memory size does not stabilize"); + fail("Memory size does not stabilize"); } } } @@ -112,7 +113,7 @@ public class MemoryIT extends SingleBrowserTest { private void openUI(String path) { getDriver().get(StringUtils.strip(getBaseURL(), "/") + path); - Assert.assertTrue(isElementPresent(By.className("v-grid")) + assertTrue(isElementPresent(By.className("v-grid")) || isElementPresent(By.className("v-treegrid")) || isElementPresent(By.className("v-table"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/push/BarInUIDLTest.java b/uitest/src/test/java/com/vaadin/tests/push/BarInUIDLTest.java index 47b05ac854..8963c26bb2 100644 --- a/uitest/src/test/java/com/vaadin/tests/push/BarInUIDLTest.java +++ b/uitest/src/test/java/com/vaadin/tests/push/BarInUIDLTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.push; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -28,15 +29,13 @@ public class BarInUIDLTest extends MultiBrowserTest { public void sendBarInUIDL() { openTestURL(); getButton().click(); - Assert.assertEquals("Thank you for clicking | bar", - vaadinElement( - "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]") - .getText()); + assertEquals("Thank you for clicking | bar", vaadinElement( + "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]") + .getText()); getButton().click(); - Assert.assertEquals("Thank you for clicking | bar", - vaadinElement( - "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VLabel[0]") - .getText()); + assertEquals("Thank you for clicking | bar", vaadinElement( + "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VLabel[0]") + .getText()); } private WebElement getButton() { diff --git a/uitest/src/test/java/com/vaadin/tests/push/IdlePushChannelTest.java b/uitest/src/test/java/com/vaadin/tests/push/IdlePushChannelTest.java index 4291b99dc6..a96bdce9c9 100644 --- a/uitest/src/test/java/com/vaadin/tests/push/IdlePushChannelTest.java +++ b/uitest/src/test/java/com/vaadin/tests/push/IdlePushChannelTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.push; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.parallel.TestCategory; @@ -30,10 +31,10 @@ public abstract class IdlePushChannelTest extends MultiBrowserTest { public void longWaitBetweenActions() throws Exception { openTestURL(); BasicPushTest.getIncrementButton(this).click(); - Assert.assertEquals(1, BasicPushTest.getClientCounter(this)); + assertEquals(1, BasicPushTest.getClientCounter(this)); sleep(SEVEN_MINUTES_IN_MS); BasicPushTest.getIncrementButton(this).click(); - Assert.assertEquals(2, BasicPushTest.getClientCounter(this)); + assertEquals(2, BasicPushTest.getClientCounter(this)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/push/MakeComponentVisibleWithPushTest.java b/uitest/src/test/java/com/vaadin/tests/push/MakeComponentVisibleWithPushTest.java index 80bedff193..c5bb5900f7 100644 --- a/uitest/src/test/java/com/vaadin/tests/push/MakeComponentVisibleWithPushTest.java +++ b/uitest/src/test/java/com/vaadin/tests/push/MakeComponentVisibleWithPushTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.push; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -30,10 +31,10 @@ public class MakeComponentVisibleWithPushTest extends SingleBrowserTest { openTestURL(); $(ButtonElement.class).first().click(); - Assert.assertEquals("Unexpected row count", 1, + assertEquals("Unexpected row count", 1, $(GridElement.class).first().getRowCount()); $(ButtonElement.class).first().click(); - Assert.assertEquals("Unexpected row count", 2, + assertEquals("Unexpected row count", 2, $(GridElement.class).first().getRowCount()); assertNoErrorNotifications(); diff --git a/uitest/src/test/java/com/vaadin/tests/push/PushErrorHandlingTest.java b/uitest/src/test/java/com/vaadin/tests/push/PushErrorHandlingTest.java index 320627ca74..985181b8cd 100644 --- a/uitest/src/test/java/com/vaadin/tests/push/PushErrorHandlingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/push/PushErrorHandlingTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.push; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -32,7 +33,7 @@ public class PushErrorHandlingTest extends MultiBrowserTest { setPush(true); openTestURL(); vaadinElementById("npeButton").click(); - Assert.assertEquals( + assertEquals( "An error! Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc", $(LabelElement.class).get(1).getText()); @@ -41,7 +42,7 @@ public class PushErrorHandlingTest extends MultiBrowserTest { .findElement(By.xpath("//div[text()='Click for NPE']")); row.click(); - Assert.assertEquals("Internal error", + assertEquals("Internal error", vaadinElement("Root/VNotification[0]/HTML[0]/domChild[0]") .getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/push/PushToggleComponentVisibilityTest.java b/uitest/src/test/java/com/vaadin/tests/push/PushToggleComponentVisibilityTest.java index 11ad287240..0a7ee645d5 100644 --- a/uitest/src/test/java/com/vaadin/tests/push/PushToggleComponentVisibilityTest.java +++ b/uitest/src/test/java/com/vaadin/tests/push/PushToggleComponentVisibilityTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.push; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -31,12 +32,10 @@ public class PushToggleComponentVisibilityTest extends SingleBrowserTest { openTestURL(); $(ButtonElement.class).id(HIDE).click(); - Assert.assertEquals("Please wait", - $(LabelElement.class).first().getText()); + assertEquals("Please wait", $(LabelElement.class).first().getText()); waitUntil(driver -> isElementPresent(ButtonElement.class)); $(ButtonElement.class).id(HIDE).click(); - Assert.assertEquals("Please wait", - $(LabelElement.class).first().getText()); + assertEquals("Please wait", $(LabelElement.class).first().getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/push/PushWithPreserveOnRefreshTest.java b/uitest/src/test/java/com/vaadin/tests/push/PushWithPreserveOnRefreshTest.java index ad1f30172e..7542fd13d2 100644 --- a/uitest/src/test/java/com/vaadin/tests/push/PushWithPreserveOnRefreshTest.java +++ b/uitest/src/test/java/com/vaadin/tests/push/PushWithPreserveOnRefreshTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.push; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -28,11 +29,11 @@ public class PushWithPreserveOnRefreshTest extends MultiBrowserTest { openTestURL(); $(ButtonElement.class).first().click(); $(ButtonElement.class).first().click(); - Assert.assertEquals("2. Button has been clicked 2 times", getLogRow(0)); + assertEquals("2. Button has been clicked 2 times", getLogRow(0)); openTestURL(); - Assert.assertEquals("2. Button has been clicked 2 times", getLogRow(0)); + assertEquals("2. Button has been clicked 2 times", getLogRow(0)); $(ButtonElement.class).first().click(); - Assert.assertEquals("3. Button has been clicked 3 times", getLogRow(0)); + assertEquals("3. Button has been clicked 3 times", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/push/RefreshCloseConnectionTest.java b/uitest/src/test/java/com/vaadin/tests/push/RefreshCloseConnectionTest.java index cfbc528718..6f19fcb9f9 100644 --- a/uitest/src/test/java/com/vaadin/tests/push/RefreshCloseConnectionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/push/RefreshCloseConnectionTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.push; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.remote.DesiredCapabilities; @@ -31,12 +32,12 @@ public class RefreshCloseConnectionTest extends MultiBrowserTest { public void testSessionRefresh() { openTestURL("restartApplication"); - Assert.assertEquals("1. Init", getLogRow(0)); + assertEquals("1. Init", getLogRow(0)); openTestURL(); - Assert.assertEquals("2. Refresh", getLogRow(1)); - Assert.assertEquals("3. Push", getLogRow(0)); + assertEquals("2. Refresh", getLogRow(1)); + assertEquals("3. Push", getLogRow(0)); } @Override diff --git a/uitest/src/test/java/com/vaadin/tests/push/TogglePushTest.java b/uitest/src/test/java/com/vaadin/tests/push/TogglePushTest.java index 0508ec3695..6913dd2700 100644 --- a/uitest/src/test/java/com/vaadin/tests/push/TogglePushTest.java +++ b/uitest/src/test/java/com/vaadin/tests/push/TogglePushTest.java @@ -15,7 +15,10 @@ */ package com.vaadin.tests.push; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -33,21 +36,19 @@ public class TogglePushTest extends MultiBrowserTest { // Open with push disabled driver.get(addParameter(url, "push=disabled")); - Assert.assertFalse(getPushToggle().isSelected()); + assertFalse(getPushToggle().isSelected()); getDelayedCounterUpdateButton().click(); sleep(2000); - Assert.assertEquals("Counter has been updated 0 times", - getCounterText()); + assertEquals("Counter has been updated 0 times", getCounterText()); // Open with push enabled driver.get(addParameter(url, "push=enabled")); - Assert.assertTrue(getPushToggle().isSelected()); + assertTrue(getPushToggle().isSelected()); getDelayedCounterUpdateButton().click(); sleep(2000); - Assert.assertEquals("Counter has been updated 1 times", - getCounterText()); + assertEquals("Counter has been updated 1 times", getCounterText()); } @@ -67,21 +68,18 @@ public class TogglePushTest extends MultiBrowserTest { sleep(2000); // Push is enabled, so text gets updated - Assert.assertEquals("Counter has been updated 1 times", - getCounterText()); + assertEquals("Counter has been updated 1 times", getCounterText()); // Disable push getPushToggle().click(); getDelayedCounterUpdateButton().click(); sleep(2000); // Push is disabled, so text is not updated - Assert.assertEquals("Counter has been updated 1 times", - getCounterText()); + assertEquals("Counter has been updated 1 times", getCounterText()); getDirectCounterUpdateButton().click(); // Direct update is visible, and includes previous update - Assert.assertEquals("Counter has been updated 3 times", - getCounterText()); + assertEquals("Counter has been updated 3 times", getCounterText()); // Re-enable push getPushToggle().click(); @@ -89,8 +87,7 @@ public class TogglePushTest extends MultiBrowserTest { sleep(2000); // Push is enabled again, so text gets updated - Assert.assertEquals("Counter has been updated 4 times", - getCounterText()); + assertEquals("Counter has been updated 4 times", getCounterText()); } private WebElement getDirectCounterUpdateButton() { diff --git a/uitest/src/test/java/com/vaadin/tests/push/TrackMessageSizeUITest.java b/uitest/src/test/java/com/vaadin/tests/push/TrackMessageSizeUITest.java index 03ecb8a07d..ad5225b9a9 100644 --- a/uitest/src/test/java/com/vaadin/tests/push/TrackMessageSizeUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/push/TrackMessageSizeUITest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.push; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.parallel.TestCategory; @@ -26,7 +27,7 @@ public class TrackMessageSizeUITest extends MultiBrowserTest { @Test public void runTests() { openTestURL(); - Assert.assertEquals("1. All tests run", + assertEquals("1. All tests run", vaadinElementById("Log_row_0").getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/requesthandlers/AppResource404Test.java b/uitest/src/test/java/com/vaadin/tests/requesthandlers/AppResource404Test.java index a5b1f0451c..d46b5d164a 100644 --- a/uitest/src/test/java/com/vaadin/tests/requesthandlers/AppResource404Test.java +++ b/uitest/src/test/java/com/vaadin/tests/requesthandlers/AppResource404Test.java @@ -1,8 +1,10 @@ package com.vaadin.tests.requesthandlers; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.remote.DesiredCapabilities; @@ -15,7 +17,7 @@ public class AppResource404Test extends MultiBrowserTest { openTestURL(); $(LinkElement.class).first().click(5, 5); disableWaitingAndWait(); - Assert.assertFalse("Page contains the given text", + assertFalse("Page contains the given text", driver.getPageSource().contains("404")); } @@ -24,7 +26,7 @@ public class AppResource404Test extends MultiBrowserTest { openTestURL(); $(LinkElement.class).get(1).click(5, 5); disableWaitingAndWait(); - Assert.assertTrue("Page does not contain the given text", + assertTrue("Page does not contain the given text", driver.getPageSource().contains( "/APP/connector/0/4/asdfasdf can not be found")); } @@ -34,9 +36,9 @@ public class AppResource404Test extends MultiBrowserTest { openTestURL(); $(LinkElement.class).get(2).click(5, 5); disableWaitingAndWait(); - Assert.assertTrue("Page does not contain the given text", + assertTrue("Page does not contain the given text", driver.getPageSource().contains("HTTP ERROR 404")); - Assert.assertTrue("Page does not contain the given text", + assertTrue("Page does not contain the given text", driver.getPageSource().contains("Problem accessing /run/APP/")); } @@ -45,7 +47,7 @@ public class AppResource404Test extends MultiBrowserTest { openTestURL(); $(LinkElement.class).get(3).click(5, 5); disableWaitingAndWait(); - Assert.assertFalse("Page contains the given text", + assertFalse("Page contains the given text", driver.getPageSource().contains("can not be found")); } diff --git a/uitest/src/test/java/com/vaadin/tests/requesthandlers/CommunicationErrorTest.java b/uitest/src/test/java/com/vaadin/tests/requesthandlers/CommunicationErrorTest.java index d2bfbd1160..79c2c0a37b 100644 --- a/uitest/src/test/java/com/vaadin/tests/requesthandlers/CommunicationErrorTest.java +++ b/uitest/src/test/java/com/vaadin/tests/requesthandlers/CommunicationErrorTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.requesthandlers; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; @@ -35,7 +36,7 @@ public class CommunicationErrorTest extends MultiBrowserTest { $(ButtonElement.class).first().click(); - Assert.assertTrue(isElementPresent(By.className("redirected"))); + assertTrue(isElementPresent(By.className("redirected"))); } } diff --git a/uitest/src/test/java/com/vaadin/tests/requesthandlers/UnsupportedBrowserHandlerUserAgents.java b/uitest/src/test/java/com/vaadin/tests/requesthandlers/UnsupportedBrowserHandlerUserAgents.java index 16b92139f7..d9f52c6b54 100644 --- a/uitest/src/test/java/com/vaadin/tests/requesthandlers/UnsupportedBrowserHandlerUserAgents.java +++ b/uitest/src/test/java/com/vaadin/tests/requesthandlers/UnsupportedBrowserHandlerUserAgents.java @@ -15,11 +15,13 @@ */ package com.vaadin.tests.requesthandlers; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.net.HttpURLConnection; import java.net.URL; import org.apache.commons.io.IOUtils; -import org.junit.Assert; import org.junit.Test; import com.vaadin.tests.tb3.PrivateTB3Configuration; @@ -34,7 +36,7 @@ public class UnsupportedBrowserHandlerUserAgents { public void ie7NotSupported() { String response = requestWithUserAgent( "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.2; WOW64; .NET CLR 2.0.50727)"); - Assert.assertTrue("IE7 should not be supported", + assertTrue("IE7 should not be supported", response.contains("your browser is not supported")); } @@ -42,7 +44,7 @@ public class UnsupportedBrowserHandlerUserAgents { public void ie9NotSupported() { String response = requestWithUserAgent( "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)"); - Assert.assertTrue("IE9 should not be supported", + assertTrue("IE9 should not be supported", response.contains("your browser is not supported")); } @@ -50,7 +52,7 @@ public class UnsupportedBrowserHandlerUserAgents { public void unknownSupported() { String response = requestWithUserAgent( "Very strange user agent, like wat"); - Assert.assertFalse("Unknown user agent should be supported", + assertFalse("Unknown user agent should be supported", response.contains("your browser is not supported")); } diff --git a/uitest/src/test/java/com/vaadin/tests/resources/FrontendInitialResourceUITest.java b/uitest/src/test/java/com/vaadin/tests/resources/FrontendInitialResourceUITest.java index 2c5039717b..4a6a4812f8 100644 --- a/uitest/src/test/java/com/vaadin/tests/resources/FrontendInitialResourceUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/resources/FrontendInitialResourceUITest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.resources; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; @@ -40,7 +41,7 @@ public class FrontendInitialResourceUITest extends MultiBrowserTest { testBench().disableWaitForVaadin(); } - Assert.assertEquals("/VAADIN/frontend/" + es + "/logFilename.js", + assertEquals("/VAADIN/frontend/" + es + "/logFilename.js", findElement(By.tagName("body")).getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUITest.java b/uitest/src/test/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUITest.java index 4709ebbcc0..034b1da1d1 100644 --- a/uitest/src/test/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUITest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.resources; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; @@ -42,7 +43,7 @@ public class FrontendLaterLoadedResourceUITest extends MultiBrowserTest { testBench().disableWaitForVaadin(); } - Assert.assertEquals("/VAADIN/frontend/" + es + "/logFilename.js", + assertEquals("/VAADIN/frontend/" + es + "/logFilename.js", findElement(By.tagName("body")).getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/resources/SpecialCharsInThemeResources.java b/uitest/src/test/java/com/vaadin/tests/resources/SpecialCharsInThemeResources.java index 308cf76e92..862ab2cc56 100644 --- a/uitest/src/test/java/com/vaadin/tests/resources/SpecialCharsInThemeResources.java +++ b/uitest/src/test/java/com/vaadin/tests/resources/SpecialCharsInThemeResources.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.resources; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -47,7 +48,7 @@ public class SpecialCharsInThemeResources extends SingleBrowserTest { private void checkSource() { String source = getDriver().getPageSource(); - Assert.assertTrue("Incorrect contents (was: " + source + ")", + assertTrue("Incorrect contents (was: " + source + ")", source.contains("Just ordinary contents here")); } } diff --git a/uitest/src/test/java/com/vaadin/tests/serialization/EncodeResultDisplayTest.java b/uitest/src/test/java/com/vaadin/tests/serialization/EncodeResultDisplayTest.java index 8d1f78429b..a33d5e26c5 100644 --- a/uitest/src/test/java/com/vaadin/tests/serialization/EncodeResultDisplayTest.java +++ b/uitest/src/test/java/com/vaadin/tests/serialization/EncodeResultDisplayTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.serialization; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -27,18 +29,17 @@ public class EncodeResultDisplayTest extends SingleBrowserTest { int logRow = 0; - Assert.assertEquals("Void: null", getLogRow(logRow++)); - Assert.assertEquals("SimpleTestBean: {\"value\":5}", - getLogRow(logRow++)); - Assert.assertEquals("List: [\"Three\",\"Four\"]", getLogRow(logRow++)); - Assert.assertEquals("String[]: [\"One\",\"Two\"]", getLogRow(logRow++)); - Assert.assertEquals("Double: 2.2", getLogRow(logRow++)); + assertEquals("Void: null", getLogRow(logRow++)); + assertEquals("SimpleTestBean: {\"value\":5}", getLogRow(logRow++)); + assertEquals("List: [\"Three\",\"Four\"]", getLogRow(logRow++)); + assertEquals("String[]: [\"One\",\"Two\"]", getLogRow(logRow++)); + assertEquals("Double: 2.2", getLogRow(logRow++)); // PhantomJS likes to add a couple of extra decimals - Assert.assertTrue(getLogRow(logRow++).startsWith("Float: 1.1")); - Assert.assertEquals("Long: 2147483648", getLogRow(logRow++)); - Assert.assertEquals("Integer: 3", getLogRow(logRow++)); - Assert.assertEquals("Byte: 1", getLogRow(logRow++)); - Assert.assertEquals("Character: \"v\"", getLogRow(logRow++)); - Assert.assertEquals("String: \"My string\"", getLogRow(logRow++)); + assertTrue(getLogRow(logRow++).startsWith("Float: 1.1")); + assertEquals("Long: 2147483648", getLogRow(logRow++)); + assertEquals("Integer: 3", getLogRow(logRow++)); + assertEquals("Byte: 1", getLogRow(logRow++)); + assertEquals("Character: \"v\"", getLogRow(logRow++)); + assertEquals("String: \"My string\"", getLogRow(logRow++)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/serialization/GenericWidgetHandlingTest.java b/uitest/src/test/java/com/vaadin/tests/serialization/GenericWidgetHandlingTest.java index c62cb92378..7e771987f8 100644 --- a/uitest/src/test/java/com/vaadin/tests/serialization/GenericWidgetHandlingTest.java +++ b/uitest/src/test/java/com/vaadin/tests/serialization/GenericWidgetHandlingTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.serialization; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -28,8 +29,7 @@ public class GenericWidgetHandlingTest extends MultiBrowserTest { openTestURL(); WebElement label = vaadinElementById("label"); - Assert.assertEquals("The generic text is strong in this one", - label.getText()); + assertEquals("The generic text is strong in this one", label.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/serialization/LegacySerializerUITest.java b/uitest/src/test/java/com/vaadin/tests/serialization/LegacySerializerUITest.java index 13fa85ca72..015affda80 100644 --- a/uitest/src/test/java/com/vaadin/tests/serialization/LegacySerializerUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/serialization/LegacySerializerUITest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.serialization; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -28,9 +29,9 @@ public class LegacySerializerUITest extends SingleBrowserTest { public void testInfinity() { openTestURL(); WebElement html = findElement(By.className("gwt-HTML")); - Assert.assertEquals("doubleInfinity: Infinity", html.getText()); + assertEquals("doubleInfinity: Infinity", html.getText()); // Can't send infinity back, never have been able to - Assert.assertEquals("1. doubleInfinity: null", getLogRow(0)); + assertEquals("1. doubleInfinity: null", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/tests/serialization/NoLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/serialization/NoLayoutTest.java index 58f36f5665..339132de24 100644 --- a/uitest/src/test/java/com/vaadin/tests/serialization/NoLayoutTest.java +++ b/uitest/src/test/java/com/vaadin/tests/serialization/NoLayoutTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.serialization; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; @@ -72,10 +73,9 @@ public class NoLayoutTest extends MultiBrowserTest { } private void assertCounts(int layoutCount, int rpcCount) { - Assert.assertEquals("Unexpected layout count", layoutCount, + assertEquals("Unexpected layout count", layoutCount, getCount("layoutCount")); - Assert.assertEquals("Unexpected RPC count", rpcCount, - getCount("rpcCount")); + assertEquals("Unexpected RPC count", rpcCount, getCount("rpcCount")); } private int getCount(String id) { diff --git a/uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java b/uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java index db3bdd7a36..77fb764cae 100644 --- a/uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java +++ b/uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.tests.serialization; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -27,105 +29,97 @@ public class SerializerTestTest extends MultiBrowserTest { openTestURL(); int logRow = 0; - Assert.assertEquals( - "sendJson: {\"b\":false,\"s\":\"JSON\"}, null, \"value\"", + assertEquals("sendJson: {\"b\":false,\"s\":\"JSON\"}, null, \"value\"", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals( "sendDateArray: January 31, 2013 10:00:00 PM UTC January 31, 2012 10:00:00 PM UTC", getLogRow(logRow++)); - Assert.assertEquals("sendDate: May 31, 2013 8:12:13 AM UTC", + assertEquals("sendDate: May 31, 2013 8:12:13 AM UTC", getLogRow(logRow++)); - Assert.assertEquals("sendDate: January 1, 1970 12:00:00 AM UTC", + assertEquals("sendDate: January 1, 1970 12:00:00 AM UTC", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals( "sendEnum: PREFORMATTED, [HTML, TEXT], [PREFORMATTED, TEXT]", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals( "sendWrappedGenerics: {[SimpleTestBean(1)]={1=[SimpleTestBean(42)]}}", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals( "sendMap: {a=SimpleTestBean(1)}, [com.vaadin.tests.widgetset.server.SerializerTestExtension=SimpleTestBean(4)], [2=com.vaadin.tests.widgetset.server.SerializerTestExtension], {SimpleTestBean(4)=SimpleTestBean(-4), SimpleTestBean(-5)=SimpleTestBean(5)}", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals( "sendSet: [-12, -7, -4], class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(2), SimpleTestBean(3)]", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals( "sendArrayList: [[2], [2]], [[2, 1], [2, 3]], [[SimpleTestBean(7)]]", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals( "sendList: [-234, 5, 8], class com.vaadin.tests.widgetset.server.SerializerTestExtension, class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(-568), SimpleTestBean(234)]", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals( "sendNestedArray: [[7, 5]], [[SimpleTestBean(2)], [SimpleTestBean(4)]]", getLogRow(logRow++)); - Assert.assertEquals("sendNull: null, Not null", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals("sendNull: null, Not null", getLogRow(logRow++)); + assertEquals( "sendBean: ComplexTestBean [innerBean1=SimpleTestBean(1), innerBean2=SimpleTestBean(3), innerBeanCollection=[SimpleTestBean(6), SimpleTestBean(0)], privimite=6], SimpleTestBean(0), [SimpleTestBean(7)]", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals( "sendConnector: com.vaadin.tests.widgetset.server.SerializerTestExtension", getLogRow(logRow++)); - Assert.assertEquals("sendString: Taegghiiiinnrsssstt‡, [null, ‡]", + assertEquals("sendString: Taegghiiiinnrsssstt‡, [null, ‡]", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals( "sendDouble: 0.423310825130748, 5.859874482048838, [2.0, 1.7976931348623157E308, 4.9E-324]", getLogRow(logRow++)); - Assert.assertEquals("sendFloat: 1.0000001, 3.14159, [-12.0, 0.0, 57.0]", - getLogRow(logRow++)); - Assert.assertEquals("sendLong: -57841235865, 577431841358, [57, 0]", - getLogRow(logRow++)); - Assert.assertEquals("sendInt: 2, 5, [2147483647, 0]", + assertEquals("sendFloat: 1.0000001, 3.14159, [-12.0, 0.0, 57.0]", getLogRow(logRow++)); - Assert.assertEquals("sendChar: Å, ∫, [a, b, c, d]", + assertEquals("sendLong: -57841235865, 577431841358, [57, 0]", getLogRow(logRow++)); - Assert.assertEquals("sendByte: 5, -12, [3, 1, 2]", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals("sendInt: 2, 5, [2147483647, 0]", getLogRow(logRow++)); + assertEquals("sendChar: Å, ∫, [a, b, c, d]", getLogRow(logRow++)); + assertEquals("sendByte: 5, -12, [3, 1, 2]", getLogRow(logRow++)); + assertEquals( "sendBoolean: false, false, [false, false, true, false, true, true]", getLogRow(logRow++)); - Assert.assertEquals("sendBeanSubclass: 43", getLogRow(logRow++)); - Assert.assertEquals( + assertEquals("sendBeanSubclass: 43", getLogRow(logRow++)); + assertEquals( "state.dateArray: Thu Jan 01 02:00:00 GMT+200 1970 Thu Jan 01 02:00:00 GMT+200 1970", getLogRow(logRow++)); - Assert.assertEquals("state.date2: Fri May 31 11:12:13 GMT+300 2013", - getLogRow(logRow++)); - Assert.assertEquals("state.date1: Thu Jan 01 02:00:00 GMT+200 1970", - getLogRow(logRow++)); - Assert.assertEquals("state.jsonBoolean: false", getLogRow(logRow++)); - Assert.assertEquals("state.jsonString: a string", getLogRow(logRow++)); - Assert.assertEquals("state.jsonNull: NULL", getLogRow(logRow++)); - Assert.assertEquals("state.stringArray: [null, ‡]", + assertEquals("state.date2: Fri May 31 11:12:13 GMT+300 2013", getLogRow(logRow++)); - Assert.assertEquals("state.string: This is a tesing string ‡", + assertEquals("state.date1: Thu Jan 01 02:00:00 GMT+200 1970", getLogRow(logRow++)); - Assert.assertEquals( - "state.doubleArray: [1.7976931348623157e+308, 5e-324]", + assertEquals("state.jsonBoolean: false", getLogRow(logRow++)); + assertEquals("state.jsonString: a string", getLogRow(logRow++)); + assertEquals("state.jsonNull: NULL", getLogRow(logRow++)); + assertEquals("state.stringArray: [null, ‡]", getLogRow(logRow++)); + assertEquals("state.string: This is a tesing string ‡", getLogRow(logRow++)); - Assert.assertEquals("state.doubleObjectValue: -2.718281828459045", + assertEquals("state.doubleArray: [1.7976931348623157e+308, 5e-324]", getLogRow(logRow++)); - Assert.assertEquals("state.doubleValue: 3.141592653589793", + assertEquals("state.doubleObjectValue: -2.718281828459045", getLogRow(logRow++)); - Assert.assertEquals("state.floatArray: [57, 0, -12]", + assertEquals("state.doubleValue: 3.141592653589793", getLogRow(logRow++)); - Assert.assertTrue(getLogRow(logRow++) + assertEquals("state.floatArray: [57, 0, -12]", getLogRow(logRow++)); + assertTrue(getLogRow(logRow++) .startsWith("state.floatObjectValue: 1.0000001")); - Assert.assertTrue( - getLogRow(logRow++).startsWith("state.floatValue: 3.14159")); - Assert.assertEquals("state.longArray: [-57841235865, 57]", - getLogRow(logRow++)); - Assert.assertEquals("state.longObjectValue: 577431841360", - getLogRow(logRow++)); - Assert.assertEquals("state.longValue: 577431841359", - getLogRow(logRow++)); - Assert.assertEquals("state.intArray: [5, 7]", getLogRow(logRow++)); - Assert.assertEquals("state.intObjectValue: 42", getLogRow(logRow++)); - Assert.assertEquals("state.intValue: 2147483647", getLogRow(logRow++)); - Assert.assertEquals("state.charArray: aBcD", getLogRow(logRow++)); - Assert.assertEquals("state.charObjectValue: å", getLogRow(logRow++)); - Assert.assertEquals("state.charValue: ∫", getLogRow(logRow++)); - Assert.assertEquals("state.byteArray: [3, 1, 2]", getLogRow(logRow++)); - Assert.assertEquals("state.byteObjectValue: -12", getLogRow(logRow++)); - Assert.assertEquals("state.byteValue: 5", getLogRow(logRow++)); - Assert.assertEquals( + assertTrue(getLogRow(logRow++).startsWith("state.floatValue: 3.14159")); + assertEquals("state.longArray: [-57841235865, 57]", + getLogRow(logRow++)); + assertEquals("state.longObjectValue: 577431841360", + getLogRow(logRow++)); + assertEquals("state.longValue: 577431841359", getLogRow(logRow++)); + assertEquals("state.intArray: [5, 7]", getLogRow(logRow++)); + assertEquals("state.intObjectValue: 42", getLogRow(logRow++)); + assertEquals("state.intValue: 2147483647", getLogRow(logRow++)); + assertEquals("state.charArray: aBcD", getLogRow(logRow++)); + assertEquals("state.charObjectValue: å", getLogRow(logRow++)); + assertEquals("state.charValue: ∫", getLogRow(logRow++)); + assertEquals("state.byteArray: [3, 1, 2]", getLogRow(logRow++)); + assertEquals("state.byteObjectValue: -12", getLogRow(logRow++)); + assertEquals("state.byteValue: 5", getLogRow(logRow++)); + assertEquals( "state.booleanArray: [true, true, false, true, false, false]", getLogRow(logRow++)); diff --git a/uitest/src/test/java/com/vaadin/tests/smoke/DateFieldSmokeTest.java b/uitest/src/test/java/com/vaadin/tests/smoke/DateFieldSmokeTest.java index e86df853d9..915d5359bc 100644 --- a/uitest/src/test/java/com/vaadin/tests/smoke/DateFieldSmokeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/smoke/DateFieldSmokeTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.smoke; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -38,9 +39,9 @@ public class DateFieldSmokeTest extends MultiBrowserTest { openTestURL(); PopupDateFieldElement popup = $(PopupDateFieldElement.class).first(); - Assert.assertEquals("12/28/16", popup.getValue()); + assertEquals("12/28/16", popup.getValue()); InlineDateFieldElement inline = $(InlineDateFieldElement.class).first(); - Assert.assertEquals(String.valueOf(29), + assertEquals(String.valueOf(29), inline.findElement(By.className( "v-inline-datefield-calendarpanel-day-selected")) .getText()); @@ -60,12 +61,12 @@ public class DateFieldSmokeTest extends MultiBrowserTest { inline.findElement(By.className("v-button-prevmonth")).click(); WebElement monthTitle = inline.findElement( By.className("v-inline-datefield-calendarpanel-month")); - Assert.assertEquals("November 2016", monthTitle.getText()); + assertEquals("November 2016", monthTitle.getText()); inline.findElement(By.className("v-button-nextyear")).click(); monthTitle = inline.findElement( By.className("v-inline-datefield-calendarpanel-month")); - Assert.assertEquals("November 2017", monthTitle.getText()); + assertEquals("November 2017", monthTitle.getText()); } private void selectDay(WebElement calendar, int day, String cssPrefix) { diff --git a/uitest/src/test/java/com/vaadin/tests/smoke/GridSmokeTest.java b/uitest/src/test/java/com/vaadin/tests/smoke/GridSmokeTest.java index 5546faf53b..5268919b25 100644 --- a/uitest/src/test/java/com/vaadin/tests/smoke/GridSmokeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/smoke/GridSmokeTest.java @@ -15,11 +15,12 @@ */ package com.vaadin.tests.smoke; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -31,16 +32,16 @@ public class GridSmokeTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); - Assert.assertEquals("Lorem", grid.getCell(0, 1).getText()); - Assert.assertEquals("2", grid.getCell(1, 2).getText()); + assertEquals("Lorem", grid.getCell(0, 1).getText()); + assertEquals("2", grid.getCell(1, 2).getText()); addRow(); - Assert.assertEquals("Dolor", grid.getCell(2, 1).getText()); + assertEquals("Dolor", grid.getCell(2, 1).getText()); addRow(); - Assert.assertEquals("Dolor", grid.getCell(3, 1).getText()); + assertEquals("Dolor", grid.getCell(3, 1).getText()); } private void addRow() { diff --git a/uitest/src/test/java/com/vaadin/tests/smoke/TableSqlContainerTest.java b/uitest/src/test/java/com/vaadin/tests/smoke/TableSqlContainerTest.java index 97d6a7bb58..7e82ff9aba 100644 --- a/uitest/src/test/java/com/vaadin/tests/smoke/TableSqlContainerTest.java +++ b/uitest/src/test/java/com/vaadin/tests/smoke/TableSqlContainerTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.smoke; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; @@ -35,9 +36,8 @@ public class TableSqlContainerTest extends MultiBrowserTest { TableElement table = $(TableElement.class).first(); char ch = 'A'; for (int i = 0; i < 4; i++) { - Assert.assertEquals(String.valueOf(i + 1), - table.getCell(i, 0).getText()); - Assert.assertEquals(String.valueOf(ch) + i % 2, + assertEquals(String.valueOf(i + 1), table.getCell(i, 0).getText()); + assertEquals(String.valueOf(ch) + i % 2, table.getCell(i, 2).getText()); if (i == 1) { ch++; @@ -46,8 +46,7 @@ public class TableSqlContainerTest extends MultiBrowserTest { table.getCell(1, 0).click(); - Assert.assertEquals("Selected: 2", - findElement(By.id("selection")).getText()); + assertEquals("Selected: 2", findElement(By.id("selection")).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java index 3d2c8e8481..c04104934b 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -16,6 +16,11 @@ package com.vaadin.tests.tb3; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; @@ -35,7 +40,6 @@ import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicHttpEntityEnclosingRequest; -import org.junit.Assert; import org.junit.Rule; import org.junit.rules.TestName; import org.junit.runner.RunWith; @@ -209,8 +213,8 @@ public abstract class AbstractTB3Test extends ParallelTest { } protected void clearDebugMessages() { - driver.findElement(By - .xpath("//button[@class='v-debugwindow-button' and @title='Clear log']")) + driver.findElement(By.xpath( + "//button[@class='v-debugwindow-button' and @title='Clear log']")) .click(); } @@ -861,8 +865,8 @@ public abstract class AbstractTB3Test extends ParallelTest { for (WebElement e : logElements) { logRows += "\n" + e.getText(); } - Assert.fail("Found debug messages with level " + level.getName() - + ": " + logRows); + fail("Found debug messages with level " + level.getName() + ": " + + logRows); } } @@ -1115,7 +1119,7 @@ public abstract class AbstractTB3Test extends ParallelTest { * the locator for the element */ protected void assertElementPresent(By by) { - Assert.assertTrue("Element is not present", isElementPresent(by)); + assertTrue("Element is not present", isElementPresent(by)); } /** @@ -1125,7 +1129,7 @@ public abstract class AbstractTB3Test extends ParallelTest { * the locator for the element */ protected void assertElementNotPresent(By by) { - Assert.assertFalse("Element is present", isElementPresent(by)); + assertFalse("Element is present", isElementPresent(by)); } /** @@ -1133,8 +1137,7 @@ public abstract class AbstractTB3Test extends ParallelTest { * "?debug" as exceptions are otherwise not shown as notifications. */ protected void assertNoErrorNotifications() { - Assert.assertFalse( - "Error notification with client side exception is shown", + assertFalse("Error notification with client side exception is shown", isNotificationPresent("error")); } @@ -1142,8 +1145,7 @@ public abstract class AbstractTB3Test extends ParallelTest { * Asserts that no system notifications are shown. */ protected void assertNoSystemNotifications() { - Assert.assertFalse( - "Error notification with system error exception is shown", + assertFalse("Error notification with system error exception is shown", isNotificationPresent("system")); } @@ -1151,14 +1153,14 @@ public abstract class AbstractTB3Test extends ParallelTest { * Asserts that a system notification is shown. */ protected void assertSystemNotification() { - Assert.assertTrue( + assertTrue( "Error notification with system error exception is not shown", isNotificationPresent("system")); } private boolean isNotificationPresent(String type) { if ("error".equals(type)) { - Assert.assertTrue( + assertTrue( "Debug window must be open to be able to see error notifications", isDebugWindowOpen()); } @@ -1193,7 +1195,7 @@ public abstract class AbstractTB3Test extends ParallelTest { } message += " have a horizontal scrollbar (scrollWidth: " + scrollWidth + ", clientWidth: " + clientWidth + "): " + errorMessage; - Assert.assertEquals(message, expected, hasScrollbar); + assertEquals(message, expected, hasScrollbar); } protected void assertNoVerticalScrollbar(WebElement element, @@ -1205,7 +1207,7 @@ public abstract class AbstractTB3Test extends ParallelTest { int scrollHeight = getScrollHeight(element); boolean hasScrollbar = scrollHeight > clientHeight; - Assert.assertFalse( + assertFalse( "The element should not have a vertical scrollbar (scrollHeight: " + scrollHeight + ", clientHeight: " + clientHeight + "): " + errorMessage, @@ -1254,7 +1256,7 @@ public abstract class AbstractTB3Test extends ParallelTest { actualElement = ((WrapsElement) actualElement).getWrappedElement(); } - Assert.assertEquals(expectedElement, actualElement); + assertEquals(expectedElement, actualElement); } protected WebElement getActiveElement() { diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java index aae9b3e13f..4a34c355ad 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -16,6 +16,8 @@ package com.vaadin.tests.tb3; +import static org.junit.Assert.fail; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -26,7 +28,6 @@ import java.util.Calendar; import java.util.Enumeration; import java.util.Properties; -import org.junit.Assert; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.remote.DesiredCapabilities; @@ -92,9 +93,8 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { String allowRunLocally = getProperty(ALLOW_RUN_LOCALLY_PROPERTY); if ((allowRunLocally == null || !allowRunLocally.equals("" + true)) && getClass().getAnnotation(RunLocally.class) != null) { - Assert.fail( - "@RunLocally annotation is not allowed by default in framework tests. " - + "See file uitest/eclipse-run-selected-test.properties for more information."); + fail("@RunLocally annotation is not allowed by default in framework tests. " + + "See file uitest/eclipse-run-selected-test.properties for more information."); } super.setup(); diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/TooltipTest.java b/uitest/src/test/java/com/vaadin/tests/tb3/TooltipTest.java index 9c99818a96..39e837ebfb 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/TooltipTest.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/TooltipTest.java @@ -16,10 +16,13 @@ package com.vaadin.tests.tb3; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.util.List; import java.util.NoSuchElementException; -import org.junit.Assert; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.remote.DesiredCapabilities; @@ -62,19 +65,16 @@ public abstract class TooltipTest extends MultiBrowserTest { protected void checkTooltip(String value) throws Exception { WebElement body = findElement(By.cssSelector("body")); WebElement tooltip = getTooltip(); - Assert.assertEquals(value, tooltip.getText()); - Assert.assertTrue("Tooltip overflowed to the left", + assertEquals(value, tooltip.getText()); + assertTrue("Tooltip overflowed to the left", tooltip.getLocation().getX() >= 0); - Assert.assertTrue("Tooltip overflowed up", - tooltip.getLocation().getY() >= 0); - Assert.assertTrue("Tooltip overflowed to the right", + assertTrue("Tooltip overflowed up", tooltip.getLocation().getY() >= 0); + assertTrue("Tooltip overflowed to the right", tooltip.getLocation().getX() + tooltip.getSize().getWidth() < body.getSize() .getWidth()); - Assert.assertTrue("Tooltip overflowed down", - tooltip.getLocation().getY() - + tooltip.getSize().getHeight() < body.getSize() - .getHeight()); + assertTrue("Tooltip overflowed down", tooltip.getLocation().getY() + + tooltip.getSize().getHeight() < body.getSize().getHeight()); } @@ -93,12 +93,11 @@ public abstract class TooltipTest extends MultiBrowserTest { WebElement tooltip = getTooltip(); if (!tooltip.getText().isEmpty() || tooltip.getLocation().getX() > -999) { - Assert.fail("Found tooltip that shouldn't be visible: " + fail("Found tooltip that shouldn't be visible: " + tooltip.getText() + " at " + tooltip.getLocation()); } } catch (NoSuchElementException e) { - Assert.fail( - "Tooltip element was removed completely, causing extra events to accessibility tools"); + fail("Tooltip element was removed completely, causing extra events to accessibility tools"); } } diff --git a/uitest/src/test/java/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java b/uitest/src/test/java/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java index b90e7f41b2..462b47e776 100644 --- a/uitest/src/test/java/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java @@ -15,19 +15,21 @@ */ package com.vaadin.tests.themes; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; -import com.vaadin.testbench.elements.ComboBoxElement; -import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.ComboBoxElement; import com.vaadin.testbench.elements.EmbeddedElement; import com.vaadin.testbench.elements.MenuBarElement; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.parallel.Browser; import com.vaadin.testbench.parallel.BrowserUtil; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -115,8 +117,7 @@ public class LegacyComponentThemeChangeTest extends MultiBrowserTest { // Something in Selenium normalizes the image so it becomes // "/themes/runo/icons/16/ok.png" here although it is // "/themes/<currenttheme>/../runo/icons/16/ok.png" in the browser - Assert.assertEquals(getThemeURL("runo") + "icons/16/ok.png", - runoImageSrc); + assertEquals(getThemeURL("runo") + "icons/16/ok.png", runoImageSrc); // The other image should change with the theme WebElement themeImage = $(MenuBarElement.class).first() @@ -131,7 +132,7 @@ public class LegacyComponentThemeChangeTest extends MultiBrowserTest { WebElement subMenuRuno = subMenu .findElement(By.xpath(".//span[text()='runo']/img")); String subMenuRunoImageSrc = subMenuRuno.getAttribute("src"); - Assert.assertEquals(getThemeURL("runo") + "icons/16/ok.png", + assertEquals(getThemeURL("runo") + "icons/16/ok.png", subMenuRunoImageSrc); WebElement subMenuThemeImage = subMenu .findElement(By.xpath(".//span[text()='selectedtheme']/img")); @@ -142,7 +143,7 @@ public class LegacyComponentThemeChangeTest extends MultiBrowserTest { String theme) { String value = element.getAttribute(attribute); String expectedPrefix = getThemeURL(theme); - Assert.assertTrue( + assertTrue( "Attribute " + attribute + "='" + value + "' does not start with " + expectedPrefix, value.startsWith(expectedPrefix)); diff --git a/uitest/src/test/java/com/vaadin/tests/themes/ThemeChangeFaviconTest.java b/uitest/src/test/java/com/vaadin/tests/themes/ThemeChangeFaviconTest.java index bc897d14b0..2cb9133bbb 100644 --- a/uitest/src/test/java/com/vaadin/tests/themes/ThemeChangeFaviconTest.java +++ b/uitest/src/test/java/com/vaadin/tests/themes/ThemeChangeFaviconTest.java @@ -15,10 +15,12 @@ */ package com.vaadin.tests.themes; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Collections; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -62,10 +64,10 @@ public class ThemeChangeFaviconTest extends SingleBrowserTest { List<WebElement> elements = findElements( By.cssSelector("link[rel~=\"icon\"]")); - Assert.assertEquals(2, elements.size()); + assertEquals(2, elements.size()); for (WebElement element : elements) { - Assert.assertTrue( + assertTrue( element.getAttribute("href") + " does not end with " + faviconUrl, element.getAttribute("href").endsWith(faviconUrl)); diff --git a/uitest/src/test/java/com/vaadin/tests/themes/valo/CollapsibleTableColumnTest.java b/uitest/src/test/java/com/vaadin/tests/themes/valo/CollapsibleTableColumnTest.java index 92bff1da9b..ef6ac07458 100644 --- a/uitest/src/test/java/com/vaadin/tests/themes/valo/CollapsibleTableColumnTest.java +++ b/uitest/src/test/java/com/vaadin/tests/themes/valo/CollapsibleTableColumnTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.themes.valo; +import static org.junit.Assert.assertNotEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -48,7 +49,7 @@ public class CollapsibleTableColumnTest extends MultiBrowserTest { String nonCollapsibleColumnOpacity = items.get(1) .getCssValue("opacity"); - Assert.assertNotEquals( + assertNotEquals( "Opacity value is the same for collapsible " + "and non-collapsible column item", collapsibleColumnOpacity, nonCollapsibleColumnOpacity); diff --git a/uitest/src/test/java/com/vaadin/tests/themes/valo/ContrastFontColorTest.java b/uitest/src/test/java/com/vaadin/tests/themes/valo/ContrastFontColorTest.java index d802d02bac..ccd34aeb99 100644 --- a/uitest/src/test/java/com/vaadin/tests/themes/valo/ContrastFontColorTest.java +++ b/uitest/src/test/java/com/vaadin/tests/themes/valo/ContrastFontColorTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.themes.valo; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.TextFieldElement; @@ -33,7 +34,7 @@ public class ContrastFontColorTest extends MultiBrowserTest { openTestURL(); String color = $(TextFieldElement.class).first().getCssValue("color"); - Assert.assertEquals( + assertEquals( "Unexpected text color value using 0.1 as defualt contrast value :" + color, "rgba(230, 230, 230, 1)", color); diff --git a/uitest/src/test/java/com/vaadin/tests/themes/valo/DisabledLabelTest.java b/uitest/src/test/java/com/vaadin/tests/themes/valo/DisabledLabelTest.java index 125c852e1e..892a20c021 100644 --- a/uitest/src/test/java/com/vaadin/tests/themes/valo/DisabledLabelTest.java +++ b/uitest/src/test/java/com/vaadin/tests/themes/valo/DisabledLabelTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.themes.valo; -import org.junit.Assert; +import static org.junit.Assert.assertNotEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -39,7 +40,7 @@ public class DisabledLabelTest extends MultiBrowserTest { WebElement disabled = findElement(By.className("my-disabled")); String disabledOpacity = disabled.getCssValue("opacity"); - Assert.assertNotEquals( + assertNotEquals( "Opacity value is the same for enabled and disabled label", enabledOpacity, disabledOpacity); } diff --git a/uitest/src/test/java/com/vaadin/tests/themes/valo/NotificationStyleTest.java b/uitest/src/test/java/com/vaadin/tests/themes/valo/NotificationStyleTest.java index 9d8632218b..6aa7a274be 100644 --- a/uitest/src/test/java/com/vaadin/tests/themes/valo/NotificationStyleTest.java +++ b/uitest/src/test/java/com/vaadin/tests/themes/valo/NotificationStyleTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.themes.valo; +import static org.junit.Assert.assertNotEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; @@ -50,7 +51,7 @@ public class NotificationStyleTest extends MultiBrowserTest { .findElements(By.tagName(ValoTheme.LABEL_H1)); String textAlign = headers.get(0).getCssValue("text-align"); String textAlignInnerHeader = headers.get(1).getCssValue("text-align"); - Assert.assertNotEquals( + assertNotEquals( "Styles for notification defined h1 tag " + "and custom HTML tag are the same", textAlign, textAlignInnerHeader); @@ -71,7 +72,7 @@ public class NotificationStyleTest extends MultiBrowserTest { String display = description.getCssValue("display"); String displayP2 = notification.findElement(By.className("tested-p")) .getCssValue("display"); - Assert.assertNotEquals( + assertNotEquals( "Styles for notification defined 'p' tag " + "and custom HTML tag are the same", display, displayP2); diff --git a/uitest/src/test/java/com/vaadin/tests/tooltip/TooltipAndJavascriptTest.java b/uitest/src/test/java/com/vaadin/tests/tooltip/TooltipAndJavascriptTest.java index dd44a436c8..3e8084b440 100644 --- a/uitest/src/test/java/com/vaadin/tests/tooltip/TooltipAndJavascriptTest.java +++ b/uitest/src/test/java/com/vaadin/tests/tooltip/TooltipAndJavascriptTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.tooltip; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; @@ -33,7 +34,7 @@ public class TooltipAndJavascriptTest extends MultiBrowserTest { WebElement tooltip = findElement( By.cssSelector(".v-overlay-container .v-tooltip")); WebElement overlayContainer = getParent(tooltip); - Assert.assertTrue("v-overlay-container did not receive theme", + assertTrue("v-overlay-container did not receive theme", hasClass(overlayContainer, "reindeer")); } diff --git a/uitest/src/test/java/com/vaadin/tests/util/WidgetUtilTest.java b/uitest/src/test/java/com/vaadin/tests/util/WidgetUtilTest.java index d9c5d74114..0f3d4f6961 100644 --- a/uitest/src/test/java/com/vaadin/tests/util/WidgetUtilTest.java +++ b/uitest/src/test/java/com/vaadin/tests/util/WidgetUtilTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.util; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -67,7 +68,7 @@ public class WidgetUtilTest extends MultiBrowserTest { private void assertExpectedSize(WebElement testComponent, String id, String size) { WebElement e = testComponent.findElement(By.id(id)); - Assert.assertEquals(id + ": " + size, e.getText()); + assertEquals(id + ": " + size, e.getText()); } private boolean browserRoundsBorderToInteger( diff --git a/uitest/src/test/java/com/vaadin/tests/widgetset/server/AssertionsEnabledTest.java b/uitest/src/test/java/com/vaadin/tests/widgetset/server/AssertionsEnabledTest.java index f6bbe2dc0a..73e3587715 100644 --- a/uitest/src/test/java/com/vaadin/tests/widgetset/server/AssertionsEnabledTest.java +++ b/uitest/src/test/java/com/vaadin/tests/widgetset/server/AssertionsEnabledTest.java @@ -1,6 +1,8 @@ package com.vaadin.tests.widgetset.server; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.By; @@ -18,12 +20,12 @@ public class AssertionsEnabledTest extends SingleBrowserTest { // If assertions are disabled, the AssertionFailureWidget will add a // label to the UI. - Assert.assertFalse( + assertFalse( "Label with classname " + FAILING_CLASSNAME + " should not exist", isElementPresent(By.className(FAILING_CLASSNAME))); - Assert.assertTrue("Assertion error Notification is not present", + assertTrue("Assertion error Notification is not present", isElementPresent(NotificationElement.class)); } diff --git a/uitest/src/test/java/com/vaadin/tests/widgetset/server/ClientRpcClassTest.java b/uitest/src/test/java/com/vaadin/tests/widgetset/server/ClientRpcClassTest.java index d71676b298..7d30e20623 100644 --- a/uitest/src/test/java/com/vaadin/tests/widgetset/server/ClientRpcClassTest.java +++ b/uitest/src/test/java/com/vaadin/tests/widgetset/server/ClientRpcClassTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.widgetset.server; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -30,6 +31,6 @@ public class ClientRpcClassTest extends MultiBrowserTest { WebElement element = getDriver() .findElement(By.id(ClientRpcClass.TEST_COMPONENT_ID)); - Assert.assertEquals("pause", element.getText()); + assertEquals("pause", element.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/tests/widgetset/server/NoneLoadStyleTest.java b/uitest/src/test/java/com/vaadin/tests/widgetset/server/NoneLoadStyleTest.java index ce1829796a..f544db8771 100644 --- a/uitest/src/test/java/com/vaadin/tests/widgetset/server/NoneLoadStyleTest.java +++ b/uitest/src/test/java/com/vaadin/tests/widgetset/server/NoneLoadStyleTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.tests.widgetset.server; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; @@ -28,6 +29,6 @@ public class NoneLoadStyleTest extends SingleBrowserTest { String componentText = findElement(By.id("component")).getText(); - Assert.assertTrue(componentText.contains("does not contain")); + assertTrue(componentText.contains("does not contain")); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridDetailsLocationTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridDetailsLocationTest.java index 947539855f..f3be117462 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridDetailsLocationTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridDetailsLocationTest.java @@ -15,11 +15,13 @@ */ package com.vaadin.v7.tests.components.grid; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -30,9 +32,9 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedCondition; import com.vaadin.testbench.TestBenchElement; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.GridElement.GridRowElement; import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.testbench.parallel.TestCategory; @@ -156,7 +158,7 @@ public class GridDetailsLocationTest extends MultiBrowserTest { int visibleIndexOfSpacer) { waitForDetailsVisible(); WebElement details = getDetailsElement(visibleIndexOfSpacer); - Assert.assertEquals("Wrong details row height", expectedHeight, + assertEquals("Wrong details row height", expectedHeight, details.getSize().getHeight()); } @@ -167,11 +169,10 @@ public class GridDetailsLocationTest extends MultiBrowserTest { visibleIndexOfDeco); GridRowElement rowElement = getGrid().getRow(row); - Assert.assertEquals( - "Details deco top position does not match row top pos", + assertEquals("Details deco top position does not match row top pos", rowElement.getLocation().getY(), detailsDecoElement.getLocation().getY()); - Assert.assertEquals( + assertEquals( "Details deco bottom position does not match details bottom pos", detailsElement.getLocation().getY() + detailsElement.getSize().getHeight(), @@ -180,7 +181,7 @@ public class GridDetailsLocationTest extends MultiBrowserTest { } private void verifyLocation(Param param) { - Assert.assertFalse("Notification was present", + assertFalse("Notification was present", isElementPresent(By.className("v-Notification"))); TestBenchElement headerRow = getGrid().getHeaderRow(0); @@ -205,11 +206,13 @@ public class GridDetailsLocationTest extends MultiBrowserTest { + bottomBoundary + " decoratorBotton:" + detailsBottom, detailsBottom, bottomBoundary); - verifyDetailsRowHeight(param.getRowIndex(), param.useGenerator() - ? detailsDefinedHeight : detailsDefaultHeight, 0); + verifyDetailsRowHeight(param.getRowIndex(), + param.useGenerator() ? detailsDefinedHeight + : detailsDefaultHeight, + 0); verifyDetailsDecoratorLocation(param.getRowIndex(), 0, 0); - Assert.assertFalse("Notification was present", + assertFalse("Notification was present", isElementPresent(By.className("v-Notification"))); } @@ -236,7 +239,8 @@ public class GridDetailsLocationTest extends MultiBrowserTest { WebElement detailsElement = getDetailsElement(); return detailsElement.isDisplayed() && detailsElement.getSize().getHeight() > 3 - ? detailsElement : null; + ? detailsElement + : null; } catch (StaleElementReferenceException e) { return null; } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java index 7c99f2e836..02b65533a4 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java @@ -18,12 +18,12 @@ package com.vaadin.v7.tests.components.grid; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.hamcrest.number.IsCloseTo.closeTo; +import static org.junit.Assert.fail; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; @@ -135,7 +135,7 @@ public class GridHeightTest extends MultiBrowserTest { } sb.append(entry.getKey().getMessage()); } - Assert.fail(sb.toString()); + fail(sb.toString()); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSpacerDecoClipTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSpacerDecoClipTest.java index 73046aea28..f2ad86a4e7 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSpacerDecoClipTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSpacerDecoClipTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.v7.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.SearchContext; @@ -56,7 +58,7 @@ public class GridSpacerDecoClipTest extends MultiBrowserTest { nearToBottomRow.doubleClick(); deco = getSpacerDeco(0); System.out.println("Lower deco.clip = " + deco.getCssValue("clip")); - Assert.assertNotEquals( + assertNotEquals( "Spacer deco clipping is not updated after opening another spacer", "auto", deco.getCssValue("clip")); } @@ -85,7 +87,7 @@ public class GridSpacerDecoClipTest extends MultiBrowserTest { String clip = deco.getCssValue("clip"); System.out.println("deco.rect = " + clip); - Assert.assertTrue( + assertTrue( "Part of lower Row Details is visible, its deco clip height should be positive, but it is negative", clip.indexOf('-') < 0); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSubPixelProblemWrappingTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSubPixelProblemWrappingTest.java index 3a86c86ecb..77c72df1ae 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSubPixelProblemWrappingTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSubPixelProblemWrappingTest.java @@ -15,11 +15,12 @@ */ package com.vaadin.v7.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.GridElement.GridRowElement; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -51,7 +52,7 @@ public class GridSubPixelProblemWrappingTest extends MultiBrowserTest { int cell0Top = grid.getCell(rowIndex, 0).getLocation().y; int cell1Top = grid.getCell(rowIndex, 1).getLocation().y; - Assert.assertEquals(rowTop, cell0Top); - Assert.assertEquals(rowTop, cell1Top); + assertEquals(rowTop, cell0Top); + assertEquals(rowTop, cell1Top); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSwitchRenderersTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSwitchRenderersTest.java index 41277df684..71fefad756 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSwitchRenderersTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridSwitchRenderersTest.java @@ -15,11 +15,12 @@ */ package com.vaadin.v7.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -37,8 +38,7 @@ public class GridSwitchRenderersTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); - Assert.assertTrue( - "Initial rendering of column 1 is not unformatted text", + assertTrue("Initial rendering of column 1 is not unformatted text", cellTextIsUnformatted(grid.getCell(0, 1).getText())); // NOTE: must click at 5,5 because of Valo and rendering in Chrome @@ -46,12 +46,12 @@ public class GridSwitchRenderersTest extends MultiBrowserTest { CheckBoxElement cb = $(CheckBoxElement.class).first(); cb.click(5, 5); - Assert.assertTrue( + assertTrue( "Column 1 data has not been rendered with HTMLRenderer after renderer swap", cellTextIsHTMLFormatted(grid.getCell(0, 1).getText())); cb.click(5, 5); - Assert.assertTrue( + assertTrue( "Column 1 data has not been re-rendered as text after renderer swap", cellTextIsUnformatted(grid.getCell(0, 1).getText())); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridThemeChangeTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridThemeChangeTest.java index f96f75a664..1e85ade046 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridThemeChangeTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridThemeChangeTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.v7.tests.components.grid; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.remote.DesiredCapabilities; @@ -47,7 +48,7 @@ public class GridThemeChangeTest extends MultiBrowserTest { grid = $(GridElement.class).first(); int valoHeight = grid.getRow(0).getSize().getHeight(); - Assert.assertTrue( + assertTrue( "Row height should increase when changing from Reindeer to Valo", valoHeight > reindeerHeight); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridWithBrokenRendererTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridWithBrokenRendererTest.java index 90619254f2..5e99ecb703 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridWithBrokenRendererTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridWithBrokenRendererTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.v7.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.GridElement; @@ -33,7 +34,7 @@ public class GridWithBrokenRendererTest extends SingleBrowserTest { private void assertRow(GridElement grid, int row, String... texts) { for (int column = 0; column < texts.length; column++) { - Assert.assertEquals("Cell " + row + "," + column, texts[column], + assertEquals("Cell " + row + "," + column, texts[column], grid.getCell(row, column).getText()); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridWithoutRendererTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridWithoutRendererTest.java index 5ed29705bb..4d4cbafce1 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridWithoutRendererTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridWithoutRendererTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.v7.tests.components.grid; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -36,7 +37,7 @@ public class GridWithoutRendererTest extends SingleBrowserTest { // System.out.println(errorIndicator); List<WebElement> errorIndicator = findElements( By.xpath("//span[@class='v-errorindicator']")); - Assert.assertTrue("There should not be an error indicator", + assertTrue("There should not be an error indicator", errorIndicator.isEmpty()); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGridTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGridTest.java index cf23a7f379..6a4c361cbf 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGridTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGridTest.java @@ -1,6 +1,8 @@ package com.vaadin.v7.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -17,8 +19,8 @@ public class InitiallyDisabledGridTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); GridCellElement col0 = grid.getCell(0, 0); GridCellElement col1 = grid.getCell(0, 1); - Assert.assertTrue(col0.getSize().getWidth() > 250); - Assert.assertTrue(col1.getSize().getWidth() > 250); + assertTrue(col0.getSize().getWidth() > 250); + assertTrue(col1.getSize().getWidth() > 250); } @Test @@ -29,6 +31,6 @@ public class InitiallyDisabledGridTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); grid.scrollToRow(80); GridCellElement col0 = grid.getCell(80, 0); - Assert.assertEquals("First 80", col0.getText()); + assertEquals("First 80", col0.getText()); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/JavaScriptRenderersTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/JavaScriptRenderersTest.java index 687c02b068..88d68d2b54 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/JavaScriptRenderersTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/JavaScriptRenderersTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.v7.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.GridElement; @@ -37,16 +39,15 @@ public class JavaScriptRenderersTest extends MultiBrowserTest { GridCellElement cell_2_2 = grid.getCell(2, 2); // Verify render functionality - Assert.assertEquals("Bean(2, 0)", cell_1_1.getText()); + assertEquals("Bean(2, 0)", cell_1_1.getText()); - Assert.assertEquals("string2", cell_2_2.getText()); + assertEquals("string2", cell_2_2.getText()); // Verify init functionality - Assert.assertEquals("1", cell_1_1.getAttribute("column")); + assertEquals("1", cell_1_1.getAttribute("column")); // Verify onbrowserevent cell_1_1.click(); - Assert.assertTrue( - cell_1_1.getText().startsWith("Clicked 1 with key 2 at")); + assertTrue(cell_1_1.getText().startsWith("Clicked 1 with key 2 at")); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/NullHeadersTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/NullHeadersTest.java index 9e438b6d07..46227f325b 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/NullHeadersTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/NullHeadersTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.v7.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.GridElement; @@ -29,10 +30,10 @@ public class NullHeadersTest extends SingleBrowserTest { GridElement grid = $(GridElement.class).first(); - Assert.assertEquals(1, grid.getHeaderCount()); - Assert.assertEquals(3, grid.getHeaderCells(0).size()); + assertEquals(1, grid.getHeaderCount()); + assertEquals(3, grid.getHeaderCells(0).size()); for (int i = 0; i < 3; i++) { - Assert.assertEquals("", grid.getHeaderCell(0, 0).getText()); + assertEquals("", grid.getHeaderCell(0, 0).getText()); } assertRow(grid, 0, "Finland", "foo", "1"); assertRow(grid, 1, "Swaziland", "bar", "2"); @@ -41,8 +42,7 @@ public class NullHeadersTest extends SingleBrowserTest { private void assertRow(GridElement grid, int row, String... contents) { for (int col = 0; col < contents.length; col++) { - Assert.assertEquals(contents[col], - grid.getCell(row, col).getText()); + assertEquals(contents[col], grid.getCell(row, col).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/ProgrammaticEditorControlTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/ProgrammaticEditorControlTest.java index 17ec4d393e..f37dfd198e 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/ProgrammaticEditorControlTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/ProgrammaticEditorControlTest.java @@ -15,11 +15,13 @@ */ package com.vaadin.v7.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import org.junit.Test; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.SingleBrowserTest; @@ -49,13 +51,13 @@ public class ProgrammaticEditorControlTest extends SingleBrowserTest { private void assertEditorFieldContents(GridElement grid, String text) { TextFieldElement editorField = wrap(TextFieldElement.class, grid.getEditor().getField(0)); - Assert.assertEquals(text, editorField.getValue()); + assertEquals(text, editorField.getValue()); } private void assertEditorNotPresent(GridElement grid) { try { grid.getEditor(); - Assert.fail("Editor should not be present"); + fail("Editor should not be present"); } catch (Exception e) { } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/RemoveHiddenColumnTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/RemoveHiddenColumnTest.java index ecb5285401..730dc16650 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/RemoveHiddenColumnTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/RemoveHiddenColumnTest.java @@ -1,6 +1,7 @@ package com.vaadin.v7.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -26,18 +27,17 @@ public class RemoveHiddenColumnTest extends SingleBrowserTest { private void removeColumns() { ButtonElement remove = $(ButtonElement.class).id("remove"); remove.click(); - Assert.assertEquals("1. Removed column 'First Name' (hidden)", - getLogRow(0)); + assertEquals("1. Removed column 'First Name' (hidden)", getLogRow(0)); assertNoErrorNotifications(); remove.click(); - Assert.assertEquals("2. Removed column 'Last Name'", getLogRow(0)); + assertEquals("2. Removed column 'Last Name'", getLogRow(0)); assertNoErrorNotifications(); remove.click(); - Assert.assertEquals("3. Removed column 'Email' (hidden)", getLogRow(0)); + assertEquals("3. Removed column 'Email' (hidden)", getLogRow(0)); assertNoErrorNotifications(); remove.click(); - Assert.assertEquals("4. Removed column 'Age'", getLogRow(0)); + assertEquals("4. Removed column 'Age'", getLogRow(0)); assertNoErrorNotifications(); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/SortableHeaderStylesTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/SortableHeaderStylesTest.java index 1c419d41bb..052ccda425 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/SortableHeaderStylesTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/SortableHeaderStylesTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.v7.tests.components.grid; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.GridElement; @@ -27,9 +29,9 @@ public class SortableHeaderStylesTest extends SingleBrowserTest { public void testSortableHeaderStyles() { openTestURL(); - Assert.assertFalse(hasSortableStyle(0)); + assertFalse(hasSortableStyle(0)); for (int i = 1; i < 8; i++) { - Assert.assertTrue(hasSortableStyle(i)); + assertTrue(hasSortableStyle(i)); } OptionGroupElement sortableSelector = $(OptionGroupElement.class) @@ -37,11 +39,11 @@ public class SortableHeaderStylesTest extends SingleBrowserTest { // Toggle sortability sortableSelector.selectByText("lastName"); - Assert.assertFalse(hasSortableStyle(3)); + assertFalse(hasSortableStyle(3)); // Toggle back sortableSelector.selectByText("lastName"); - Assert.assertTrue(hasSortableStyle(3)); + assertTrue(hasSortableStyle(3)); } private boolean hasSortableStyle(int column) { diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java index f038aa165b..6531acb993 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java @@ -827,19 +827,19 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { selectMenuPath("Component", "Row details", "Toggle details for...", "Row 1"); assertColumnHeaderOrder(0, 1, 2, 3, 4); - Assert.assertNotNull("Details not found", + assertNotNull("Details not found", getGridElement().getDetails(1)); toggleHideColumnAPI(0); assertColumnHeaderOrder(1, 2, 3, 4); - Assert.assertNotNull("Details not found", + assertNotNull("Details not found", getGridElement().getDetails(1)); toggleHideColumnAPI(0); assertColumnHeaderOrder(0, 1, 2, 3, 4); - Assert.assertNotNull("Details not found", + assertNotNull("Details not found", getGridElement().getDetails(1)); } @@ -884,16 +884,16 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { toggleHideColumnAPI(1); getGridElement().scrollToRow(500); - Assert.assertEquals("(500, 0)", + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); - Assert.assertEquals("(500, 2)", + assertEquals("(500, 2)", getGridElement().getCell(500, 1).getText()); toggleHideColumnAPI(1); - Assert.assertEquals("(500, 0)", + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); - Assert.assertEquals("(500, 1)", + assertEquals("(500, 1)", getGridElement().getCell(500, 1).getText()); } @@ -902,25 +902,25 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { toggleHidableColumnAPI(0); toggleHidableColumnAPI(1); - Assert.assertEquals("(500, 0)", + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); - Assert.assertEquals("(500, 1)", + assertEquals("(500, 1)", getGridElement().getCell(500, 1).getText()); toggleHideColumnAPI(0); toggleHideColumnAPI(1); - Assert.assertEquals("(500, 2)", + assertEquals("(500, 2)", getGridElement().getCell(500, 0).getText()); - Assert.assertEquals("(500, 3)", + assertEquals("(500, 3)", getGridElement().getCell(500, 1).getText()); toggleHideColumnAPI(0); toggleHideColumnAPI(1); - Assert.assertEquals("(500, 0)", + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); - Assert.assertEquals("(500, 1)", + assertEquals("(500, 1)", getGridElement().getCell(500, 1).getText()); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java index db10556069..db7be31eab 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.v7.tests.components.grid.basicfeatures; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.WebElement; @@ -73,7 +74,7 @@ public class GridColumnResizeModeTest extends GridBasicFeaturesTest { // See that we got a resize event sleep(500); - Assert.assertEquals("Log shows resize event", getLogRow(0), + assertEquals("Log shows resize event", getLogRow(0), "3. ColumnResizeEvent: isUserOriginated? true"); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridCellStyleGeneratorTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridCellStyleGeneratorTest.java index 2168d92074..50768df867 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridCellStyleGeneratorTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridCellStyleGeneratorTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.v7.tests.components.grid.basicfeatures.client; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.GridElement.GridCellElement; @@ -37,16 +39,16 @@ public class GridCellStyleGeneratorTest extends GridBasicClientFeaturesTest { GridRowElement row2 = getGridElement().getRow(2); GridCellElement cell4_2 = getGridElement().getCell(4, 2); - Assert.assertTrue(hasCssClass(row2, "2")); - Assert.assertTrue(hasCssClass(cell4_2, "4_2")); + assertTrue(hasCssClass(row2, "2")); + assertTrue(hasCssClass(cell4_2, "4_2")); // Scroll down and verify that the old elements don't have the // stylename any more getGridElement().getRow(350); - Assert.assertFalse(hasCssClass(row2, "2")); - Assert.assertFalse(hasCssClass(cell4_2, "4_2")); + assertFalse(hasCssClass(row2, "2")); + assertFalse(hasCssClass(cell4_2, "4_2")); } @Test @@ -62,8 +64,8 @@ public class GridCellStyleGeneratorTest extends GridBasicClientFeaturesTest { GridRowElement row2 = getGridElement().getRow(2); GridCellElement cell4_2 = getGridElement().getCell(4, 2); - Assert.assertTrue(hasCssClass(row2, "2")); - Assert.assertTrue(hasCssClass(cell4_2, "4_2")); + assertTrue(hasCssClass(row2, "2")); + assertTrue(hasCssClass(cell4_2, "4_2")); // Disable the generator and check again selectCellStyleNameGenerator( @@ -71,8 +73,8 @@ public class GridCellStyleGeneratorTest extends GridBasicClientFeaturesTest { selectRowStyleNameGenerator( GridBasicClientFeaturesWidget.ROW_STYLE_GENERATOR_NONE); - Assert.assertFalse(hasCssClass(row2, "2")); - Assert.assertFalse(hasCssClass(cell4_2, "4_2")); + assertFalse(hasCssClass(row2, "2")); + assertFalse(hasCssClass(cell4_2, "4_2")); } @Test @@ -88,8 +90,8 @@ public class GridCellStyleGeneratorTest extends GridBasicClientFeaturesTest { GridRowElement row2 = getGridElement().getRow(2); GridCellElement cell4_2 = getGridElement().getCell(4, 2); - Assert.assertTrue(hasCssClass(row2, "2")); - Assert.assertTrue(hasCssClass(cell4_2, "4_2")); + assertTrue(hasCssClass(row2, "2")); + assertTrue(hasCssClass(cell4_2, "4_2")); // Change the generator and check again selectRowStyleNameGenerator( @@ -98,11 +100,11 @@ public class GridCellStyleGeneratorTest extends GridBasicClientFeaturesTest { GridBasicClientFeaturesWidget.CELL_STYLE_GENERATOR_SIMPLE); // Old styles removed? - Assert.assertFalse(hasCssClass(row2, "2")); - Assert.assertFalse(hasCssClass(cell4_2, "4_2")); + assertFalse(hasCssClass(row2, "2")); + assertFalse(hasCssClass(cell4_2, "4_2")); // New style present? - Assert.assertTrue(hasCssClass(cell4_2, "two")); + assertTrue(hasCssClass(cell4_2, "two")); } @Test @@ -118,21 +120,20 @@ public class GridCellStyleGeneratorTest extends GridBasicClientFeaturesTest { GridRowElement row2 = getGridElement().getRow(2); GridCellElement cell4_2 = getGridElement().getCell(4, 2); - Assert.assertTrue(hasCssClass(row2, "2")); - Assert.assertTrue(hasCssClass(cell4_2, "4_2")); + assertTrue(hasCssClass(row2, "2")); + assertTrue(hasCssClass(cell4_2, "4_2")); // Change primary stylename selectMenuPath("Component", "State", "Primary Stylename", "v-escalator"); // Styles still present - Assert.assertTrue(hasCssClass(row2, "2")); - Assert.assertTrue(hasCssClass(cell4_2, "4_2")); + assertTrue(hasCssClass(row2, "2")); + assertTrue(hasCssClass(cell4_2, "4_2")); // New styles present? - Assert.assertFalse(hasCssClass(row2, "v-escalator-row-2")); - Assert.assertFalse( - hasCssClass(cell4_2, "v-escalator-cell-content-4_2")); + assertFalse(hasCssClass(row2, "v-escalator-row-2")); + assertFalse(hasCssClass(cell4_2, "v-escalator-cell-content-4_2")); } private void selectCellStyleNameGenerator(String name) { diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridClientKeyEventsTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridClientKeyEventsTest.java index 0321159bcd..58a97c4946 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridClientKeyEventsTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridClientKeyEventsTest.java @@ -16,13 +16,13 @@ package com.vaadin.v7.tests.components.grid.basicfeatures.client; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.Arrays; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.interactions.Actions; @@ -99,23 +99,23 @@ public class GridClientKeyEventsTest extends GridBasicClientFeaturesTest { // Focus cell above select all checkbox getGridElement().getHeaderCell(0, 0).click(); - Assert.assertFalse(isRowSelected(1)); + assertFalse(isRowSelected(1)); new Actions(getDriver()).sendKeys(" ").perform(); - Assert.assertFalse(isRowSelected(1)); + assertFalse(isRowSelected(1)); // Move down to select all checkbox cell new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN).perform(); - Assert.assertFalse(isRowSelected(1)); + assertFalse(isRowSelected(1)); new Actions(getDriver()).sendKeys(" ").perform(); // select all - Assert.assertTrue(isRowSelected(1)); + assertTrue(isRowSelected(1)); new Actions(getDriver()).sendKeys(" ").perform(); // deselect all - Assert.assertFalse(isRowSelected(1)); + assertFalse(isRowSelected(1)); // Move down to header below select all checkbox cell new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN).perform(); - Assert.assertFalse(isRowSelected(1)); + assertFalse(isRowSelected(1)); new Actions(getDriver()).sendKeys(" ").perform(); // deselect all - Assert.assertFalse(isRowSelected(1)); + assertFalse(isRowSelected(1)); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridSidebarContentTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridSidebarContentTest.java index 1d4ef1f171..9882752d60 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridSidebarContentTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridSidebarContentTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.v7.tests.components.grid.basicfeatures.client; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -31,7 +32,7 @@ public class GridSidebarContentTest extends GridBasicClientFeaturesTest { public void testSidebarWithHidableColumn() { openTestURL(); - Assert.assertEquals("Sidebar should not be initially present", 0, + assertEquals("Sidebar should not be initially present", 0, countBySelector(".v-grid-sidebar-button")); selectMenuPath("Component", "Columns", "Column 0", "Hidable"); @@ -41,12 +42,12 @@ public class GridSidebarContentTest extends GridBasicClientFeaturesTest { WebElement toggle = getSidebarPopup() .findElement(By.className("column-hiding-toggle")); - Assert.assertEquals("Column 0 should be togglable", "Header (0,0)", + assertEquals("Column 0 should be togglable", "Header (0,0)", toggle.getText()); selectMenuPath("Component", "Columns", "Column 0", "Hidable"); - Assert.assertEquals("Sidebar should disappear without toggable column", - 0, countBySelector(".v-grid-sidebar-button")); + assertEquals("Sidebar should disappear without toggable column", 0, + countBySelector(".v-grid-sidebar-button")); } @@ -64,7 +65,7 @@ public class GridSidebarContentTest extends GridBasicClientFeaturesTest { sidebarItem.click(); - Assert.assertEquals("Sidebar should be closed after clicking item 0", 0, + assertEquals("Sidebar should be closed after clicking item 0", 0, countBySelector(".v-grid-sidebar-content")); } @@ -76,7 +77,7 @@ public class GridSidebarContentTest extends GridBasicClientFeaturesTest { selectMenuPath("Component", "Sidebar", "Toggle sidebar visibility"); - Assert.assertEquals("Sidebar should be open", 1, + assertEquals("Sidebar should be open", 1, countBySelector(".v-grid-sidebar-content")); } @@ -125,18 +126,18 @@ public class GridSidebarContentTest extends GridBasicClientFeaturesTest { List<WebElement> menuItems = getSidebarPopup() .findElements(By.cssSelector(".v-grid-sidebar-content td")); - Assert.assertEquals("Expected " + items.length + " menu items", - items.length, menuItems.size()); + assertEquals("Expected " + items.length + " menu items", items.length, + menuItems.size()); for (int i = 0; i < items.length; i++) { String expectedItem = items[i]; if (expectedItem == null) { - Assert.assertEquals("Item " + i + " should be a separator", + assertEquals("Item " + i + " should be a separator", "gwt-MenuItemSeparator", menuItems.get(i).getAttribute("class")); } else { - Assert.assertEquals("Unexpected content for item " + i, - expectedItem, menuItems.get(i).getText()); + assertEquals("Unexpected content for item " + i, expectedItem, + menuItems.get(i).getText()); } } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java index 5d1d99c426..74a2950aeb 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java @@ -16,8 +16,8 @@ package com.vaadin.v7.tests.components.grid.basicfeatures.server; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; -import org.junit.Assert; import org.junit.Test; import com.vaadin.testbench.elements.GridElement.GridCellElement; @@ -39,8 +39,8 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest { GridRowElement row = getGridElement().getRow(2); GridCellElement cell = getGridElement().getCell(3, 2); - Assert.assertTrue(hasCssClass(row, "row2")); - Assert.assertTrue(hasCssClass(cell, "Column_2")); + assertTrue(hasCssClass(row, "row2")); + assertTrue(hasCssClass(cell, "Column_2")); // Scroll down and verify that the old elements don't have the // stylename any more @@ -49,8 +49,8 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest { row = getGridElement().getRow(352); cell = getGridElement().getCell(353, 2); - Assert.assertFalse(hasCssClass(row, "row352")); - Assert.assertFalse(hasCssClass(cell, "Column_2")); + assertFalse(hasCssClass(row, "row352")); + assertFalse(hasCssClass(cell, "Column_2")); } @Test @@ -66,16 +66,16 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest { GridRowElement row2 = getGridElement().getRow(2); GridCellElement cell3_2 = getGridElement().getCell(3, 2); - Assert.assertTrue(hasCssClass(row2, "row2")); - Assert.assertTrue(hasCssClass(cell3_2, "Column_2")); + assertTrue(hasCssClass(row2, "row2")); + assertTrue(hasCssClass(cell3_2, "Column_2")); // Disable the generator and check again selectRowStyleNameGenerator(GridBasicFeatures.ROW_STYLE_GENERATOR_NONE); selectCellStyleNameGenerator( GridBasicFeatures.CELL_STYLE_GENERATOR_NONE); - Assert.assertFalse(hasCssClass(row2, "row2")); - Assert.assertFalse(hasCssClass(cell3_2, "Column_2")); + assertFalse(hasCssClass(row2, "row2")); + assertFalse(hasCssClass(cell3_2, "Column_2")); } @Test @@ -91,8 +91,8 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest { GridRowElement row2 = getGridElement().getRow(2); GridCellElement cell3_2 = getGridElement().getCell(3, 2); - Assert.assertTrue(hasCssClass(row2, "row2")); - Assert.assertTrue(hasCssClass(cell3_2, "Column_2")); + assertTrue(hasCssClass(row2, "row2")); + assertTrue(hasCssClass(cell3_2, "Column_2")); // Change the generator and check again selectRowStyleNameGenerator(GridBasicFeatures.ROW_STYLE_GENERATOR_NONE); @@ -100,11 +100,11 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest { GridBasicFeatures.CELL_STYLE_GENERATOR_PROPERTY_TO_STRING); // Old styles removed? - Assert.assertFalse(hasCssClass(row2, "row2")); - Assert.assertFalse(hasCssClass(cell3_2, "Column_2")); + assertFalse(hasCssClass(row2, "row2")); + assertFalse(hasCssClass(cell3_2, "Column_2")); // New style present? - Assert.assertTrue(hasCssClass(cell3_2, "Column-2")); + assertTrue(hasCssClass(cell3_2, "Column-2")); } @Test diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridClearContainerTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridClearContainerTest.java index 49f7321cf3..21f13f3c76 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridClearContainerTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridClearContainerTest.java @@ -15,11 +15,12 @@ */ package com.vaadin.v7.tests.components.grid.basicfeatures.server; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; -import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -40,12 +41,12 @@ public class GridClearContainerTest extends MultiBrowserTest { ButtonElement button = $(ButtonElement.class) .caption("Clear and re-add").first(); GridElement grid = $(GridElement.class).first(); - Assert.assertEquals(ERRORNOTE, "default", grid.getCell(0, 0).getText()); - Assert.assertEquals(ERRORNOTE, "default", grid.getCell(1, 0).getText()); + assertEquals(ERRORNOTE, "default", grid.getCell(0, 0).getText()); + assertEquals(ERRORNOTE, "default", grid.getCell(1, 0).getText()); button.click(); - Assert.assertEquals(ERRORNOTE, "Updated value 1", + assertEquals(ERRORNOTE, "Updated value 1", grid.getCell(0, 0).getText()); - Assert.assertEquals(ERRORNOTE, "Updated value 2", + assertEquals(ERRORNOTE, "Updated value 2", grid.getCell(1, 0).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java index f02c88f0e8..c27afc4fd0 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java @@ -322,7 +322,7 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { getColumnHidingToggle(3).click(); // Make sure that the new column contains the data it should - Assert.assertEquals("(999, 3)", + assertEquals("(999, 3)", getGridElement().getCell(999, 3).getText()); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridRowAddRemoveTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridRowAddRemoveTest.java index fd56fbf2f2..b6c6a69c91 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridRowAddRemoveTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridRowAddRemoveTest.java @@ -15,7 +15,9 @@ */ package com.vaadin.v7.tests.components.grid.basicfeatures.server; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import com.vaadin.testbench.elements.NotificationElement; @@ -32,8 +34,7 @@ public class GridRowAddRemoveTest extends GridBasicFeaturesTest { selectMenuPath("Component", "Body rows", "Remove all rows"); selectMenuPath("Component", "Body rows", "Add 18 rows"); - Assert.assertTrue( - "All added rows should be fetched in the same round trip.", + assertTrue("All added rows should be fetched in the same round trip.", logContainsText("Requested items 0 - 18")); } @@ -45,7 +46,7 @@ public class GridRowAddRemoveTest extends GridBasicFeaturesTest { selectMenuPath("Settings", "Clear log"); selectMenuPath("Component", "Body rows", "Add 18 rows"); - Assert.assertFalse("An error notification is present.", + assertFalse("An error notification is present.", isElementPresent(NotificationElement.class)); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java index 93aaa8a86a..fe0adfa112 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.v7.tests.components.grid.basicfeatures.server; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; @@ -35,7 +36,7 @@ public class LoadingIndicatorTest extends GridBasicFeaturesTest { GridElement gridElement = $(GridElement.class).first(); - Assert.assertFalse( + assertFalse( "Loading indicator should not be visible before disabling waitForVaadin", isLoadingIndicatorVisible()); @@ -58,7 +59,7 @@ public class LoadingIndicatorTest extends GridBasicFeaturesTest { // Wait for potentially triggered loading indicator to become visible Thread.sleep(500); - Assert.assertFalse( + assertFalse( "Loading indicator should not be visible when fetching rows that are not visible", isLoadingIndicatorVisible()); diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectNullTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectNullTest.java index 2ddb68988e..bb880826c7 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectNullTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectNullTest.java @@ -1,6 +1,7 @@ package com.vaadin.v7.tests.components.nativeselect; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.NativeSelectElement; @@ -12,8 +13,8 @@ public class NativeSelectNullTest extends SingleBrowserTestPhantomJS2 { openTestURL(); NativeSelectElement select = $(NativeSelectElement.class).first(); select.selectByText("Item"); - Assert.assertEquals("1. Value: Item", getLogRow(0)); + assertEquals("1. Value: Item", getLogRow(0)); select.selectByText(""); - Assert.assertEquals("2. Value: null", getLogRow(0)); + assertEquals("2. Value: null", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java index e6588b9aa5..6ea390c82c 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.v7.tests.components.nativeselect; +import static org.junit.Assert.assertTrue; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -55,9 +56,9 @@ public class NativeSelectsAndChromeKeyboardNavigationTest String bodytext = getDriver().findElement(By.tagName("body")).getText(); - Assert.assertTrue(bodytext.contains("new value: 'Item 1'")); - Assert.assertTrue(bodytext.contains("new value: 'Item 2'")); - Assert.assertTrue(bodytext.contains("new value: 'Item 3'")); + assertTrue(bodytext.contains("new value: 'Item 1'")); + assertTrue(bodytext.contains("new value: 'Item 2'")); + assertTrue(bodytext.contains("new value: 'Item 3'")); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectsFocusAndBlurListenerTests.java b/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectsFocusAndBlurListenerTests.java index a9e7d1b624..fb5d09012c 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectsFocusAndBlurListenerTests.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/nativeselect/NativeSelectsFocusAndBlurListenerTests.java @@ -15,7 +15,8 @@ */ package com.vaadin.v7.tests.components.nativeselect; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.interactions.Actions; @@ -49,11 +50,11 @@ public class NativeSelectsFocusAndBlurListenerTests extends MultiBrowserTest { // Chrome/PhantomJS if (BrowserUtil.isChrome(getDesiredCapabilities()) || BrowserUtil.isPhantomJS(getDesiredCapabilities())) { - Assert.assertEquals("4. FocusEvent", getLogRow(1)); - Assert.assertEquals("5. BlurEvent", getLogRow(0)); + assertEquals("4. FocusEvent", getLogRow(1)); + assertEquals("5. BlurEvent", getLogRow(0)); } else { - Assert.assertEquals("2. FocusEvent", getLogRow(1)); - Assert.assertEquals("3. BlurEvent", getLogRow(0)); + assertEquals("2. FocusEvent", getLogRow(1)); + assertEquals("3. BlurEvent", getLogRow(0)); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/textfield/TextChangeEventsTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/textfield/TextChangeEventsTest.java index 3efb8b8369..47cc3c1a26 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/textfield/TextChangeEventsTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/textfield/TextChangeEventsTest.java @@ -1,6 +1,7 @@ package com.vaadin.v7.tests.components.textfield; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import com.vaadin.testbench.elements.TextAreaElement; @@ -16,14 +17,14 @@ public class TextChangeEventsTest extends SingleBrowserTest { TextAreaElement taDefault = $(TextAreaElement.class) .caption("Default text area").first(); taDefault.sendKeys("abc"); - Assert.assertEquals( + assertEquals( "1. Text change event for Default text area, text content currently:'abc' Cursor at index:3", getLogRow(0)); TextAreaElement taTimeout = $(TextAreaElement.class) .caption("Timeout 3s").first(); taTimeout.sendKeys("abc"); - Assert.assertEquals( + assertEquals( "2. Text change event for Timeout 3s, text content currently:'abc' Cursor at index:3", getLogRow(0)); @@ -36,21 +37,21 @@ public class TextChangeEventsTest extends SingleBrowserTest { TextFieldElement tfDefault = $(TextFieldElement.class) .caption("Default").first(); tfDefault.sendKeys("abc"); - Assert.assertEquals( + assertEquals( "1. Text change event for Default, text content currently:'abc' Cursor at index:3", getLogRow(0)); TextFieldElement tfEager = $(TextFieldElement.class).caption("Eager") .first(); tfEager.sendKeys("abc"); - Assert.assertEquals( + assertEquals( "2. Text change event for Eager, text content currently:'abc' Cursor at index:3", getLogRow(0)); TextFieldElement tfTimeout = $(TextFieldElement.class) .caption("Timeout 3s").first(); tfTimeout.sendKeys("abc"); - Assert.assertEquals( + assertEquals( "3. Text change event for Timeout 3s, text content currently:'abc' Cursor at index:3", getLogRow(0)); diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeContextMenuAndIconsTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeContextMenuAndIconsTest.java index c404066473..11ab9f7018 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeContextMenuAndIconsTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeContextMenuAndIconsTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.v7.tests.components.tree; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Dimension; import org.openqa.selenium.WebElement; @@ -26,7 +27,6 @@ import org.openqa.selenium.remote.DesiredCapabilities; import com.vaadin.testbench.By; import com.vaadin.tests.tb3.MultiBrowserTest; -import com.vaadin.v7.tests.components.tree.Trees; public class TreeContextMenuAndIconsTest extends MultiBrowserTest { @@ -84,7 +84,7 @@ public class TreeContextMenuAndIconsTest extends MultiBrowserTest { // background image contains parts of other sprites => // just check that the menu is of correct size Dimension size = menu.getSize(); - Assert.assertEquals("Menu height with large icons", 74, size.height); + assertEquals("Menu height with large icons", 74, size.height); closeContextMenu(); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeHtmlContentAllowedTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeHtmlContentAllowedTest.java index e0a5cb766b..211253e1df 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeHtmlContentAllowedTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeHtmlContentAllowedTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.v7.tests.components.tree; +import static org.junit.Assert.assertEquals; + import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -33,8 +34,8 @@ public class TreeHtmlContentAllowedTest extends SingleBrowserTest { openTestURL(); CheckBoxElement toggle = $(CheckBoxElement.class).first(); - Assert.assertEquals("HTML content should be disabled by default", - "unchecked", toggle.getValue()); + assertEquals("HTML content should be disabled by default", "unchecked", + toggle.getValue()); // Markup is seen as plain text assertTreeCaptionTexts("Just text", "Some <b>html</b>", @@ -62,7 +63,7 @@ public class TreeHtmlContentAllowedTest extends SingleBrowserTest { private void assertHtmlElementSelected() { TreeElement tree = $(TreeElement.class).first(); - Assert.assertEquals(tree.getValue(), "Child element html"); + assertEquals(tree.getValue(), "Child element html"); } private void assertTreeCaptionTexts(String... captions) { @@ -70,9 +71,9 @@ public class TreeHtmlContentAllowedTest extends SingleBrowserTest { List<WebElement> nodes = tree .findElements(By.className("v-tree-node-caption")); - Assert.assertEquals(captions.length, nodes.size()); + assertEquals(captions.length, nodes.size()); for (int i = 0; i < captions.length; i++) { - Assert.assertEquals(captions[i], nodes.get(i).getText()); + assertEquals(captions[i], nodes.get(i).getText()); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeKeyboardNavigationToNoneTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeKeyboardNavigationToNoneTest.java index 8e84096aae..13dce2eb04 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeKeyboardNavigationToNoneTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeKeyboardNavigationToNoneTest.java @@ -15,7 +15,8 @@ */ package com.vaadin.v7.tests.components.tree; -import org.junit.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -53,7 +54,7 @@ public class TreeKeyboardNavigationToNoneTest extends MultiBrowserTest { } private void checkNotificationErrorAbsence(String item) { - Assert.assertFalse( + assertFalse( "Notification is found after using keyboard for navigation " + "from " + item + " tree item", isElementPresent(By.className("v-Notification"))); diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/upload/TestFileUploadTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/upload/TestFileUploadTest.java index d0bd71c590..f5563c3e55 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/upload/TestFileUploadTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/upload/TestFileUploadTest.java @@ -15,6 +15,8 @@ */ package com.vaadin.v7.tests.components.upload; +import static org.junit.Assert.assertEquals; + import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; @@ -24,7 +26,6 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.List; -import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -59,7 +60,7 @@ public class TestFileUploadTest extends MultiBrowserTest { md5(getTempFileContents())); String actual = getLogRow(0); - Assert.assertEquals("Upload log row does not match expected", expected, + assertEquals("Upload log row does not match expected", expected, actual); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContentTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContentTest.java index 2e371c2c13..d9373993c9 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContentTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContentTest.java @@ -1,11 +1,12 @@ package com.vaadin.v7.tests.components.window; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.Keys; -import com.vaadin.testbench.elements.WindowElement; import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.testbench.elements.WindowElement; import com.vaadin.tests.tb3.MultiBrowserTest; public class UndefinedHeightSubWindowAndContentTest extends MultiBrowserTest { @@ -21,13 +22,13 @@ public class UndefinedHeightSubWindowAndContentTest extends MultiBrowserTest { WindowElement window = $(WindowElement.class).first(); int height = window.getSize().getHeight(); - Assert.assertTrue("Window height with validation failure", + assertTrue("Window height with validation failure", 161 <= height && height <= 164); textField.setValue("valid"); textField.sendKeys(Keys.ENTER); height = window.getSize().getHeight(); - Assert.assertTrue("Window height with validation success", + assertTrue("Window height with validation success", 136 <= height && height <= 139); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUITest.java b/uitest/src/test/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUITest.java index 59d09c8423..1c732ad7a3 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUITest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUITest.java @@ -1,6 +1,7 @@ package com.vaadin.v7.tests.core; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.WebElement; @@ -17,17 +18,15 @@ public class SpecialCharactersEncodingUITest extends SingleBrowserTest { openTestURL(); String textFieldValue = $(TextFieldElement.class).id("textfield") .getValue(); - Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj, - textFieldValue); + assertEquals(SpecialCharactersEncodingUI.textWithZwnj, textFieldValue); LabelElement label = $(LabelElement.class).id("label"); String labelValue = getHtml(label); // getText() strips some characters - Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj, - labelValue); + assertEquals(SpecialCharactersEncodingUI.textWithZwnj, labelValue); MenuBarElement menubar = $(MenuBarElement.class).first(); WebElement menuItem = menubar .findElement(By.className("v-menubar-menuitem-caption")); - Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj, + assertEquals(SpecialCharactersEncodingUI.textWithZwnj, getHtml(menuItem)); } |