summaryrefslogtreecommitdiffstats
path: root/shared/tests
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-05-27 22:03:26 +0300
committerVaadin Code Review <review@vaadin.com>2015-05-29 13:33:47 +0000
commited5ad86b114ccb4d6ab08e19a734bdb8b3342399 (patch)
treefa6bfdda2d616589acc2205ad3da84e9f513a691 /shared/tests
parent4a79c3c5c5cf14dde6f696a0fe924227d00a0ec5 (diff)
downloadvaadin-framework-ed5ad86b114ccb4d6ab08e19a734bdb8b3342399.tar.gz
vaadin-framework-ed5ad86b114ccb4d6ab08e19a734bdb8b3342399.zip
Ensure method and property names are capitalized using English locale (#13389)
Change-Id: Idde4fc54950f2bb83e0bb8d36a84a5bf075eb8de
Diffstat (limited to 'shared/tests')
-rw-r--r--shared/tests/src/com/vaadin/shared/util/SharedUtilTests.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/shared/tests/src/com/vaadin/shared/util/SharedUtilTests.java b/shared/tests/src/com/vaadin/shared/util/SharedUtilTests.java
index 208d4ca7c7..e77501a446 100644
--- a/shared/tests/src/com/vaadin/shared/util/SharedUtilTests.java
+++ b/shared/tests/src/com/vaadin/shared/util/SharedUtilTests.java
@@ -3,6 +3,8 @@ package com.vaadin.shared.util;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import java.util.Locale;
+
import org.junit.Assert;
import org.junit.Test;
@@ -76,4 +78,44 @@ public class SharedUtilTests {
String[] splitParts = SharedUtil.splitCamelCase(camelCaseString);
Assert.assertArrayEquals(parts, splitParts);
}
+
+ @Test
+ public void join() {
+ String s1 = "foo-bar-baz";
+ String s2 = "foo--bar";
+
+ Assert.assertEquals("foobarbaz", SharedUtil.join(s1.split("-"), ""));
+ Assert.assertEquals("foo!bar!baz", SharedUtil.join(s1.split("-"), "!"));
+ Assert.assertEquals("foo!!bar!!baz",
+ SharedUtil.join(s1.split("-"), "!!"));
+
+ Assert.assertEquals("foo##bar", SharedUtil.join(s2.split("-"), "#"));
+ }
+
+ @Test
+ public void dashSeparatedToCamelCase() {
+ Assert.assertEquals(null, SharedUtil.dashSeparatedToCamelCase(null));
+ Assert.assertEquals("", SharedUtil.dashSeparatedToCamelCase(""));
+ Assert.assertEquals("foo", SharedUtil.dashSeparatedToCamelCase("foo"));
+ Assert.assertEquals("fooBar",
+ SharedUtil.dashSeparatedToCamelCase("foo-bar"));
+ Assert.assertEquals("fooBar",
+ SharedUtil.dashSeparatedToCamelCase("foo--bar"));
+ Assert.assertEquals("fooBarBaz",
+ SharedUtil.dashSeparatedToCamelCase("foo-bar-baz"));
+ Assert.assertEquals("fooBarBaz",
+ SharedUtil.dashSeparatedToCamelCase("foo-Bar-Baz"));
+ }
+
+ @Test
+ public void methodUppercaseWithTurkishLocale() {
+ Locale defaultLocale = Locale.getDefault();
+ try {
+ Locale.setDefault(new Locale("tr", "TR"));
+ Assert.assertEquals("Integer", SharedUtil.capitalize("integer"));
+ } finally {
+ Locale.setDefault(defaultLocale);
+ }
+ }
+
}