Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

VaadinServletTest.java 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2000-2014 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.server;
  17. import org.junit.Assert;
  18. import org.junit.Test;
  19. public class VaadinServletTest {
  20. @Test
  21. public void testGetLastPathParameter() {
  22. Assert.assertEquals("",
  23. VaadinServlet.getLastPathParameter("http://myhost.com"));
  24. Assert.assertEquals(";a",
  25. VaadinServlet.getLastPathParameter("http://myhost.com;a"));
  26. Assert.assertEquals("",
  27. VaadinServlet.getLastPathParameter("http://myhost.com/hello"));
  28. Assert.assertEquals(";b=c", VaadinServlet
  29. .getLastPathParameter("http://myhost.com/hello;b=c"));
  30. Assert.assertEquals("",
  31. VaadinServlet.getLastPathParameter("http://myhost.com/hello/"));
  32. Assert.assertEquals("", VaadinServlet
  33. .getLastPathParameter("http://myhost.com/hello;a/"));
  34. Assert.assertEquals("", VaadinServlet
  35. .getLastPathParameter("http://myhost.com/hello;a=1/"));
  36. Assert.assertEquals(";b", VaadinServlet
  37. .getLastPathParameter("http://myhost.com/hello/;b"));
  38. Assert.assertEquals(";b=1", VaadinServlet
  39. .getLastPathParameter("http://myhost.com/hello/;b=1"));
  40. Assert.assertEquals(";b=1,c=2", VaadinServlet
  41. .getLastPathParameter("http://myhost.com/hello/;b=1,c=2"));
  42. Assert.assertEquals("", VaadinServlet
  43. .getLastPathParameter("http://myhost.com/hello/;b=1,c=2/"));
  44. Assert.assertEquals("", VaadinServlet
  45. .getLastPathParameter("http://myhost.com/a;hello/;a/"));
  46. Assert.assertEquals("", VaadinServlet
  47. .getLastPathParameter("http://myhost.com/a;hello/;a=1/"));
  48. Assert.assertEquals(";b", VaadinServlet
  49. .getLastPathParameter("http://myhost.com/a;hello/;b"));
  50. Assert.assertEquals(";b=1", VaadinServlet
  51. .getLastPathParameter("http://myhost.com/a;hello/;b=1"));
  52. Assert.assertEquals(";b=1,c=2", VaadinServlet
  53. .getLastPathParameter("http://myhost.com/a;hello/;b=1,c=2"));
  54. Assert.assertEquals("", VaadinServlet
  55. .getLastPathParameter("http://myhost.com/a;hello/;b=1,c=2/"));
  56. }
  57. }