4646import org .junit .jupiter .api .Disabled ;
4747import org .junit .jupiter .api .Test ;
4848import org .junit .jupiter .api .extension .ExtendWith ;
49-
5049import org .springframework .beans .factory .annotation .Autowired ;
5150import org .springframework .dao .DataAccessException ;
5251import org .springframework .dao .DataIntegrityViolationException ;
6059import org .springframework .data .domain .Pageable ;
6160import org .springframework .data .domain .Slice ;
6261import org .springframework .data .domain .Sort ;
62+ import org .springframework .data .domain .ExampleMatcher .*;
6363import org .springframework .data .domain .Sort .Direction ;
6464import org .springframework .data .domain .Sort .Order ;
65- import org .springframework .data .domain .ExampleMatcher .*;
6665import org .springframework .data .jpa .domain .Specification ;
6766import org .springframework .data .jpa .domain .sample .Address ;
6867import org .springframework .data .jpa .domain .sample .Role ;
6968import org .springframework .data .jpa .domain .sample .SpecialUser ;
7069import org .springframework .data .jpa .domain .sample .User ;
71- import org .springframework .data .jpa .repository .sample .SampleEvaluationContextExtension .SampleSecurityContextHolder ;
7270import org .springframework .data .jpa .repository .sample .UserRepository ;
71+ import org .springframework .data .jpa .repository .sample .SampleEvaluationContextExtension .SampleSecurityContextHolder ;
7372import org .springframework .data .jpa .repository .sample .UserRepository .NameOnly ;
7473import org .springframework .test .context .ContextConfiguration ;
7574import org .springframework .test .context .junit .jupiter .SpringExtension ;
@@ -152,8 +151,8 @@ void findsAllByGivenIds() {
152151
153152flushTestUsers ();
154153
155- assertThat (repository .findAllById (asList (firstUser .getId (), secondUser .getId ()))). contains ( firstUser ,
156- secondUser );
154+ assertThat (repository .findAllById (asList (firstUser .getId (), secondUser .getId ()))) //
155+ . containsExactlyInAnyOrder ( firstUser , secondUser );
157156}
158157
159158@ Test
@@ -167,23 +166,23 @@ void testReadByIdReturnsNullForNotFoundEntities() {
167166@ Test
168167void savesCollectionCorrectly () throws Exception {
169168
170- assertThat (repository .saveAll (asList (firstUser , secondUser , thirdUser ))). hasSize ( 3 ). contains ( firstUser ,
171- secondUser , thirdUser );
169+ assertThat (repository .saveAll (asList (firstUser , secondUser , thirdUser ))) //
170+ . containsExactlyInAnyOrder ( firstUser , secondUser , thirdUser );
172171}
173172
174- @ Test // DATAJPA-1574
173+ @ Test // gh-2148
175174void savesAndFlushesCollectionCorrectly () {
176175
177- assertThat (repository .saveAllAndFlush (asList (firstUser , secondUser , thirdUser ))). hasSize ( 3 ). contains ( firstUser ,
178- secondUser , thirdUser );
176+ assertThat (repository .saveAllAndFlush (asList (firstUser , secondUser , thirdUser ))) //
177+ . containsExactlyInAnyOrder ( firstUser , secondUser , thirdUser );
179178}
180179
181180@ Test
182181void savingEmptyCollectionIsNoOp () throws Exception {
183182assertThat (repository .saveAll (new ArrayList <>())).isEmpty ();
184183}
185184
186- @ Test // DATAJPA-1574
185+ @ Test // gh-2148
187186void savingAndFlushingEmptyCollectionIsNoOp () {
188187assertThat (repository .saveAllAndFlush (new ArrayList <>())).isEmpty ();
189188}
@@ -1114,7 +1113,7 @@ void saveAndFlushShouldSupportReturningSubTypesOfRepositoryEntity() {
11141113assertThat (user .getEmailAddress ()).isEqualTo (savedUser .getEmailAddress ());
11151114}
11161115
1117- @ Test // DATAJPA-1574
1116+ @ Test // gh-2148
11181117void saveAllAndFlushShouldSupportReturningSubTypesOfRepositoryEntity () {
11191118
11201119repository .deleteAll ();
0 commit comments