use of gov.ca.cwds.rest.api.domain.cms.SystemMetaListResponse in project API by ca-cwds.
the class SystemCodeService method listOfSystemMetas.
/**
*
* @return the response containing List of Values from System Meta Table
*/
private Response listOfSystemMetas() {
SystemMeta[] sysMeta = systemMetaDao.findAll();
ImmutableSet.Builder<gov.ca.cwds.rest.api.domain.cms.SystemMeta> builder = ImmutableSet.builder();
for (SystemMeta s : sysMeta) {
if (s != null) {
builder.add(new gov.ca.cwds.rest.api.domain.cms.SystemMeta(s));
}
}
return new SystemMetaListResponse(builder.build());
}
use of gov.ca.cwds.rest.api.domain.cms.SystemMetaListResponse in project API by ca-cwds.
the class SystemCodeServiceTest method findReturnsCorrectEntitySystemMetas.
@Test
public void findReturnsCorrectEntitySystemMetas() throws Exception {
String id = "";
SystemMeta validSysMeta = MAPPER.readValue(fixture("fixtures/domain/legacy/SystemMeta/valid/valid.json"), SystemMeta.class);
gov.ca.cwds.data.persistence.cms.SystemMeta systemMeta = new gov.ca.cwds.data.persistence.cms.SystemMeta("GVR_ENTC", "Government Entity Type", "Government Entity");
gov.ca.cwds.data.persistence.cms.SystemMeta[] foundSysMetas = new gov.ca.cwds.data.persistence.cms.SystemMeta[1];
foundSysMetas[0] = systemMeta;
ImmutableSet.Builder<SystemMeta> builder = ImmutableSet.builder();
builder.add(validSysMeta);
Set<SystemMeta> expectedSysMetas = builder.build();
SystemMetaListResponse expected = new SystemMetaListResponse(expectedSysMetas);
when(systemMetaDao.findAll()).thenReturn(foundSysMetas);
SystemMetaListResponse found = (SystemMetaListResponse) systemCodeService.find(id);
assertThat(found, is(expected));
}
Aggregations