Search in sources :

Example 1 with NotifiedState

use of se.inera.intyg.webcert.web.web.controller.api.dto.NotifiedState in project webcert by sklintyg.

the class IntygAPIControllerIT method testNotifiedOnUtkast.

@Test
public void testNotifiedOnUtkast() {
    RestAssured.sessionId = getAuthSession(DEFAULT_LAKARE);
    String utkastId = createUtkast("lisjp", DEFAULT_PATIENT_PERSONNUMMER);
    Map<String, String> pathParams = new HashMap<>();
    pathParams.put("intygsTyp", "lisjp");
    pathParams.put("intygsId", utkastId);
    pathParams.put("version", "0");
    NotifiedState notifiedState = new NotifiedState();
    notifiedState.setNotified(true);
    ListIntygEntry updatedIntyg = given().cookie("ROUTEID", BaseRestIntegrationTest.routeId).contentType(ContentType.JSON).and().body(notifiedState).and().pathParams(pathParams).expect().statusCode(200).when().put("api/intyg/{intygsTyp}/{intygsId}/{version}/vidarebefordra").then().body(matchesJsonSchemaInClasspath("jsonschema/webcert-put-notified-utkast-response-schema.json")).extract().response().as(ListIntygEntry.class);
    assertNotNull(updatedIntyg);
    assertEquals(utkastId, updatedIntyg.getIntygId());
    assertEquals("lisjp", updatedIntyg.getIntygType());
    // it's been updated, so version should have been incremented
    assertEquals(1, updatedIntyg.getVersion());
    // and of course it should have been vidarebefordrad as we instructed
    assertTrue(updatedIntyg.isVidarebefordrad());
}
Also used : HashMap(java.util.HashMap) ListIntygEntry(se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry) NotifiedState(se.inera.intyg.webcert.web.web.controller.api.dto.NotifiedState) Test(org.junit.Test) BaseRestIntegrationTest(se.inera.intyg.webcert.web.web.controller.integrationtest.BaseRestIntegrationTest)

Aggregations

HashMap (java.util.HashMap)1 Test (org.junit.Test)1 ListIntygEntry (se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry)1 NotifiedState (se.inera.intyg.webcert.web.web.controller.api.dto.NotifiedState)1 BaseRestIntegrationTest (se.inera.intyg.webcert.web.web.controller.integrationtest.BaseRestIntegrationTest)1