Polishing

This commit is contained in:
Sam Brannen 2015-10-08 15:18:21 +02:00
parent 01986ac73d
commit f489e43d31
1 changed files with 11 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,7 +18,6 @@ package org.springframework.web.util;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import org.junit.Before;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
@ -27,23 +26,20 @@ import org.springframework.mock.web.test.MockHttpServletRequest;
import static org.junit.Assert.*; import static org.junit.Assert.*;
/** /**
* Unit tests for {@link UrlPathHelper}.
*
* @author Rob Harrop * @author Rob Harrop
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Costin Leau * @author Costin Leau
*/ */
public class UrlPathHelperTests { public class UrlPathHelperTests {
private UrlPathHelper helper;
private MockHttpServletRequest request;
private static final String WEBSPHERE_URI_ATTRIBUTE = "com.ibm.websphere.servlet.uri_non_decoded"; private static final String WEBSPHERE_URI_ATTRIBUTE = "com.ibm.websphere.servlet.uri_non_decoded";
@Before private final UrlPathHelper helper = new UrlPathHelper();
public void setUp() {
helper = new UrlPathHelper(); private final MockHttpServletRequest request = new MockHttpServletRequest();
request = new MockHttpServletRequest();
}
@Test @Test
public void getPathWithinApplication() { public void getPathWithinApplication() {
@ -112,7 +108,6 @@ public class UrlPathHelperTests {
request.setRequestURI("/foo+bar"); request.setRequestURI("/foo+bar");
assertEquals("Incorrect path returned", "/foo+bar", helper.getRequestUri(request)); assertEquals("Incorrect path returned", "/foo+bar", helper.getRequestUri(request));
} }
@Test @Test
@ -354,7 +349,8 @@ public class UrlPathHelperTests {
} }
// test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo // test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
@Test @Ignore @Ignore
@Test
public void wasCasualServletRootWithMissingSlash() throws Exception { public void wasCasualServletRootWithMissingSlash() throws Exception {
request.setContextPath("/test"); request.setContextPath("/test");
request.setPathInfo(null); request.setPathInfo(null);
@ -365,7 +361,8 @@ public class UrlPathHelperTests {
assertEquals("/", helper.getLookupPathForRequest(request)); assertEquals("/", helper.getLookupPathForRequest(request));
} }
@Test @Ignore @Ignore
@Test
public void wasCasualServletRootWithMissingSlashWithCompliantSetting() throws Exception { public void wasCasualServletRootWithMissingSlashWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo"); request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo");
tomcatCasualServletRootWithMissingSlash(); tomcatCasualServletRootWithMissingSlash();