Browse Source

Fix broken test in MvcNamespaceTests

The testDefaultConfig() method in MvcNamespaceTests creates a new Date()
in its test fixture but then performs an assertion against a hard coded
data string of "2013-10-21". This test therefore only passed yesterday,
on October 21, 2013.

This commit addresses this by changing the hard coded date string to one
based on the current date.

Issue: SPR-10665, SPR-8826
pull/377/head
Sam Brannen 13 years ago
parent
commit
6b0a62569b
  1. 6
      spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java

6
spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java

@ -19,6 +19,8 @@ package org.springframework.web.servlet.config; @@ -19,6 +19,8 @@ package org.springframework.web.servlet.config;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Method;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@ -161,8 +163,8 @@ public class MvcNamespaceTests { @@ -161,8 +163,8 @@ public class MvcNamespaceTests {
testController.testBind(now, null, null);
MvcUrls mvcUrls = this.appContext.getBean(MvcUrls.class);
UriComponents uriComponents = mvcUrls.linkToMethodOn(testController);
assertEquals("http://localhost/?date=2013-10-21", uriComponents.toUriString());
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
assertEquals("http://localhost/?date=" + dateFormat.format(now), uriComponents.toUriString());
}
finally {
RequestContextHolder.resetRequestAttributes();

Loading…
Cancel
Save