Skip to content

Commit af8fb41

Browse files
mp911deschauder
authored andcommitted
Adopt to Mockito 5.1 changes.
See #1424
1 parent 2c865f4 commit af8fb41

File tree

1 file changed

+31
-26
lines changed

1 file changed

+31
-26
lines changed

spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/JdbcAggregateTemplateUnitTests.java

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void callbackOnSave() {
105105
SampleEntity second = new SampleEntity(23L, "Alfred E.");
106106
SampleEntity third = new SampleEntity(23L, "Neumann");
107107

108-
when(callbacks.callback(any(Class.class), any(), any())).thenReturn(second, third);
108+
when(callbacks.callback(any(Class.class), any(), any(Object.class))).thenReturn(second, third);
109109

110110
SampleEntity last = template.save(first);
111111

@@ -119,7 +119,7 @@ public void callbackOnSave() {
119119
void savePreparesInstanceWithInitialVersion_onInsert() {
120120

121121
EntityWithVersion entity = new EntityWithVersion(1L);
122-
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
122+
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
123123

124124
template.save(entity);
125125

@@ -134,7 +134,7 @@ void savePreparesInstanceWithInitialVersion_onInsert() {
134134
void savePreparesInstanceWithInitialVersion_onInsert_whenVersionPropertyIsImmutable() {
135135

136136
EntityWithImmutableVersion entity = new EntityWithImmutableVersion(1L, null);
137-
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
137+
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
138138

139139
template.save(entity);
140140

@@ -149,7 +149,7 @@ void savePreparesInstanceWithInitialVersion_onInsert_whenVersionPropertyIsImmuta
149149
void savePreparesInstanceWithInitialVersion_onInsert_whenVersionPropertyIsPrimitiveType() {
150150

151151
EntityWithPrimitiveVersion entity = new EntityWithPrimitiveVersion(1L);
152-
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
152+
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
153153

154154
template.save(entity);
155155

@@ -164,7 +164,7 @@ void savePreparesInstanceWithInitialVersion_onInsert_whenVersionPropertyIsPrimit
164164
void savePreparesInstanceWithInitialVersion_onInsert__whenVersionPropertyIsImmutableAndPrimitiveType() {
165165

166166
EntityWithImmutablePrimitiveVersion entity = new EntityWithImmutablePrimitiveVersion(1L, 0L);
167-
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
167+
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
168168

169169
template.save(entity);
170170

@@ -182,7 +182,7 @@ void savePreparesChangeWithPreviousVersion_onUpdate() {
182182
when(dataAccessStrategy.updateWithVersion(any(), any(), any())).thenReturn(true);
183183
EntityWithVersion entity = new EntityWithVersion(1L);
184184
entity.setVersion(1L);
185-
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
185+
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
186186

187187
template.save(entity);
188188

@@ -199,7 +199,7 @@ void savePreparesInstanceWithNextVersion_onUpdate() {
199199
when(dataAccessStrategy.updateWithVersion(any(), any(), any())).thenReturn(true);
200200
EntityWithVersion entity = new EntityWithVersion(1L);
201201
entity.setVersion(1L);
202-
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
202+
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
203203

204204
template.save(entity);
205205

@@ -215,7 +215,7 @@ void savePreparesInstanceWithNextVersion_onUpdate_whenVersionPropertyIsImmutable
215215

216216
when(dataAccessStrategy.updateWithVersion(any(), any(), any())).thenReturn(true);
217217
EntityWithImmutableVersion entity = new EntityWithImmutableVersion(1L, 1L);
218-
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
218+
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
219219

220220
template.save(entity);
221221

@@ -229,7 +229,7 @@ void savePreparesInstanceWithNextVersion_onUpdate_whenVersionPropertyIsImmutable
229229
void deletePreparesChangeWithPreviousVersion_onDeleteByInstance() {
230230

231231
EntityWithImmutableVersion entity = new EntityWithImmutableVersion(1L, 1L);
232-
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
232+
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
233233

234234
template.delete(entity, EntityWithImmutableVersion.class);
235235

@@ -265,10 +265,10 @@ public void callbackOnLoad() {
265265

266266
when(dataAccessStrategy.findAll(SampleEntity.class)).thenReturn(asList(alfred1, neumann1));
267267

268-
when(callbacks.callback(any(Class.class), eq(alfred1), any())).thenReturn(alfred2);
269-
when(callbacks.callback(any(Class.class), eq(alfred2), any())).thenReturn(alfred2);
270-
when(callbacks.callback(any(Class.class), eq(neumann1), any())).thenReturn(neumann2);
271-
when(callbacks.callback(any(Class.class), eq(neumann2), any())).thenReturn(neumann2);
268+
when(callbacks.callback(any(Class.class), eq(alfred1), any(Object[].class))).thenReturn(alfred2);
269+
when(callbacks.callback(any(Class.class), eq(alfred2), any(Object[].class))).thenReturn(alfred2);
270+
when(callbacks.callback(any(Class.class), eq(neumann1), any(Object[].class))).thenReturn(neumann2);
271+
when(callbacks.callback(any(Class.class), eq(neumann2), any(Object[].class))).thenReturn(neumann2);
272272

273273
Iterable<SampleEntity> all = template.findAll(SampleEntity.class);
274274

@@ -289,10 +289,10 @@ public void callbackOnLoadSorted() {
289289

290290
when(dataAccessStrategy.findAll(SampleEntity.class, Sort.by("name"))).thenReturn(asList(alfred1, neumann1));
291291

292-
when(callbacks.callback(any(Class.class), eq(alfred1), any())).thenReturn(alfred2);
293-
when(callbacks.callback(any(Class.class), eq(alfred2), any())).thenReturn(alfred2);
294-
when(callbacks.callback(any(Class.class), eq(neumann1), any())).thenReturn(neumann2);
295-
when(callbacks.callback(any(Class.class), eq(neumann2), any())).thenReturn(neumann2);
292+
when(callbacks.callback(any(Class.class), eq(alfred1), any(Object[].class))).thenReturn(alfred2);
293+
when(callbacks.callback(any(Class.class), eq(alfred2), any(Object[].class))).thenReturn(alfred2);
294+
when(callbacks.callback(any(Class.class), eq(neumann1), any(Object[].class))).thenReturn(neumann2);
295+
when(callbacks.callback(any(Class.class), eq(neumann2), any(Object[].class))).thenReturn(neumann2);
296296

297297
Iterable<SampleEntity> all = template.findAll(SampleEntity.class, Sort.by("name"));
298298

@@ -315,10 +315,10 @@ public void callbackOnLoadPaged() {
315315

316316
when(dataAccessStrategy.findAll(SampleEntity.class, PageRequest.of(0, 20))).thenReturn(asList(alfred1, neumann1));
317317

318-
when(callbacks.callback(any(Class.class), eq(alfred1), any())).thenReturn(alfred2);
319-
when(callbacks.callback(any(Class.class), eq(alfred2), any())).thenReturn(alfred2);
320-
when(callbacks.callback(any(Class.class), eq(neumann1), any())).thenReturn(neumann2);
321-
when(callbacks.callback(any(Class.class), eq(neumann2), any())).thenReturn(neumann2);
318+
when(callbacks.callback(any(Class.class), eq(alfred1), any(Object[].class))).thenReturn(alfred2);
319+
when(callbacks.callback(any(Class.class), eq(alfred2), any(Object[].class))).thenReturn(alfred2);
320+
when(callbacks.callback(any(Class.class), eq(neumann1), any(Object[].class))).thenReturn(neumann2);
321+
when(callbacks.callback(any(Class.class), eq(neumann2), any(Object[].class))).thenReturn(neumann2);
322322

323323
Iterable<SampleEntity> all = template.findAll(SampleEntity.class, PageRequest.of(0, 20));
324324

@@ -334,7 +334,8 @@ public void callbackOnLoadPaged() {
334334
@AllArgsConstructor
335335
private static class SampleEntity {
336336

337-
@Column("id1") @Id private Long id;
337+
@Column("id1")
338+
@Id private Long id;
338339

339340
private String name;
340341
}
@@ -343,7 +344,8 @@ private static class SampleEntity {
343344
@RequiredArgsConstructor
344345
private static class EntityWithVersion {
345346

346-
@Column("id1") @Id private final Long id;
347+
@Column("id1")
348+
@Id private final Long id;
347349

348350
@Version private Long version;
349351
}
@@ -352,7 +354,8 @@ private static class EntityWithVersion {
352354
@RequiredArgsConstructor
353355
private static class EntityWithImmutableVersion {
354356

355-
@Column("id1") @Id private final Long id;
357+
@Column("id1")
358+
@Id private final Long id;
356359

357360
@Version private final Long version;
358361
}
@@ -361,7 +364,8 @@ private static class EntityWithImmutableVersion {
361364
@RequiredArgsConstructor
362365
private static class EntityWithPrimitiveVersion {
363366

364-
@Column("id1") @Id private final Long id;
367+
@Column("id1")
368+
@Id private final Long id;
365369

366370
@Version private long version;
367371
}
@@ -370,7 +374,8 @@ private static class EntityWithPrimitiveVersion {
370374
@RequiredArgsConstructor
371375
private static class EntityWithImmutablePrimitiveVersion {
372376

373-
@Column("id1") @Id private final Long id;
377+
@Column("id1")
378+
@Id private final Long id;
374379

375380
@Version private final long version;
376381
}

0 commit comments

Comments
 (0)