use of org.springframework.cloud.gcp.data.spanner.core.mapping.event.AfterSaveEvent in project spring-cloud-gcp by spring-cloud.
the class SpannerTemplateTests method updateColumnsArrayTest.
@Test
public void updateColumnsArrayTest() {
Mutation mutation = Mutation.newInsertOrUpdateBuilder("custom_test_table").build();
List<Mutation> mutations = Collections.singletonList(mutation);
TestEntity entity = new TestEntity();
Set<String> cols = new HashSet<>(Arrays.asList("a", "b"));
when(this.mutationFactory.update(same(entity), eq(cols))).thenReturn(mutations);
verifyBeforeAndAfterEvents(new BeforeSaveEvent(Collections.singletonList(entity), cols), new AfterSaveEvent(mutations, Collections.singletonList(entity), cols), () -> this.spannerTemplate.update(entity, "a", "b"), x -> x.verify(this.databaseClient, times(1)).write(eq(mutations)));
}
Aggregations