summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorPaul-Christian Volkmer2023-08-11 09:22:54 +0200
committerGitHub2023-08-11 09:22:54 +0200
commit6ecb439007b4fa6dec9af1e0334b89fd235a97be (patch)
treed6d6b63f4e75e56f062619e458bb77914a6c68f4 /src/test
parentcb9c5904729c90b86357d0668604b74f4f4e61f7 (diff)
Issue #3: Detect the request type of request with last known status (#5)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/kotlin/dev/dnpm/etl/processor/services/RequestProcessorTest.kt8
-rw-r--r--src/test/kotlin/dev/dnpm/etl/processor/services/RequestServiceTest.kt58
2 files changed, 43 insertions, 23 deletions
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/services/RequestProcessorTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/services/RequestProcessorTest.kt
index f9d8182..7856833 100644
--- a/src/test/kotlin/dev/dnpm/etl/processor/services/RequestProcessorTest.kt
+++ b/src/test/kotlin/dev/dnpm/etl/processor/services/RequestProcessorTest.kt
@@ -92,7 +92,7 @@ class RequestProcessorTest {
doAnswer {
false
- }.`when`(requestService).isLastRequestDeletion(anyString())
+ }.`when`(requestService).isLastRequestWithKnownStatusDeletion(anyString())
doAnswer {
it.arguments[0] as String
@@ -147,7 +147,7 @@ class RequestProcessorTest {
doAnswer {
false
- }.`when`(requestService).isLastRequestDeletion(anyString())
+ }.`when`(requestService).isLastRequestWithKnownStatusDeletion(anyString())
doAnswer {
it.arguments[0] as String
@@ -202,7 +202,7 @@ class RequestProcessorTest {
doAnswer {
false
- }.`when`(requestService).isLastRequestDeletion(anyString())
+ }.`when`(requestService).isLastRequestWithKnownStatusDeletion(anyString())
doAnswer {
MtbFileSender.Response(status = RequestStatus.SUCCESS)
@@ -261,7 +261,7 @@ class RequestProcessorTest {
doAnswer {
false
- }.`when`(requestService).isLastRequestDeletion(anyString())
+ }.`when`(requestService).isLastRequestWithKnownStatusDeletion(anyString())
doAnswer {
MtbFileSender.Response(status = RequestStatus.ERROR)
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/services/RequestServiceTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/services/RequestServiceTest.kt
index 3e0a979..3cf8804 100644
--- a/src/test/kotlin/dev/dnpm/etl/processor/services/RequestServiceTest.kt
+++ b/src/test/kotlin/dev/dnpm/etl/processor/services/RequestServiceTest.kt
@@ -68,23 +68,33 @@ class RequestServiceTest {
patientId = "TEST_12345678901",
pid = "P1",
fingerprint = "0123456789abcdef1",
+ type = RequestType.MTB_FILE,
+ status = RequestStatus.WARNING,
+ processedAt = Instant.parse("2023-07-07T00:00:00Z")
+ ),
+ Request(
+ id = 2L,
+ uuid = UUID.randomUUID().toString(),
+ patientId = "TEST_12345678901",
+ pid = "P1",
+ fingerprint = "0123456789abcdefd",
type = RequestType.DELETE,
- status = RequestStatus.SUCCESS,
- processedAt = Instant.parse("2023-08-08T02:00:00Z")
+ status = RequestStatus.WARNING,
+ processedAt = Instant.parse("2023-07-07T02:00:00Z")
),
Request(
- id = 1L,
+ id = 3L,
uuid = UUID.randomUUID().toString(),
- patientId = "TEST_12345678902",
- pid = "P2",
- fingerprint = "0123456789abcdef2",
+ patientId = "TEST_12345678901",
+ pid = "P1",
+ fingerprint = "0123456789abcdef1",
type = RequestType.MTB_FILE,
- status = RequestStatus.WARNING,
- processedAt = Instant.parse("2023-08-08T00:00:00Z")
+ status = RequestStatus.UNKNOWN,
+ processedAt = Instant.parse("2023-08-11T00:00:00Z")
)
)
- val actual = RequestService.isLastRequestDeletion(requests)
+ val actual = RequestService.isLastRequestWithKnownStatusDeletion(requests)
assertThat(actual).isTrue()
}
@@ -98,23 +108,33 @@ class RequestServiceTest {
patientId = "TEST_12345678901",
pid = "P1",
fingerprint = "0123456789abcdef1",
- type = RequestType.DELETE,
- status = RequestStatus.SUCCESS,
- processedAt = Instant.parse("2023-07-07T02:00:00Z")
+ type = RequestType.MTB_FILE,
+ status = RequestStatus.WARNING,
+ processedAt = Instant.parse("2023-07-07T00:00:00Z")
),
Request(
- id = 1L,
+ id = 2L,
uuid = UUID.randomUUID().toString(),
- patientId = "TEST_12345678902",
- pid = "P2",
- fingerprint = "0123456789abcdef2",
+ patientId = "TEST_12345678901",
+ pid = "P1",
+ fingerprint = "0123456789abcdef1",
type = RequestType.MTB_FILE,
status = RequestStatus.WARNING,
- processedAt = Instant.parse("2023-08-08T00:00:00Z")
+ processedAt = Instant.parse("2023-07-07T02:00:00Z")
+ ),
+ Request(
+ id = 3L,
+ uuid = UUID.randomUUID().toString(),
+ patientId = "TEST_12345678901",
+ pid = "P1",
+ fingerprint = "0123456789abcdef1",
+ type = RequestType.MTB_FILE,
+ status = RequestStatus.UNKNOWN,
+ processedAt = Instant.parse("2023-08-11T00:00:00Z")
)
)
- val actual = RequestService.isLastRequestDeletion(requests)
+ val actual = RequestService.isLastRequestWithKnownStatusDeletion(requests)
assertThat(actual).isFalse()
}
@@ -197,7 +217,7 @@ class RequestServiceTest {
@Test
fun isLastRequestDeletionShouldRequestAllRequestsForPatientPseudonym() {
- requestService.isLastRequestDeletion("TEST_12345678901")
+ requestService.isLastRequestWithKnownStatusDeletion("TEST_12345678901")
verify(requestRepository, times(1)).findAllByPatientIdOrderByProcessedAtDesc(anyString())
}