16
16
17
17
package org .springframework .web .servlet .resource ;
18
18
19
- import static org .junit .Assert .*;
20
- import static org .mockito .BDDMockito .*;
21
- import static org .mockito .Mockito .mock ;
22
- import static org .mockito .Mockito .never ;
23
- import static org .mockito .Mockito .times ;
24
- import static org .mockito .Mockito .verify ;
25
-
26
19
import java .util .Collections ;
27
20
import java .util .List ;
28
-
29
21
import javax .servlet .http .HttpServletRequest ;
30
22
31
23
import org .junit .Before ;
35
27
import org .springframework .core .io .Resource ;
36
28
import org .springframework .mock .web .test .MockHttpServletRequest ;
37
29
30
+ import static org .junit .Assert .*;
31
+ import static org .mockito .BDDMockito .*;
32
+ import static org .mockito .Mockito .mock ;
33
+ import static org .mockito .Mockito .never ;
34
+ import static org .mockito .Mockito .times ;
35
+ import static org .mockito .Mockito .verify ;
36
+
38
37
/**
39
38
* Unit tests for
40
39
* {@link org.springframework.web.servlet.resource.WebJarsResourceResolver}.
@@ -51,6 +50,7 @@ public class WebJarsResourceResolverTests {
51
50
52
51
private HttpServletRequest request = new MockHttpServletRequest ();
53
52
53
+
54
54
@ Before
55
55
public void setup () {
56
56
// for this to work, an actual WebJar must be on the test classpath
@@ -59,6 +59,7 @@ public void setup() {
59
59
this .chain = mock (ResourceResolverChain .class );
60
60
}
61
61
62
+
62
63
@ Test
63
64
public void resolveUrlExisting () {
64
65
this .locations = Collections .singletonList (new ClassPathResource ("/META-INF/resources/webjars/" , getClass ()));
@@ -87,7 +88,7 @@ public void resolveUrlExistingNotInJarFile() {
87
88
@ Test
88
89
public void resolveUrlWebJarResource () {
89
90
String file = "/underscorejs/underscore.js" ;
90
- String expected = "/underscorejs/1.8.2 /underscore.js" ;
91
+ String expected = "/underscorejs/1.8.3 /underscore.js" ;
91
92
given (this .chain .resolveUrlPath (file , this .locations )).willReturn (null );
92
93
given (this .chain .resolveUrlPath (expected , this .locations )).willReturn (expected );
93
94
@@ -139,7 +140,7 @@ public void resolveResourceNotFound() {
139
140
public void resolveResourceWebJar () {
140
141
Resource expected = mock (Resource .class );
141
142
String file = "/underscorejs/underscore.js" ;
142
- String expectedPath = "/underscorejs/1.8.2 /underscore.js" ;
143
+ String expectedPath = "/underscorejs/1.8.3 /underscore.js" ;
143
144
this .locations = Collections .singletonList (new ClassPathResource ("/META-INF/resources/webjars/" , getClass ()));
144
145
given (this .chain .resolveResource (this .request , expectedPath , this .locations )).willReturn (expected );
145
146
0 commit comments