Skip to content

Commit c2eafdb

Browse files
committed
AbstractCachingViewResolver caches unresolved view names by default ("cacheUnresolved"=true; SPR-8173)
1 parent 1bb6d29 commit c2eafdb

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/view/ViewResolverTests.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2011 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.
@@ -16,18 +16,11 @@
1616

1717
package org.springframework.web.servlet.view;
1818

19-
import static org.junit.Assert.assertEquals;
20-
import static org.junit.Assert.assertNull;
21-
import static org.junit.Assert.assertSame;
22-
import static org.junit.Assert.assertTrue;
23-
import static org.junit.Assert.fail;
24-
2519
import java.util.HashMap;
2620
import java.util.Locale;
2721
import java.util.Map;
2822
import java.util.Properties;
2923
import java.util.concurrent.atomic.AtomicInteger;
30-
3124
import javax.servlet.RequestDispatcher;
3225
import javax.servlet.ServletContext;
3326
import javax.servlet.ServletException;
@@ -39,6 +32,7 @@
3932
import javax.servlet.jsp.jstl.fmt.LocalizationContext;
4033

4134
import org.junit.Test;
35+
4236
import org.springframework.beans.MutablePropertyValues;
4337
import org.springframework.beans.PropertyValue;
4438
import org.springframework.beans.TestBean;
@@ -59,6 +53,8 @@
5953
import org.springframework.web.servlet.support.RequestContext;
6054
import org.springframework.web.servlet.theme.FixedThemeResolver;
6155

56+
import static org.junit.Assert.*;
57+
6258
/**
6359
* @author Juergen Hoeller
6460
* @author Chris Beams
@@ -499,7 +495,7 @@ public void testCacheRemoval() throws Exception {
499495
vr.removeFromCache("example1", Locale.getDefault());
500496
cached = vr.resolveViewName("example1", Locale.getDefault());
501497
if (view == cached) {
502-
// the chance of having the same reference (hashCode) twice if negligable).
498+
// the chance of having the same reference (hashCode) twice if negligible).
503499
fail("View wasn't removed from cache");
504500
}
505501
}
@@ -526,10 +522,14 @@ protected View loadView(String viewName, Locale locale) throws Exception {
526522

527523
viewResolver.resolveViewName("view", Locale.getDefault());
528524
viewResolver.resolveViewName("view", Locale.getDefault());
529-
530-
assertEquals(2, count.intValue());
525+
viewResolver.resolveViewName("view", Locale.getDefault());
526+
viewResolver.resolveViewName("view", Locale.getDefault());
527+
viewResolver.resolveViewName("view", Locale.getDefault());
528+
529+
assertEquals(3, count.intValue());
531530
}
532531

532+
533533
public static class TestView extends InternalResourceView {
534534

535535
public void setLocation(Resource location) {

0 commit comments

Comments
 (0)