Adopt to Mockito 5.1 changes.

See #1424
This commit is contained in:
Mark Paluch
2023-02-14 10:34:57 +01:00
committed by Jens Schauder
parent 2c865f4184
commit af8fb41397

View File

@@ -105,7 +105,7 @@ public class JdbcAggregateTemplateUnitTests {
SampleEntity second = new SampleEntity(23L, "Alfred E.");
SampleEntity third = new SampleEntity(23L, "Neumann");
when(callbacks.callback(any(Class.class), any(), any())).thenReturn(second, third);
when(callbacks.callback(any(Class.class), any(), any(Object.class))).thenReturn(second, third);
SampleEntity last = template.save(first);
@@ -119,7 +119,7 @@ public class JdbcAggregateTemplateUnitTests {
void savePreparesInstanceWithInitialVersion_onInsert() {
EntityWithVersion entity = new EntityWithVersion(1L);
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
template.save(entity);
@@ -134,7 +134,7 @@ public class JdbcAggregateTemplateUnitTests {
void savePreparesInstanceWithInitialVersion_onInsert_whenVersionPropertyIsImmutable() {
EntityWithImmutableVersion entity = new EntityWithImmutableVersion(1L, null);
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
template.save(entity);
@@ -149,7 +149,7 @@ public class JdbcAggregateTemplateUnitTests {
void savePreparesInstanceWithInitialVersion_onInsert_whenVersionPropertyIsPrimitiveType() {
EntityWithPrimitiveVersion entity = new EntityWithPrimitiveVersion(1L);
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
template.save(entity);
@@ -164,7 +164,7 @@ public class JdbcAggregateTemplateUnitTests {
void savePreparesInstanceWithInitialVersion_onInsert__whenVersionPropertyIsImmutableAndPrimitiveType() {
EntityWithImmutablePrimitiveVersion entity = new EntityWithImmutablePrimitiveVersion(1L, 0L);
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
template.save(entity);
@@ -182,7 +182,7 @@ public class JdbcAggregateTemplateUnitTests {
when(dataAccessStrategy.updateWithVersion(any(), any(), any())).thenReturn(true);
EntityWithVersion entity = new EntityWithVersion(1L);
entity.setVersion(1L);
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
template.save(entity);
@@ -199,7 +199,7 @@ public class JdbcAggregateTemplateUnitTests {
when(dataAccessStrategy.updateWithVersion(any(), any(), any())).thenReturn(true);
EntityWithVersion entity = new EntityWithVersion(1L);
entity.setVersion(1L);
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
template.save(entity);
@@ -215,7 +215,7 @@ public class JdbcAggregateTemplateUnitTests {
when(dataAccessStrategy.updateWithVersion(any(), any(), any())).thenReturn(true);
EntityWithImmutableVersion entity = new EntityWithImmutableVersion(1L, 1L);
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
template.save(entity);
@@ -229,7 +229,7 @@ public class JdbcAggregateTemplateUnitTests {
void deletePreparesChangeWithPreviousVersion_onDeleteByInstance() {
EntityWithImmutableVersion entity = new EntityWithImmutableVersion(1L, 1L);
when(callbacks.callback(any(), any(), any())).thenReturn(entity, entity);
when(callbacks.callback(any(), any(), any(Object.class))).thenReturn(entity, entity);
template.delete(entity, EntityWithImmutableVersion.class);
@@ -265,10 +265,10 @@ public class JdbcAggregateTemplateUnitTests {
when(dataAccessStrategy.findAll(SampleEntity.class)).thenReturn(asList(alfred1, neumann1));
when(callbacks.callback(any(Class.class), eq(alfred1), any())).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(alfred2), any())).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(neumann1), any())).thenReturn(neumann2);
when(callbacks.callback(any(Class.class), eq(neumann2), any())).thenReturn(neumann2);
when(callbacks.callback(any(Class.class), eq(alfred1), any(Object[].class))).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(alfred2), any(Object[].class))).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(neumann1), any(Object[].class))).thenReturn(neumann2);
when(callbacks.callback(any(Class.class), eq(neumann2), any(Object[].class))).thenReturn(neumann2);
Iterable<SampleEntity> all = template.findAll(SampleEntity.class);
@@ -289,10 +289,10 @@ public class JdbcAggregateTemplateUnitTests {
when(dataAccessStrategy.findAll(SampleEntity.class, Sort.by("name"))).thenReturn(asList(alfred1, neumann1));
when(callbacks.callback(any(Class.class), eq(alfred1), any())).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(alfred2), any())).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(neumann1), any())).thenReturn(neumann2);
when(callbacks.callback(any(Class.class), eq(neumann2), any())).thenReturn(neumann2);
when(callbacks.callback(any(Class.class), eq(alfred1), any(Object[].class))).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(alfred2), any(Object[].class))).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(neumann1), any(Object[].class))).thenReturn(neumann2);
when(callbacks.callback(any(Class.class), eq(neumann2), any(Object[].class))).thenReturn(neumann2);
Iterable<SampleEntity> all = template.findAll(SampleEntity.class, Sort.by("name"));
@@ -315,10 +315,10 @@ public class JdbcAggregateTemplateUnitTests {
when(dataAccessStrategy.findAll(SampleEntity.class, PageRequest.of(0, 20))).thenReturn(asList(alfred1, neumann1));
when(callbacks.callback(any(Class.class), eq(alfred1), any())).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(alfred2), any())).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(neumann1), any())).thenReturn(neumann2);
when(callbacks.callback(any(Class.class), eq(neumann2), any())).thenReturn(neumann2);
when(callbacks.callback(any(Class.class), eq(alfred1), any(Object[].class))).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(alfred2), any(Object[].class))).thenReturn(alfred2);
when(callbacks.callback(any(Class.class), eq(neumann1), any(Object[].class))).thenReturn(neumann2);
when(callbacks.callback(any(Class.class), eq(neumann2), any(Object[].class))).thenReturn(neumann2);
Iterable<SampleEntity> all = template.findAll(SampleEntity.class, PageRequest.of(0, 20));
@@ -334,7 +334,8 @@ public class JdbcAggregateTemplateUnitTests {
@AllArgsConstructor
private static class SampleEntity {
@Column("id1") @Id private Long id;
@Column("id1")
@Id private Long id;
private String name;
}
@@ -343,7 +344,8 @@ public class JdbcAggregateTemplateUnitTests {
@RequiredArgsConstructor
private static class EntityWithVersion {
@Column("id1") @Id private final Long id;
@Column("id1")
@Id private final Long id;
@Version private Long version;
}
@@ -352,7 +354,8 @@ public class JdbcAggregateTemplateUnitTests {
@RequiredArgsConstructor
private static class EntityWithImmutableVersion {
@Column("id1") @Id private final Long id;
@Column("id1")
@Id private final Long id;
@Version private final Long version;
}
@@ -361,7 +364,8 @@ public class JdbcAggregateTemplateUnitTests {
@RequiredArgsConstructor
private static class EntityWithPrimitiveVersion {
@Column("id1") @Id private final Long id;
@Column("id1")
@Id private final Long id;
@Version private long version;
}
@@ -370,7 +374,8 @@ public class JdbcAggregateTemplateUnitTests {
@RequiredArgsConstructor
private static class EntityWithImmutablePrimitiveVersion {
@Column("id1") @Id private final Long id;
@Column("id1")
@Id private final Long id;
@Version private final long version;
}