use of se.inera.intyg.webcert.web.web.controller.api.dto.ArendeView in project webcert by sklintyg.
the class ArendeViewConverterTest method testConvertKompletteringInstansTooHigh.
@SuppressWarnings("unchecked")
@Test
public void testConvertKompletteringInstansTooHigh() throws ModuleNotFoundException {
Arende arende = buildArende("lisjp");
arende.setKomplettering(Arrays.asList(buildMedicinsktArende("1", 3, "arende1")));
ArendeView result = converter.convertToDto(arende);
assertEquals(1, result.getKompletteringar().size());
assertEquals(RespConstants.GRUNDFORMEDICINSKTUNDERLAG_SVAR_JSON_ID_1, result.getKompletteringar().get(0).getJsonPropertyHandle());
assertEquals(new Integer(2), result.getKompletteringar().get(0).getPosition());
assertEquals(VARDAKTOR_NAMN, result.getVardaktorNamn());
assertEquals(ENHETS_NAMN, result.getEnhetsnamn());
assertEquals(VARDGIVARE_NAMN, result.getVardgivarnamn());
verify(moduleApi).getModuleSpecificArendeParameters(any(Utlatande.class), any(List.class));
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ArendeView in project webcert by sklintyg.
the class ArendeViewConverterTest method testConvertToArendeForLisjp.
@SuppressWarnings("unchecked")
@Test
public void testConvertToArendeForLisjp() throws ModuleNotFoundException {
ArendeView result = converter.convertToDto(buildArende("lisjp"));
assertEquals(RespConstants.GRUNDFORMEDICINSKTUNDERLAG_TELEFONKONTAKT_PATIENT_SVAR_JSON_ID_1, result.getKompletteringar().get(0).getJsonPropertyHandle());
assertEquals(RespConstants.KANNEDOM_SVAR_JSON_ID_2, result.getKompletteringar().get(1).getJsonPropertyHandle());
assertEquals(RespConstants.UNDERLAG_SVAR_JSON_ID_4, result.getKompletteringar().get(2).getJsonPropertyHandle());
assertEquals(new Integer(0), result.getKompletteringar().get(0).getPosition());
assertEquals(new Integer(0), result.getKompletteringar().get(1).getPosition());
assertEquals(new Integer(1), result.getKompletteringar().get(2).getPosition());
assertEquals(VARDAKTOR_NAMN, result.getVardaktorNamn());
assertEquals(ENHETS_NAMN, result.getEnhetsnamn());
assertEquals(VARDGIVARE_NAMN, result.getVardgivarnamn());
verify(moduleApi).getModuleSpecificArendeParameters(any(Utlatande.class), any(List.class));
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ArendeView in project webcert by sklintyg.
the class ArendeViewConverterTest method paminnelserInArendeConversionViewShouldBeReverseSortedOnDate.
@Test
public void paminnelserInArendeConversionViewShouldBeReverseSortedOnDate() {
// Given
LocalDateTime fragaTimestamp = LocalDateTime.parse("2016-03-01T11:22:11");
Arende fraga = createValidArendeForLuse("fraga", fragaTimestamp, "fraga1-id", null);
Arende p1 = createValidArendeForLuse("paminnelse", fragaTimestamp.plusHours(2), "paminnelse-1.1-id", fraga);
Arende p2 = createValidArendeForLuse("paminnelse", fragaTimestamp.plusDays(1), "paminnelse-1.2-id", fraga);
Arende p3 = createValidArendeForLuse("paminnelse", fragaTimestamp.plusDays(3), "paminnelse-1.3-id", fraga);
Arende svar = createValidArendeForLuse("svar", fragaTimestamp.plusDays(4), "svar-1-id", fraga);
// When
ArendeConversationView messageThread = converter.convertToArendeConversationView(fraga, svar, null, ImmutableList.of(p3, p1, p2), null);
// Then
List<ArendeView> expectedPaminnelserOrder = Stream.of(p3, p2, p1).map(converter::convertToDto).collect(Collectors.toList());
Assertions.assertThat(messageThread.getPaminnelser()).hasSize(3).containsExactlyElementsOf(expectedPaminnelserOrder);
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ArendeView in project webcert by sklintyg.
the class ArendeViewConverterTest method testConvertKompletteringUnknownQuestionId.
@SuppressWarnings("unchecked")
@Test
public void testConvertKompletteringUnknownQuestionId() throws ModuleNotFoundException {
Arende arende = buildArende("lisjp");
arende.setKomplettering(Arrays.asList(buildMedicinsktArende("10", 1, "arende1")));
ArendeView result = converter.convertToDto(arende);
assertEquals(1, result.getKompletteringar().size());
assertEquals("", result.getKompletteringar().get(0).getJsonPropertyHandle());
assertEquals(new Integer(0), result.getKompletteringar().get(0).getPosition());
assertEquals(VARDAKTOR_NAMN, result.getVardaktorNamn());
assertEquals(ENHETS_NAMN, result.getEnhetsnamn());
assertEquals(VARDGIVARE_NAMN, result.getVardgivarnamn());
verify(moduleApi).getModuleSpecificArendeParameters(any(Utlatande.class), any(List.class));
}
Aggregations