use of com.nike.cerberus.domain.SDBMetadataResult in project cerberus by Nike-Inc.
the class MetadataServiceTest method test_that_get_sdb_metadata_properly_sets_result_metadata.
@Test
public void test_that_get_sdb_metadata_properly_sets_result_metadata() {
int limit = 5;
int offset = 0;
int totalSDBs = 20;
when(safeDepositBoxService.getTotalNumberOfSafeDepositBoxes()).thenReturn(totalSDBs);
SDBMetadata sdbMD = new SDBMetadata();
doReturn(Arrays.asList(sdbMD)).when(metadataServiceSpy).getSDBMetadataList(limit, offset, null);
SDBMetadataResult actual = metadataServiceSpy.getSDBMetadata(limit, offset, null);
assertEquals("expected actual limit to be passed in limit", limit, actual.getLimit());
assertEquals("expected actual offset to be passed in offset", offset, actual.getOffset());
assertEquals("expected next offset to be limit + offset", limit + offset, actual.getNextOffset());
assertEquals("expected there to be another page of results", true, actual.isHasNext());
assertEquals("expected the sdb count to equal 1", 1, actual.getSdbCountInResult());
assertEquals("expected total sdbs to equal the sdb total count", totalSDBs, actual.getTotalSDBCount());
}
use of com.nike.cerberus.domain.SDBMetadataResult in project cerberus by Nike-Inc.
the class MetadataServiceTest method test_that_get_sdb_metadata_set_has_next_to_no_when_done_paging.
@Test
public void test_that_get_sdb_metadata_set_has_next_to_no_when_done_paging() {
int limit = 5;
int offset = 15;
int totalSDBs = 20;
when(safeDepositBoxService.getTotalNumberOfSafeDepositBoxes()).thenReturn(totalSDBs);
doReturn(Arrays.asList(new SDBMetadata())).when(metadataServiceSpy).getSDBMetadataList(limit, offset, null);
SDBMetadataResult actual = metadataServiceSpy.getSDBMetadata(limit, offset, null);
assertEquals("expected actual limit to be passed in limit", limit, actual.getLimit());
assertEquals("expected actual offset to be passed in offset", offset, actual.getOffset());
assertEquals("expected next offset to be 0 because no more paging", 0, actual.getNextOffset());
assertEquals("expected there to be another page of results", false, actual.isHasNext());
assertEquals("expected the sdb count to equal 1", 1, actual.getSdbCountInResult());
assertEquals("expected total sdbs to equal the sdb total count", totalSDBs, actual.getTotalSDBCount());
}
use of com.nike.cerberus.domain.SDBMetadataResult in project cerberus by Nike-Inc.
the class SdbMetadataControllerTest method testGetMetadata.
@Test
public void testGetMetadata() {
SDBMetadataResult sdbMetadataResultMock = Mockito.mock(SDBMetadataResult.class);
Mockito.when(metadataService.getSDBMetadata(1, 2, "sdbNameFilter")).thenReturn(sdbMetadataResultMock);
SDBMetadataResult sdbMetadataResult = sdbMetadataController.getMetadata(1, 2, "sdbNameFilter");
Assert.assertSame(sdbMetadataResultMock, sdbMetadataResult);
}
Aggregations