11/*
2- * Copyright 2002-2014 the original author or authors.
2+ * Copyright 2002-2015 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1818
1919import java .io .UnsupportedEncodingException ;
2020
21- import org .junit .Before ;
2221import org .junit .Ignore ;
2322import org .junit .Test ;
2423
2726import static org .junit .Assert .*;
2827
2928/**
29+ * Unit tests for {@link UrlPathHelper}.
30+ *
3031 * @author Rob Harrop
3132 * @author Juergen Hoeller
3233 * @author Costin Leau
3334 */
3435public class UrlPathHelperTests {
3536
36- private UrlPathHelper helper ;
37+ private static final String WEBSPHERE_URI_ATTRIBUTE = "com.ibm.websphere.servlet.uri_non_decoded" ;
3738
38- private MockHttpServletRequest request ;
39+ private final UrlPathHelper helper = new UrlPathHelper () ;
3940
40- private static final String WEBSPHERE_URI_ATTRIBUTE = "com.ibm.websphere.servlet.uri_non_decoded" ;
41+ private final MockHttpServletRequest request = new MockHttpServletRequest () ;
4142
42- @ Before
43- public void setUp () {
44- helper = new UrlPathHelper ();
45- request = new MockHttpServletRequest ();
46- }
4743
4844 @ Test
4945 public void getPathWithinApplication () {
@@ -112,7 +108,6 @@ public void getRequestUri() {
112108
113109 request .setRequestURI ("/foo+bar" );
114110 assertEquals ("Incorrect path returned" , "/foo+bar" , helper .getRequestUri (request ));
115-
116111 }
117112
118113 @ Test
@@ -354,7 +349,8 @@ public void wasCasualServletRootWithCompliantSetting() throws Exception {
354349 }
355350
356351 // test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
357- @ Test @ Ignore
352+ @ Ignore
353+ @ Test
358354 public void wasCasualServletRootWithMissingSlash () throws Exception {
359355 request .setContextPath ("/test" );
360356 request .setPathInfo (null );
@@ -365,7 +361,8 @@ public void wasCasualServletRootWithMissingSlash() throws Exception {
365361 assertEquals ("/" , helper .getLookupPathForRequest (request ));
366362 }
367363
368- @ Test @ Ignore
364+ @ Ignore
365+ @ Test
369366 public void wasCasualServletRootWithMissingSlashWithCompliantSetting () throws Exception {
370367 request .setAttribute (WEBSPHERE_URI_ATTRIBUTE , "/test/foo" );
371368 tomcatCasualServletRootWithMissingSlash ();
0 commit comments