Polish WebJarsResourceResolver

Follow up to accb8519fd - same fix when resolving missing resources or
resolving a public URL for these resources.
This commit is contained in:
Brian Clozel
2015-07-27 15:06:51 +02:00
parent 0b0a5a9ed4
commit 0e2e6cf045
2 changed files with 16 additions and 2 deletions

View File

@@ -99,7 +99,7 @@ public class WebJarsResourceResolverTests {
}
@Test
public void resolverUrlWebJarResourceNotFound() {
public void resolveUrlWebJarResourceNotFound() {
String file = "/something/something.js";
given(this.chain.resolveUrlPath(file, this.locations)).willReturn(null);
@@ -123,6 +123,18 @@ public class WebJarsResourceResolverTests {
verify(this.chain, times(1)).resolveResource(this.request, file, this.locations);
}
@Test
public void resolveResourceNotFound() {
String file = "/something/something.js";
given(this.chain.resolveUrlPath(file, this.locations)).willReturn(null);
Resource actual = this.resolver.resolveResource(this.request, file, this.locations, this.chain);
assertNull(actual);
verify(this.chain, times(1)).resolveResource(this.request, file, this.locations);
verify(this.chain, never()).resolveResource(this.request, null, this.locations);
}
@Test
public void resolveResourceWebJar() {
Resource expected = mock(Resource.class);