Skip to content

Commit ffcb609

Browse files
author
Vincent Potucek
committed
wip
1 parent 806f978 commit ffcb609

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

integration-tests/src/test/java/org/springframework/aot/test/ReflectionInvocationsTests.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,17 @@ class ReflectionInvocationsTests {
3333
void sampleTest() {
3434
RuntimeHints hints = new RuntimeHints();
3535
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);
4138
}
4239

4340
@Test
4441
void multipleCallsTest() {
4542
RuntimeHints hints = new RuntimeHints();
4643
hints.reflection().registerType(String.class);
4744
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);
5247
}
5348

5449
}

spring-test/src/test/java/org/springframework/test/web/client/samples/SampleTests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,17 @@ public void setup() {
6767
@Test
6868
public void performGet() {
6969

70-
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
70+
String responseBody = """
71+
{"name" : "Ludwig van Beethoven", "someDouble" : "1.6035"}""";
7172

7273
this.mockServer.expect(requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
7374
.andRespond(withSuccess(responseBody, MediaType.APPLICATION_JSON));
7475

75-
@SuppressWarnings("unused")
7676
Person ludwig = this.restTemplate.getForObject("/composers/{id}", Person.class, 42);
7777

78+
assertThat(ludwig.getName()).isEqualTo("Ludwig van Beethoven");
79+
assertThat(ludwig.getSomeDouble()).isEqualTo(1.6035);
80+
7881
// We are only validating the request. The response is mocked out.
7982
// hotel.getId() == 42
8083
// hotel.getName().equals("Holiday Inn")

0 commit comments

Comments
 (0)