File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
integration-tests/src/test/java/org/springframework/aot/test
spring-test/src/test/java/org/springframework/test/web/client/samples Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -33,22 +33,17 @@ class ReflectionInvocationsTests {
33
33
void sampleTest () {
34
34
RuntimeHints hints = new RuntimeHints ();
35
35
hints .reflection ().registerType (String .class );
36
-
37
- RuntimeHintsInvocations invocations = org .springframework .aot .test .agent .RuntimeHintsRecorder .record (() -> {
38
- new SampleReflection ().sample (); // does Method[] methods = String.class.getMethods();
39
- });
40
- assertThat (invocations ).match (hints );
36
+ // does Method[] methods = String.class.getMethods();
37
+ assertThat (org .springframework .aot .test .agent .RuntimeHintsRecorder .record (new SampleReflection ()::sample )).match (hints );
41
38
}
42
39
43
40
@ Test
44
41
void multipleCallsTest () {
45
42
RuntimeHints hints = new RuntimeHints ();
46
43
hints .reflection ().registerType (String .class );
47
44
hints .reflection ().registerType (Integer .class );
48
- RuntimeHintsInvocations invocations = org .springframework .aot .test .agent .RuntimeHintsRecorder .record (() -> {
49
- new SampleReflection ().multipleCalls (); // does Method[] methods = String.class.getMethods(); methods = Integer.class.getMethods();
50
- });
51
- assertThat (invocations ).match (hints );
45
+ // does String.class.getMethods(); Integer.class.getMethods();
46
+ assertThat (org .springframework .aot .test .agent .RuntimeHintsRecorder .record (new SampleReflection ()::multipleCalls )).match (hints );
52
47
}
53
48
54
49
}
Original file line number Diff line number Diff line change @@ -67,14 +67,17 @@ public void setup() {
67
67
@ Test
68
68
public void performGet () {
69
69
70
- String responseBody = "{\" name\" : \" Ludwig van Beethoven\" , \" someDouble\" : \" 1.6035\" }" ;
70
+ String responseBody = """
71
+ {"name" : "Ludwig van Beethoven", "someDouble" : "1.6035"}""" ;
71
72
72
73
this .mockServer .expect (requestTo ("/composers/42" )).andExpect (method (HttpMethod .GET ))
73
74
.andRespond (withSuccess (responseBody , MediaType .APPLICATION_JSON ));
74
75
75
- @ SuppressWarnings ("unused" )
76
76
Person ludwig = this .restTemplate .getForObject ("/composers/{id}" , Person .class , 42 );
77
77
78
+ assertThat (ludwig .getName ()).isEqualTo ("Ludwig van Beethoven" );
79
+ assertThat (ludwig .getSomeDouble ()).isEqualTo (1.6035 );
80
+
78
81
// We are only validating the request. The response is mocked out.
79
82
// hotel.getId() == 42
80
83
// hotel.getName().equals("Holiday Inn")
You can’t perform that action at this time.
0 commit comments