@Test public void shouldUnmarshallGetDomainResponseBody() throws Throwable { // pre-conditions String content = Samples.GET_DOMAIN.getContentAsString(); assertNotNull(content); // operation RestResponse response = ResourceDTOFactory.get(content); // verifications assertThat(response.getDataType()).isEqualTo(EnumDataType.domain); final DomainResourceDTO domain = response.getData(); assertNotNull(domain); assertThat(domain.getNamespace()).isEqualTo("foobar"); assertThat(domain.getLinks()).hasSize(6); }
@Test public void shouldUnmarshallGetDomainsWith1ExistingResponseBody() throws Throwable { // pre-conditions String content = Samples.GET_DOMAINS_1EXISTING.getContentAsString(); assertNotNull(content); // operation RestResponse response = ResourceDTOFactory.get(content); // verifications assertThat(response.getDataType()).isEqualTo(EnumDataType.domains); final List<DomainResourceDTO> domainDTOs = response.getData(); assertThat(domainDTOs).isNotEmpty(); assertThat(domainDTOs).hasSize(1); final DomainResourceDTO domainDTO = domainDTOs.get(0); assertThat(domainDTO.getNamespace()).isEqualTo("foobar"); assertThat(domainDTO.getLinks()).hasSize(6); final Link link = domainDTO.getLink(ADD_APPLICATION); assertThat(link).isNotNull(); assertThat(link.getHref()).isEqualTo("/domains/foobar/applications"); assertThat(link.getRel()).isEqualTo("Create new application"); assertThat(link.getHttpMethod()).isEqualTo(HttpMethod.POST); final List<LinkParameter> requiredParams = link.getRequiredParams(); assertThat(requiredParams).hasSize(2); }