summaryrefslogtreecommitdiffstats
path: root/shared/src/test/java/com
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-10-12 21:59:08 +0300
committerPekka Hyvönen <pekka@vaadin.com>2016-12-09 09:39:00 +0200
commit76447b941ac64d5f1ad7bbf12555c3b73db23285 (patch)
tree555168174da9ce25fd05a1968bc35eb48452b987 /shared/src/test/java/com
parentc94312a0f8a2c4afc019da16092eabad92ab7f2b (diff)
downloadvaadin-framework-76447b941ac64d5f1ad7bbf12555c3b73db23285.tar.gz
vaadin-framework-76447b941ac64d5f1ad7bbf12555c3b73db23285.zip
Check for duplicate property ids when setting Grid columns or column order (#20386)
Change-Id: I76be83642f0e56e55b0c0e502ac6769de1ee8af0
Diffstat (limited to 'shared/src/test/java/com')
-rw-r--r--shared/src/test/java/com/vaadin/shared/util/SharedUtilTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/shared/src/test/java/com/vaadin/shared/util/SharedUtilTest.java b/shared/src/test/java/com/vaadin/shared/util/SharedUtilTest.java
index 081f594a97..6d8cab4fea 100644
--- a/shared/src/test/java/com/vaadin/shared/util/SharedUtilTest.java
+++ b/shared/src/test/java/com/vaadin/shared/util/SharedUtilTest.java
@@ -118,4 +118,36 @@ public class SharedUtilTest {
}
}
+ @Test
+ public void duplicatesInArray() {
+ Assert.assertTrue(
+ SharedUtil.containsDuplicates(new Object[] { "a", "a" }));
+ Assert.assertTrue(
+ SharedUtil.containsDuplicates(new Object[] { "a", "b", "a" }));
+ Assert.assertTrue(SharedUtil
+ .containsDuplicates(new Object[] { "a", "b", "a", "b" }));
+ Assert.assertTrue(
+ SharedUtil.containsDuplicates(new Object[] { 1, "b", 1 }));
+
+ Assert.assertFalse(SharedUtil.containsDuplicates(new Object[] {}));
+ Assert.assertFalse(SharedUtil.containsDuplicates(new Object[] { "a" }));
+ Assert.assertFalse(
+ SharedUtil.containsDuplicates(new Object[] { "a", "b" }));
+ Assert.assertFalse(
+ SharedUtil.containsDuplicates(new Object[] { "1", 1 }));
+ }
+
+ @Test
+ public void getDuplicates() {
+ Assert.assertEquals("", SharedUtil.getDuplicates(new Object[] { "a" }));
+ Assert.assertEquals("a",
+ SharedUtil.getDuplicates(new Object[] { "a", "a" }));
+ Assert.assertEquals("a, b",
+ SharedUtil.getDuplicates(new Object[] { "a", "b", "a", "b" }));
+ Assert.assertEquals("a, b, c", SharedUtil
+ .getDuplicates(new Object[] { "c", "a", "b", "a", "b", "c" }));
+ Assert.assertEquals("1.2",
+ SharedUtil.getDuplicates(new Object[] { 1.2, "a", 1.2 }));
+ }
+
}