1515 */
1616package org .springframework .data .jdbc .repository .query ;
1717
18- import static org .assertj .core .api .Assertions .*;
19-
20- import java .util .List ;
21- import java .util .Optional ;
22- import java .util .stream .Stream ;
23-
2418import org .junit .ClassRule ;
2519import org .junit .Rule ;
2620import org .junit .Test ;
3933import org .springframework .test .context .junit4 .rules .SpringMethodRule ;
4034import org .springframework .transaction .annotation .Transactional ;
4135
36+ import java .util .List ;
37+ import java .util .Optional ;
38+ import java .util .stream .Stream ;
39+
4240import static org .assertj .core .api .Assertions .*;
4341
4442/**
4543 * Tests the execution of queries from {@link Query} annotations on repository methods.
4644 *
4745 * @author Jens Schauder
46+ * @author Kazuki Shimizu
4847 */
4948@ ContextConfiguration
5049@ Transactional
5150public class QueryAnnotationHsqlIntegrationTests {
5251
53- @ Autowired DummyEntityRepository repository ;
52+ @ Autowired
53+ DummyEntityRepository repository ;
5454
55- @ ClassRule public static final SpringClassRule classRule = new SpringClassRule ();
56- @ Rule public SpringMethodRule methodRule = new SpringMethodRule ();
55+ @ ClassRule
56+ public static final SpringClassRule classRule = new SpringClassRule ();
57+ @ Rule
58+ public SpringMethodRule methodRule = new SpringMethodRule ();
5759
5860 @ Test // DATAJDBC-164
5961 public void executeCustomQueryWithoutParameter () {
@@ -65,8 +67,8 @@ public void executeCustomQueryWithoutParameter() {
6567 List <DummyEntity > entities = repository .findByNameContainingCapitalLetter ();
6668
6769 assertThat (entities ) //
68- .extracting (e -> e .name ) //
69- .containsExactlyInAnyOrder ("Example" , "EXAMPLE" );
70+ .extracting (e -> e .name ) //
71+ .containsExactlyInAnyOrder ("Example" , "EXAMPLE" );
7072
7173 }
7274
@@ -80,18 +82,17 @@ public void executeCustomQueryWithNamedParameters() {
8082 List <DummyEntity > entities = repository .findByNamedRangeWithNamedParameter ("a" , "c" );
8183
8284 assertThat (entities ) //
83- .extracting (e -> e .name ) //
84- .containsExactlyInAnyOrder ("b" );
85+ .extracting (e -> e .name ) //
86+ .containsExactlyInAnyOrder ("b" );
8587
8688 }
8789
8890 @ Test // DATAJDBC-172
8991 public void executeCustomQueryWithReturnTypeIsOptional () {
9092
91- DummyEntity dummyEntity = dummyEntity ("a" );
92- repository .save (dummyEntity );
93+ repository .save (dummyEntity ("a" ));
9394
94- Optional <DummyEntity > entity = repository .findByIdWithReturnTypeIsOptional ( dummyEntity . id );
95+ Optional <DummyEntity > entity = repository .findByNameAsOptional ( "a" );
9596
9697 assertThat (entity ).map (e -> e .name ).contains ("a" );
9798
@@ -160,8 +161,8 @@ public void executeCustomQueryWithReturnTypeIsStream() {
160161 Stream <DummyEntity > entities = repository .findAllWithReturnTypeIsStream ();
161162
162163 assertThat (entities ) //
163- .extracting (e -> e .name ) //
164- .containsExactlyInAnyOrder ("a" , "b" );
164+ .extracting (e -> e .name ) //
165+ .containsExactlyInAnyOrder ("a" , "b" );
165166
166167 }
167168
@@ -185,7 +186,8 @@ Class<?> testClass() {
185186
186187 private static class DummyEntity {
187188
188- @ Id Long id ;
189+ @ Id
190+ Long id ;
189191
190192 String name ;
191193 }
0 commit comments