1
0
mirror of https://github.com/pcvolkmer/etl-processor.git synced 2025-04-19 17:26:51 +00:00

test: explicit request URI check and fix use of expect()

This commit is contained in:
Paul-Christian Volkmer 2025-02-09 11:19:35 +01:00
parent 74ff9f08a4
commit 1e652a7856

View File

@ -59,10 +59,10 @@ class RestMtbFileSenderTest {
@ParameterizedTest @ParameterizedTest
@MethodSource("deleteRequestWithResponseSource") @MethodSource("deleteRequestWithResponseSource")
fun shouldReturnExpectedResponseForDelete(requestWithResponse: RequestWithResponse) { fun shouldReturnExpectedResponseForDelete(requestWithResponse: RequestWithResponse) {
this.mockRestServiceServer.expect { this.mockRestServiceServer
method(HttpMethod.DELETE) .expect(method(HttpMethod.DELETE))
requestTo("/mtbfile") .andExpect(requestTo("http://localhost:9000/mtbfile/Patient/$TEST_PATIENT_PSEUDONYM"))
}.andRespond { .andRespond {
withStatus(requestWithResponse.httpStatus).body(requestWithResponse.body).createResponse(it) withStatus(requestWithResponse.httpStatus).body(requestWithResponse.body).createResponse(it)
} }
@ -74,10 +74,10 @@ class RestMtbFileSenderTest {
@ParameterizedTest @ParameterizedTest
@MethodSource("mtbFileRequestWithResponseSource") @MethodSource("mtbFileRequestWithResponseSource")
fun shouldReturnExpectedResponseForMtbFilePost(requestWithResponse: RequestWithResponse) { fun shouldReturnExpectedResponseForMtbFilePost(requestWithResponse: RequestWithResponse) {
this.mockRestServiceServer.expect { this.mockRestServiceServer
method(HttpMethod.POST) .expect(method(HttpMethod.POST))
requestTo("/mtbfile") .andExpect(requestTo("http://localhost:9000/mtbfile/MTBFile"))
}.andRespond { .andRespond {
withStatus(requestWithResponse.httpStatus).body(requestWithResponse.body).createResponse(it) withStatus(requestWithResponse.httpStatus).body(requestWithResponse.body).createResponse(it)
} }
@ -103,10 +103,10 @@ class RestMtbFileSenderTest {
else -> ExpectedCount.max(3) else -> ExpectedCount.max(3)
} }
this.mockRestServiceServer.expect(expectedCount) { this.mockRestServiceServer
method(HttpMethod.POST) .expect(expectedCount, method(HttpMethod.POST))
requestTo("/mtbfile") .andExpect(requestTo("http://localhost:9000/mtbfile/MTBFile"))
}.andRespond { .andRespond {
withStatus(requestWithResponse.httpStatus).body(requestWithResponse.body).createResponse(it) withStatus(requestWithResponse.httpStatus).body(requestWithResponse.body).createResponse(it)
} }
@ -132,10 +132,10 @@ class RestMtbFileSenderTest {
else -> ExpectedCount.max(3) else -> ExpectedCount.max(3)
} }
this.mockRestServiceServer.expect(expectedCount) { this.mockRestServiceServer
method(HttpMethod.DELETE) .expect(expectedCount, method(HttpMethod.DELETE))
requestTo("/mtbfile") .andExpect(requestTo("http://localhost:9000/mtbfile/Patient/$TEST_PATIENT_PSEUDONYM"))
}.andRespond { .andRespond {
withStatus(requestWithResponse.httpStatus).body(requestWithResponse.body).createResponse(it) withStatus(requestWithResponse.httpStatus).body(requestWithResponse.body).createResponse(it)
} }