32
32
import org .junit .jupiter .api .BeforeEach ;
33
33
import org .junit .jupiter .api .Test ;
34
34
import org .mockito .stubbing .Answer ;
35
+
35
36
import org .springframework .context .ApplicationEventPublisher ;
36
37
import org .springframework .data .annotation .Id ;
37
38
import org .springframework .data .domain .PageRequest ;
38
39
import org .springframework .data .domain .Pageable ;
39
40
import org .springframework .data .domain .Sort ;
40
- import org .springframework .data .jdbc .core .convert .*;
41
+ import org .springframework .data .jdbc .core .convert .BasicJdbcConverter ;
42
+ import org .springframework .data .jdbc .core .convert .BatchJdbcOperations ;
43
+ import org .springframework .data .jdbc .core .convert .DefaultDataAccessStrategy ;
44
+ import org .springframework .data .jdbc .core .convert .DefaultJdbcTypeFactory ;
45
+ import org .springframework .data .jdbc .core .convert .DelegatingDataAccessStrategy ;
46
+ import org .springframework .data .jdbc .core .convert .InsertStrategyFactory ;
47
+ import org .springframework .data .jdbc .core .convert .JdbcConverter ;
48
+ import org .springframework .data .jdbc .core .convert .JdbcCustomConversions ;
49
+ import org .springframework .data .jdbc .core .convert .SqlGeneratorSource ;
50
+ import org .springframework .data .jdbc .core .convert .SqlParametersFactory ;
41
51
import org .springframework .data .jdbc .core .mapping .JdbcMappingContext ;
42
52
import org .springframework .data .jdbc .repository .support .JdbcRepositoryFactory ;
43
53
import org .springframework .data .jdbc .repository .support .SimpleJdbcRepository ;
73
83
* @author Myeonghyeon Lee
74
84
* @author Chirag Tailor
75
85
*/
76
- public class SimpleJdbcRepositoryEventsUnitTests {
86
+ class SimpleJdbcRepositoryEventsUnitTests {
77
87
78
88
private static final long generatedId = 4711L ;
79
89
80
- CollectingEventPublisher publisher = new CollectingEventPublisher ();
90
+ private CollectingEventPublisher publisher = new CollectingEventPublisher ();
81
91
82
- DummyEntityRepository repository ;
83
- DefaultDataAccessStrategy dataAccessStrategy ;
92
+ private DummyEntityRepository repository ;
93
+ private DefaultDataAccessStrategy dataAccessStrategy ;
84
94
85
95
@ BeforeEach
86
- public void before () {
96
+ void before () {
87
97
88
98
RelationalMappingContext context = new JdbcMappingContext ();
89
99
NamedParameterJdbcOperations operations = createIdGeneratingOperations ();
90
- DelegatingDataAccessStrategy delegatingDataAccessStrategy = new DelegatingDataAccessStrategy ();
100
+
91
101
Dialect dialect = HsqlDbDialect .INSTANCE ;
102
+ DelegatingDataAccessStrategy delegatingDataAccessStrategy = new DelegatingDataAccessStrategy ();
92
103
JdbcConverter converter = new BasicJdbcConverter (context , delegatingDataAccessStrategy , new JdbcCustomConversions (),
93
104
new DefaultJdbcTypeFactory (operations .getJdbcOperations ()), dialect .getIdentifierProcessing ());
94
105
SqlGeneratorSource generatorSource = new SqlGeneratorSource (context , converter , dialect );
@@ -109,7 +120,7 @@ public void before() {
109
120
110
121
@ Test // DATAJDBC-99
111
122
@ SuppressWarnings ("rawtypes" )
112
- public void publishesEventsOnSave () {
123
+ void publishesEventsOnSave () {
113
124
114
125
DummyEntity entity = new DummyEntity (23L );
115
126
@@ -126,7 +137,7 @@ public void publishesEventsOnSave() {
126
137
127
138
@ Test // DATAJDBC-99
128
139
@ SuppressWarnings ("rawtypes" )
129
- public void publishesEventsOnSaveMany () {
140
+ void publishesEventsOnSaveMany () {
130
141
131
142
DummyEntity entity1 = new DummyEntity (null );
132
143
DummyEntity entity2 = new DummyEntity (23L );
@@ -146,7 +157,7 @@ public void publishesEventsOnSaveMany() {
146
157
}
147
158
148
159
@ Test // DATAJDBC-99
149
- public void publishesEventsOnDelete () {
160
+ void publishesEventsOnDelete () {
150
161
151
162
DummyEntity entity = new DummyEntity (23L );
152
163
@@ -173,7 +184,7 @@ private Object getEntity(RelationalEvent e) {
173
184
174
185
@ Test // DATAJDBC-99
175
186
@ SuppressWarnings ("rawtypes" )
176
- public void publishesEventsOnDeleteById () {
187
+ void publishesEventsOnDeleteById () {
177
188
178
189
repository .deleteById (23L );
179
190
@@ -187,7 +198,7 @@ public void publishesEventsOnDeleteById() {
187
198
188
199
@ Test // DATAJDBC-197
189
200
@ SuppressWarnings ("rawtypes" )
190
- public void publishesEventsOnFindAll () {
201
+ void publishesEventsOnFindAll () {
191
202
192
203
DummyEntity entity1 = new DummyEntity (42L );
193
204
DummyEntity entity2 = new DummyEntity (23L );
@@ -206,7 +217,7 @@ public void publishesEventsOnFindAll() {
206
217
207
218
@ Test // DATAJDBC-197
208
219
@ SuppressWarnings ("rawtypes" )
209
- public void publishesEventsOnFindAllById () {
220
+ void publishesEventsOnFindAllById () {
210
221
211
222
DummyEntity entity1 = new DummyEntity (42L );
212
223
DummyEntity entity2 = new DummyEntity (23L );
@@ -225,7 +236,7 @@ public void publishesEventsOnFindAllById() {
225
236
226
237
@ Test // DATAJDBC-197
227
238
@ SuppressWarnings ("rawtypes" )
228
- public void publishesEventsOnFindById () {
239
+ void publishesEventsOnFindById () {
229
240
230
241
DummyEntity entity1 = new DummyEntity (23L );
231
242
@@ -242,7 +253,7 @@ public void publishesEventsOnFindById() {
242
253
243
254
@ Test // DATAJDBC-101
244
255
@ SuppressWarnings ("rawtypes" )
245
- public void publishesEventsOnFindAllSorted () {
256
+ void publishesEventsOnFindAllSorted () {
246
257
247
258
DummyEntity entity1 = new DummyEntity (42L );
248
259
DummyEntity entity2 = new DummyEntity (23L );
@@ -261,7 +272,7 @@ public void publishesEventsOnFindAllSorted() {
261
272
262
273
@ Test // DATAJDBC-101
263
274
@ SuppressWarnings ("rawtypes" )
264
- public void publishesEventsOnFindAllPaged () {
275
+ void publishesEventsOnFindAllPaged () {
265
276
266
277
DummyEntity entity1 = new DummyEntity (42L );
267
278
DummyEntity entity2 = new DummyEntity (23L );
0 commit comments