summaryrefslogtreecommitdiffstats
path: root/shared/tests/src
diff options
context:
space:
mode:
authorSauli Tähkäpää <sauli@vaadin.com>2014-03-13 08:52:37 +0200
committerSauli Tähkäpää <sauli@vaadin.com>2014-03-13 09:11:31 +0200
commit49973354b22e8aba9cc71f83571020b0414c54e0 (patch)
treeab10e93151f12830b5f12382cfc03651c907f3fc /shared/tests/src
parent94d33ad7c732f620c9e98502b896a65852479b7d (diff)
downloadvaadin-framework-49973354b22e8aba9cc71f83571020b0414c54e0.tar.gz
vaadin-framework-49973354b22e8aba9cc71f83571020b0414c54e0.zip
Fixed trailing slash trimming in VaadinPortletService.
Change-Id: Ia9f6230219adfb1fcb29b88ad819e3209770e1fc
Diffstat (limited to 'shared/tests/src')
-rw-r--r--shared/tests/src/com/vaadin/shared/util/SharedUtilTests.java43
1 files changed, 43 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
new file mode 100644
index 0000000000..b593032bd6
--- /dev/null
+++ b/shared/tests/src/com/vaadin/shared/util/SharedUtilTests.java
@@ -0,0 +1,43 @@
+package com.vaadin.shared.util;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class SharedUtilTests {
+
+ private SharedUtil sut;
+
+ @Before
+ public void setup() {
+ sut = new SharedUtil();
+ }
+
+ @Test
+ public void trailingSlashIsTrimmed() {
+ assertThat(sut.trimTrailingSlashes("/path/"), is("/path"));
+ }
+
+ @Test
+ public void noTrailingSlashForTrimming() {
+ assertThat(sut.trimTrailingSlashes("/path"), is("/path"));
+ }
+
+ @Test
+ public void trailingSlashesAreTrimmed() {
+ assertThat(sut.trimTrailingSlashes("/path///"), is("/path"));
+ }
+
+ @Test
+ public void emptyStringIsHandled() {
+ assertThat(sut.trimTrailingSlashes(""), is(""));
+ }
+
+ @Test
+ public void rootSlashIsTrimmed() {
+ assertThat(sut.trimTrailingSlashes("/"), is(""));
+ }
+
+}