use of org.springframework.cloud.gcp.data.spanner.core.SpannerOperations in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryImplTests method deleteManyObsTest.
@Test
public void deleteManyObsTest() {
SpannerOperations operations = mock(SpannerOperations.class);
Iterable<String> obs = Arrays.asList("ob1", "ob2");
doAnswer(invocation -> {
Iterable<String> toDelete = invocation.getArgument(1);
assertThat(toDelete, containsInAnyOrder("ob1", "ob2"));
return null;
}).when(operations).delete(eq(String.class), same(obs));
new SimpleSpannerRepository(operations, Object.class).deleteAll(obs);
}
use of org.springframework.cloud.gcp.data.spanner.core.SpannerOperations in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryImplTests method findAllTest.
@Test
public void findAllTest() {
SpannerOperations operations = mock(SpannerOperations.class);
new SimpleSpannerRepository(operations, Object.class).findAll();
verify(operations, times(1)).findAll(eq(Object.class));
}
use of org.springframework.cloud.gcp.data.spanner.core.SpannerOperations in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryImplTests method existsByIdTestFound.
@Test
public void existsByIdTestFound() {
SpannerOperations operations = mock(SpannerOperations.class);
Key key = Key.of("key");
Object ret = new Object();
when(operations.find(eq(Object.class), eq(key))).thenReturn(ret);
assertTrue(new SimpleSpannerRepository(operations, Object.class).existsById(key));
}
use of org.springframework.cloud.gcp.data.spanner.core.SpannerOperations in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryImplTests method deleteByIdTest.
@Test
public void deleteByIdTest() {
SpannerOperations operations = mock(SpannerOperations.class);
Key key = Key.of("key");
new SimpleSpannerRepository(operations, Object.class).deleteById(key);
verify(operations, times(1)).delete(eq(Object.class), eq(key));
}
use of org.springframework.cloud.gcp.data.spanner.core.SpannerOperations in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryImplTests method deleteTest.
@Test
public void deleteTest() {
SpannerOperations operations = mock(SpannerOperations.class);
Object ob = new Object();
new SimpleSpannerRepository(operations, Object.class).delete(ob);
verify(operations, times(1)).delete(eq(ob));
}
Aggregations