File tree 3 files changed +18
-12
lines changed
spring-test/src/main/java/org/springframework/test/web/servlet/assertj
3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 18
18
19
19
import org .springframework .http .converter .GenericHttpMessageConverter ;
20
20
import org .springframework .lang .Nullable ;
21
- import org .springframework .mock .web .MockHttpServletRequest ;
22
- import org .springframework .mock .web .MockHttpServletResponse ;
23
21
import org .springframework .test .web .servlet .MvcResult ;
24
22
25
23
/**
@@ -64,14 +62,6 @@ public Exception getUnresolvedException() {
64
62
return this .unresolvedException ;
65
63
}
66
64
67
- public MockHttpServletRequest getRequest () {
68
- return getMvcResult ().getRequest ();
69
- }
70
-
71
- public MockHttpServletResponse getResponse () {
72
- return getMvcResult ().getResponse ();
73
- }
74
-
75
65
@ Nullable
76
66
public Exception getResolvedException () {
77
67
return getMvcResult ().getResolvedException ();
Original file line number Diff line number Diff line change 19
19
import org .assertj .core .api .AssertProvider ;
20
20
21
21
import org .springframework .lang .Nullable ;
22
+ import org .springframework .mock .web .MockHttpServletRequest ;
23
+ import org .springframework .mock .web .MockHttpServletResponse ;
22
24
import org .springframework .test .web .servlet .MvcResult ;
23
25
24
26
/**
@@ -53,6 +55,21 @@ public interface MvcTestResult extends AssertProvider<MvcTestResultAssert> {
53
55
*/
54
56
MvcResult getMvcResult ();
55
57
58
+ /**
59
+ * Return the performed {@linkplain MockHttpServletRequest request}.
60
+ */
61
+ default MockHttpServletRequest getRequest () {
62
+ return getMvcResult ().getRequest ();
63
+ }
64
+
65
+ /**
66
+ * Return the resulting {@linkplain MockHttpServletResponse response}.
67
+ */
68
+ default MockHttpServletResponse getResponse () {
69
+ return getMvcResult ().getResponse ();
70
+ }
71
+
72
+
56
73
/**
57
74
* Return the exception that was thrown unexpectedly while processing the
58
75
* request, if any.
Original file line number Diff line number Diff line change @@ -55,8 +55,7 @@ public class MvcTestResultAssert extends AbstractMockHttpServletResponseAssert<M
55
55
56
56
@ Override
57
57
protected MockHttpServletResponse getResponse () {
58
- getMvcResult ();
59
- return this .actual .getMvcResult ().getResponse ();
58
+ return getMvcResult ().getResponse ();
60
59
}
61
60
62
61
/**
You can’t perform that action at this time.
0 commit comments