summaryrefslogtreecommitdiffstats
path: root/server/tests/src/com/vaadin
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 /server/tests/src/com/vaadin
parent94d33ad7c732f620c9e98502b896a65852479b7d (diff)
downloadvaadin-framework-49973354b22e8aba9cc71f83571020b0414c54e0.tar.gz
vaadin-framework-49973354b22e8aba9cc71f83571020b0414c54e0.zip
Fixed trailing slash trimming in VaadinPortletService.
Change-Id: Ia9f6230219adfb1fcb29b88ad819e3209770e1fc
Diffstat (limited to 'server/tests/src/com/vaadin')
-rw-r--r--server/tests/src/com/vaadin/server/VaadinPortletServiceTests.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/server/VaadinPortletServiceTests.java b/server/tests/src/com/vaadin/server/VaadinPortletServiceTests.java
new file mode 100644
index 0000000000..c54a6dddce
--- /dev/null
+++ b/server/tests/src/com/vaadin/server/VaadinPortletServiceTests.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.server;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class VaadinPortletServiceTests {
+
+ private VaadinPortletService sut;
+ private VaadinPortletRequest request;
+
+ @Before
+ public void setup() throws ServiceException {
+ VaadinPortlet portlet = mock(VaadinPortlet.class);
+ DeploymentConfiguration conf = mock(DeploymentConfiguration.class);
+
+ sut = new VaadinPortletService(portlet, conf);
+
+ request = mock(VaadinPortletRequest.class);
+ }
+
+ private void mockRequestToReturnLocation(String location) {
+ when(request.getPortalProperty(
+ Constants.PORTAL_PARAMETER_VAADIN_RESOURCE_PATH))
+ .thenReturn(location);
+ }
+
+ @Test
+ public void trailingSlashesAreTrimmedFromStaticFileLocation()
+ throws ServiceException {
+
+ mockRequestToReturnLocation("/content////");
+
+ String staticFileLocation = sut
+ .getStaticFileLocation(request);
+
+ assertThat(staticFileLocation, is("/content"));
+ }
+}