Search in sources :

Example 1 with SystemMeta

use of gov.ca.cwds.rest.api.domain.cms.SystemMeta 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));
}
Also used : SystemMetaListResponse(gov.ca.cwds.rest.api.domain.cms.SystemMetaListResponse) SystemMeta(gov.ca.cwds.rest.api.domain.cms.SystemMeta) ImmutableSet(com.google.common.collect.ImmutableSet) Test(org.junit.Test)

Aggregations

ImmutableSet (com.google.common.collect.ImmutableSet)1 SystemMeta (gov.ca.cwds.rest.api.domain.cms.SystemMeta)1 SystemMetaListResponse (gov.ca.cwds.rest.api.domain.cms.SystemMetaListResponse)1 Test (org.junit.Test)1