summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-10-03 12:56:25 +0200
committerHenri Sara <henri.sara@gmail.com>2017-10-03 13:56:25 +0300
commitccad305464af83826de4a4bd25a383360fb356d0 (patch)
treed399448d2910c4cf373e64c690b053740dff43ba /client
parent28b52d687dade66154a4fcd545415bf0d01b0a53 (diff)
downloadvaadin-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 'client')
-rwxr-xr-xclient/src/test/java/com/vaadin/client/DateTimeServiceTest.java9
-rw-r--r--client/src/test/java/com/vaadin/client/LocatorUtilTest.java19
-rw-r--r--client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java6
-rw-r--r--client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java12
4 files changed, 25 insertions, 21 deletions
diff --git a/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java b/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java
index 1329b7fdc9..563f16c334 100755
--- a/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java
+++ b/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java
@@ -1,11 +1,12 @@
package com.vaadin.client;
+import static org.junit.Assert.assertEquals;
+
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Assert;
import org.junit.Test;
public class DateTimeServiceTest {
@@ -77,7 +78,7 @@ public class DateTimeServiceTest {
Date d = new Date(start + i * MILLISECONDS_PER_DAY);
int expected = getCalendarISOWeekNr(d);
int calculated = DateTimeService.getISOWeekNumber(d);
- Assert.assertEquals(d + " should be week " + expected, expected,
+ assertEquals(d + " should be week " + expected, expected,
calculated);
}
@@ -94,11 +95,11 @@ public class DateTimeServiceTest {
// System.out.println("Sample: " + d);
int expected = isoWeekNumbers.get(d);
int calculated = DateTimeService.getISOWeekNumber(d);
- Assert.assertEquals(
+ assertEquals(
d + " should be week " + expected
+ " (Java Calendar is wrong?)",
expected, getCalendarISOWeekNr(d));
- Assert.assertEquals(d + " should be week " + expected, expected,
+ assertEquals(d + " should be week " + expected, expected,
calculated);
}
diff --git a/client/src/test/java/com/vaadin/client/LocatorUtilTest.java b/client/src/test/java/com/vaadin/client/LocatorUtilTest.java
index 1a771c5281..3f785d6115 100644
--- a/client/src/test/java/com/vaadin/client/LocatorUtilTest.java
+++ b/client/src/test/java/com/vaadin/client/LocatorUtilTest.java
@@ -15,7 +15,8 @@
*/
package com.vaadin.client;
-import org.junit.Assert;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.client.componentlocator.LocatorUtil;
@@ -28,53 +29,53 @@ public class LocatorUtilTest {
@Test
public void testIsUI1() {
boolean isUI = LocatorUtil.isUIElement("com.vaadin.ui.UI");
- Assert.assertTrue(isUI);
+ assertTrue(isUI);
}
@Test
public void testIsUI2() {
boolean isUI = LocatorUtil.isUIElement("/com.vaadin.ui.UI");
- Assert.assertTrue(isUI);
+ assertTrue(isUI);
}
@Test
public void testIsUI3() {
boolean isUI = LocatorUtil
.isUIElement("//com.vaadin.ui.UI[RandomString");
- Assert.assertTrue(isUI);
+ assertTrue(isUI);
}
@Test
public void testIsUI4() {
boolean isUI = LocatorUtil.isUIElement("//com.vaadin.ui.UI[0]");
- Assert.assertTrue(isUI);
+ assertTrue(isUI);
}
@Test
public void testIsNotification1() {
boolean isUI = LocatorUtil
.isNotificationElement("com.vaadin.ui.VNotification");
- Assert.assertTrue(isUI);
+ assertTrue(isUI);
}
@Test
public void testIsNotification2() {
boolean isUI = LocatorUtil
.isNotificationElement("com.vaadin.ui.Notification");
- Assert.assertTrue(isUI);
+ assertTrue(isUI);
}
@Test
public void testIsNotification3() {
boolean isUI = LocatorUtil
.isNotificationElement("/com.vaadin.ui.VNotification[");
- Assert.assertTrue(isUI);
+ assertTrue(isUI);
}
@Test
public void testIsNotification4() {
boolean isUI = LocatorUtil
.isNotificationElement("//com.vaadin.ui.VNotification[0]");
- Assert.assertTrue(isUI);
+ assertTrue(isUI);
}
}
diff --git a/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java b/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java
index 2594b3d09d..79d278acd1 100644
--- a/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java
+++ b/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java
@@ -441,10 +441,10 @@ public class VBrowserDetailsUserAgentParserTest {
@Test
public void checkFFsupportedVersions() {
VBrowserDetails details = new VBrowserDetails(FIREFOX_40B11_WIN);
- Assert.assertTrue(details.isTooOldToFunctionProperly());
+ assertTrue(details.isTooOldToFunctionProperly());
details = new VBrowserDetails(FIREFOX_SUPPORTED);
- Assert.assertFalse(details.isTooOldToFunctionProperly());
+ assertFalse(details.isTooOldToFunctionProperly());
}
/*
@@ -634,7 +634,7 @@ public class VBrowserDetailsUserAgentParserTest {
assertFalse(browserDetails.isIOS());
assertFalse(browserDetails.isAndroid());
assertFalse(browserDetails.isChromeOS());
- Assert.assertEquals(isWindowsPhone, browserDetails.isWindowsPhone());
+ assertEquals(isWindowsPhone, browserDetails.isWindowsPhone());
}
private void assertLinux(VBrowserDetails browserDetails) {
diff --git a/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java b/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java
index ee39492bbf..278bc67414 100644
--- a/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java
+++ b/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java
@@ -15,7 +15,9 @@
*/
package com.vaadin.client.communication;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
import org.junit.Test;
/**
@@ -28,7 +30,7 @@ public class ServerMessageHandlerTest {
@Test
public void unwrapValidJson() {
String payload = "{'foo': 'bar'}";
- Assert.assertEquals(payload,
+ assertEquals(payload,
MessageHandler.stripJSONWrapping("for(;;);[" + payload + "]"));
}
@@ -36,19 +38,19 @@ public class ServerMessageHandlerTest {
@Test
public void unwrapUnwrappedJson() {
String payload = "{'foo': 'bar'}";
- Assert.assertNull(MessageHandler.stripJSONWrapping(payload));
+ assertNull(MessageHandler.stripJSONWrapping(payload));
}
@Test
public void unwrapNull() {
- Assert.assertNull(MessageHandler.stripJSONWrapping(null));
+ assertNull(MessageHandler.stripJSONWrapping(null));
}
@Test
public void unwrapEmpty() {
- Assert.assertNull(MessageHandler.stripJSONWrapping(""));
+ assertNull(MessageHandler.stripJSONWrapping(""));
}
}