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());
}
Aggregations