46
46
import org .junit .jupiter .api .Disabled ;
47
47
import org .junit .jupiter .api .Test ;
48
48
import org .junit .jupiter .api .extension .ExtendWith ;
49
-
50
49
import org .springframework .beans .factory .annotation .Autowired ;
51
50
import org .springframework .dao .DataAccessException ;
52
51
import org .springframework .dao .DataIntegrityViolationException ;
60
59
import org .springframework .data .domain .Pageable ;
61
60
import org .springframework .data .domain .Slice ;
62
61
import org .springframework .data .domain .Sort ;
62
+ import org .springframework .data .domain .ExampleMatcher .*;
63
63
import org .springframework .data .domain .Sort .Direction ;
64
64
import org .springframework .data .domain .Sort .Order ;
65
- import org .springframework .data .domain .ExampleMatcher .*;
66
65
import org .springframework .data .jpa .domain .Specification ;
67
66
import org .springframework .data .jpa .domain .sample .Address ;
68
67
import org .springframework .data .jpa .domain .sample .Role ;
69
68
import org .springframework .data .jpa .domain .sample .SpecialUser ;
70
69
import org .springframework .data .jpa .domain .sample .User ;
71
- import org .springframework .data .jpa .repository .sample .SampleEvaluationContextExtension .SampleSecurityContextHolder ;
72
70
import org .springframework .data .jpa .repository .sample .UserRepository ;
71
+ import org .springframework .data .jpa .repository .sample .SampleEvaluationContextExtension .SampleSecurityContextHolder ;
73
72
import org .springframework .data .jpa .repository .sample .UserRepository .NameOnly ;
74
73
import org .springframework .test .context .ContextConfiguration ;
75
74
import org .springframework .test .context .junit .jupiter .SpringExtension ;
@@ -152,8 +151,8 @@ void findsAllByGivenIds() {
152
151
153
152
flushTestUsers ();
154
153
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 );
157
156
}
158
157
159
158
@ Test
@@ -167,23 +166,23 @@ void testReadByIdReturnsNullForNotFoundEntities() {
167
166
@ Test
168
167
void savesCollectionCorrectly () throws Exception {
169
168
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 );
172
171
}
173
172
174
- @ Test // DATAJPA-1574
173
+ @ Test // gh-2148
175
174
void savesAndFlushesCollectionCorrectly () {
176
175
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 );
179
178
}
180
179
181
180
@ Test
182
181
void savingEmptyCollectionIsNoOp () throws Exception {
183
182
assertThat (repository .saveAll (new ArrayList <>())).isEmpty ();
184
183
}
185
184
186
- @ Test // DATAJPA-1574
185
+ @ Test // gh-2148
187
186
void savingAndFlushingEmptyCollectionIsNoOp () {
188
187
assertThat (repository .saveAllAndFlush (new ArrayList <>())).isEmpty ();
189
188
}
@@ -1114,7 +1113,7 @@ void saveAndFlushShouldSupportReturningSubTypesOfRepositoryEntity() {
1114
1113
assertThat (user .getEmailAddress ()).isEqualTo (savedUser .getEmailAddress ());
1115
1114
}
1116
1115
1117
- @ Test // DATAJPA-1574
1116
+ @ Test // gh-2148
1118
1117
void saveAllAndFlushShouldSupportReturningSubTypesOfRepositoryEntity () {
1119
1118
1120
1119
repository .deleteAll ();
0 commit comments