diff --git a/src/main/java/app/coronawarn/verification/controller/ExternalTestStateController.java b/src/main/java/app/coronawarn/verification/controller/ExternalTestStateController.java index 43100216..98dfc75e 100644 --- a/src/main/java/app/coronawarn/verification/controller/ExternalTestStateController.java +++ b/src/main/java/app/coronawarn/verification/controller/ExternalTestStateController.java @@ -115,7 +115,7 @@ public DeferredResult> getTestState( log.info("The result for registration token based on hashed Guid will be returned."); stopWatch.stop(); fakeDelayService.updateFakeTestRequestDelay(stopWatch.getTotalTimeMillis()); - deferredResult.setResult(ResponseEntity.ok(generateReturnTestResult(testResult.getTestResult(),fake, + deferredResult.setResult(ResponseEntity.ok(generateReturnTestResult(testResult.getTestResult(), testResult.getSc()))); return deferredResult; case TELETAN: @@ -123,7 +123,7 @@ public DeferredResult> getTestState( stopWatch.stop(); fakeDelayService.updateFakeTestRequestDelay(stopWatch.getTotalTimeMillis()); scheduledExecutor.schedule(() -> deferredResult.setResult(ResponseEntity.ok( - generateReturnTestResult(LabTestResult.POSITIVE.getTestResult(), fake, + generateReturnTestResult(LabTestResult.POSITIVE.getTestResult(), appSession.get().getCreatedAt().toEpochSecond(ZoneOffset.UTC)))), fakeDelayService.realDelayTest(), MILLISECONDS); return deferredResult; @@ -138,12 +138,7 @@ public DeferredResult> getTestState( "Returning the test result for the registration token failed"); } - private TestResult generateReturnTestResult(Integer testResult, String fake, Long cs) { - if (fake == null) { - return new TestResult(testResult,cs, RandomStringUtils.randomAlphanumeric(RESPONSE_PADDING_LENGTH)); - } - return new TestResult(testResult, LocalDateTime.now().toEpochSecond(ZoneOffset.UTC), - RandomStringUtils.randomAlphanumeric(RESPONSE_PADDING_LENGTH)); + private TestResult generateReturnTestResult(Integer testResult, Long sc) { + return new TestResult(testResult,sc, RandomStringUtils.randomAlphanumeric(RESPONSE_PADDING_LENGTH)); } - }