use of org.springframework.cloud.gcp.data.spanner.core.SpannerOperations in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryImplTests method getSpannerOperationsTest.
@Test
public void getSpannerOperationsTest() {
SpannerOperations operations = mock(SpannerOperations.class);
assertSame(operations, new SimpleSpannerRepository(operations, Object.class).getSpannerOperations());
}
use of org.springframework.cloud.gcp.data.spanner.core.SpannerOperations in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryImplTests method existsByIdTestNotFound.
@Test
public void existsByIdTestNotFound() {
SpannerOperations operations = mock(SpannerOperations.class);
when(operations.find(eq(Object.class), (Key) any())).thenReturn(null);
assertFalse(new SimpleSpannerRepository(operations, Object.class).existsById(Key.of("key")));
}
use of org.springframework.cloud.gcp.data.spanner.core.SpannerOperations in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryImplTests method findAllByIdTest.
@Test
public void findAllByIdTest() {
SpannerOperations operations = mock(SpannerOperations.class);
when(operations.find(eq(Object.class), (KeySet) any())).thenAnswer(invocation -> {
KeySet keys = invocation.getArgument(1);
assertThat(keys.getKeys(), containsInAnyOrder(Key.of("key2"), Key.of("key1")));
return null;
});
new SimpleSpannerRepository(operations, Object.class).findAllById(Arrays.asList(Key.of("key1"), Key.of("key2")));
}
use of org.springframework.cloud.gcp.data.spanner.core.SpannerOperations in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryImplTests method findAllPageableTest.
@Test
public void findAllPageableTest() {
SpannerOperations operations = mock(SpannerOperations.class);
Pageable pageable = mock(Pageable.class);
new SimpleSpannerRepository(operations, Object.class).findAll(pageable);
verify(operations, times(1)).findAll(eq(Object.class), same(pageable));
}
use of org.springframework.cloud.gcp.data.spanner.core.SpannerOperations in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryImplTests method findAllSortTest.
@Test
public void findAllSortTest() {
SpannerOperations operations = mock(SpannerOperations.class);
Sort sort = mock(Sort.class);
new SimpleSpannerRepository(operations, Object.class).findAll(sort);
verify(operations, times(1)).findAll(eq(Object.class), same(sort));
}
Aggregations