diff --git a/.github/workflows/ci-dependency-check.yml b/.github/workflows/ci-dependency-check.yml index 8734fef..a538b40 100644 --- a/.github/workflows/ci-dependency-check.yml +++ b/.github/workflows/ci-dependency-check.yml @@ -30,3 +30,5 @@ jobs: mvn dependency-check:check --batch-mode --file ./pom.xml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci-master.yml b/.github/workflows/ci-master.yml index 41a2b71..a8b2dae 100644 --- a/.github/workflows/ci-master.yml +++ b/.github/workflows/ci-master.yml @@ -31,6 +31,8 @@ jobs: echo "VERSION=${VERSION}" >> $GITHUB_ENV - name: mvn version run: mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${VERSION} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: mvn deploy run: mvn --batch-mode deploy env: diff --git a/.github/workflows/ci-pull-request.yml b/.github/workflows/ci-pull-request.yml index 1ed8614..be6453a 100644 --- a/.github/workflows/ci-pull-request.yml +++ b/.github/workflows/ci-pull-request.yml @@ -24,5 +24,7 @@ jobs: java-version: 11 - name: mvn package run: mvn --batch-mode package + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: docker build run: docker build . diff --git a/pom.xml b/pom.xml index 0d3c5fb..2129483 100644 --- a/pom.xml +++ b/pom.xml @@ -3,13 +3,19 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - app.coronawarn.testresult cwa-testresult-server 1.4.5-SNAPSHOT jar + + app.coronawarn + cwa-parent + 1.2 + + + cwa-testresult-server - CWA testresult server project. + CWA Testresult server project. https://www.coronawarn.app/ @@ -23,319 +29,77 @@ - - 11 - 11 - 11 - - UTF-8 - UTF-8 - - 2.6.6 - 2021.0.1 - 1.18.22 - 4.9.1 - 1.6.6 - 31.0.1-jre - 2.1.210 - 4.33.0 - 1.3.8 - - 3.1.2 - 3.6.1.1688 - 0.8.7 - 6.5.3 - - **/config/*,**/exception/*,**/entity/*,**/model/* + + **/config/*, + **/exception/*, + **/entity/*, + **/model/* + - - - - org.springframework.boot - spring-boot-dependencies - ${spring.boot.version} - pom - import - - - org.springframework.cloud - spring-cloud-dependencies - ${spring.cloud.version} - pom - import - - - org.projectlombok - lombok - ${lombok.version} - - - org.springdoc - springdoc-openapi-ui - ${springdoc.version} - - - org.liquibase - liquibase-core - ${liquibase.version} - - - - github https://maven.pkg.github.com/corona-warn-app/cwa-testresult-server + + + github + https://maven.pkg.github.com/corona-warn-app/cwa-verification-server + + - org.springframework.boot - spring-boot-starter - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.boot - spring-boot-starter-validation - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.hibernate - hibernate-core - - - - - org.hibernate - hibernate-core - 5.6.5.Final - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.cloud - spring-cloud-starter-bootstrap - - - org.springframework.cloud - spring-cloud-starter-vault-config - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - com.google.guava - guava - - - commons-io - commons-io - - + app.coronawarn + cwa-parent-spring-boot + ${project.parent.version} + pom - commons-io - commons-io - 2.11.0 + app.coronawarn + cwa-parent-validation + ${project.parent.version} + pom - org.springframework.cloud - spring-cloud-starter-sleuth + app.coronawarn + cwa-parent-feign + ${project.parent.version} + pom - com.google.guava - guava - ${guava.version} + app.coronawarn + cwa-parent-psql-persistence + ${project.parent.version} + pom - org.projectlombok - lombok - provided - - - org.springdoc - springdoc-openapi-ui - - - org.liquibase - liquibase-core - - - io.micrometer - micrometer-core - - - io.micrometer - micrometer-registry-prometheus - - - com.h2database - h2 - runtime - ${h2.version} - - - org.postgresql - postgresql - runtime - - - org.springframework.boot - spring-boot-starter-test - test - - - junit - junit - test - - - io.reactivex - rxjava - ${rx.version} - - - net.javacrumbs.shedlock - shedlock-spring - ${shedlock.version} - - - net.javacrumbs.shedlock - shedlock-provider-jdbc-template - ${shedlock.version} + app.coronawarn + cwa-parent-shedlock + ${project.parent.version} + pom - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring.boot.version} - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${plugin.checkstyle.version} - - - org.sonarsource.scanner.maven - sonar-maven-plugin - ${plugin.sonar.version} - - - org.jacoco - jacoco-maven-plugin - ${plugin.jacoco.version} - - - - - org.owasp - dependency-check-maven - ${owasp.version} - - ./owasp/suppressions.xml - true - - org.springframework.boot spring-boot-maven-plugin - - - pre-integration-test - - start - - - - post-integration-test - - stop - - - - - repackage - build-info - - - org.springdoc springdoc-openapi-maven-plugin - 1.0 - - - integration-test - - generate - - - - - http://localhost:8080/api/docs - openapi.json - org.apache.maven.plugins maven-checkstyle-plugin - - codestyle/checkstyle.xml - target/**/* - UTF-8 - true - true - warning - true - false - - - - validate - validate - - check - - - org.jacoco jacoco-maven-plugin - - - - prepare-agent - - - - report - - report - - - diff --git a/src/test/java/app/coronawarn/testresult/TestResultCleanupTest.java b/src/test/java/app/coronawarn/testresult/TestResultCleanupTest.java index f9dd1b7..e064e47 100644 --- a/src/test/java/app/coronawarn/testresult/TestResultCleanupTest.java +++ b/src/test/java/app/coronawarn/testresult/TestResultCleanupTest.java @@ -26,18 +26,13 @@ import java.time.Period; import java.time.temporal.ChronoUnit; import java.util.Optional; -import java.util.concurrent.TimeUnit; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; -import rx.Single; -@RunWith(SpringRunner.class) @SpringBootTest( properties = { "testresult.cleanup.redeem.days=21", @@ -52,7 +47,10 @@ public class TestResultCleanupTest { @Autowired private TestResultRepository testResultRepository; - @Before + @Autowired + private TestResultCleanup testResultCleanup; + + @BeforeEach public void before() { testResultRepository.deleteAll(); } @@ -74,24 +72,25 @@ public void shouldCleanupRedeem() { ); create.setCreatedAt(createdAt); testResultRepository.save(create); - Assert.assertNotNull(create); - Assert.assertEquals(createdAt, create.getCreatedAt()); - Assert.assertEquals(resultId, create.getResultId()); + Assertions.assertNotNull(create); + Assertions.assertEquals(createdAt, create.getCreatedAt()); + Assertions.assertEquals(resultId, create.getResultId()); // find Optional find = testResultRepository.findByResultId(resultId); - Assert.assertTrue(find.isPresent()); - Assert.assertEquals(resultId, find.get().getResultId()); - Assert.assertEquals( + Assertions.assertTrue(find.isPresent()); + Assertions.assertEquals(resultId, find.get().getResultId()); + Assertions.assertEquals( createdAt.truncatedTo(ChronoUnit.MILLIS), find.get().getCreatedAt().truncatedTo(ChronoUnit.MILLIS)); - Assert.assertEquals( + Assertions.assertEquals( resultDate.truncatedTo(ChronoUnit.MILLIS), find.get().getResultDate().truncatedTo(ChronoUnit.MILLIS)); - // wait - Single.fromCallable(() -> true).delay(2, TimeUnit.SECONDS).toBlocking().value(); + // manually trigger cleanup + testResultCleanup.redeem(); + testResultCleanup.delete(); // find find = testResultRepository.findByResultId(resultId); - Assert.assertTrue(find.isPresent()); - Assert.assertEquals(resultId, find.get().getResultId()); - Assert.assertEquals(resultRedeemed, find.get().getResult()); + Assertions.assertTrue(find.isPresent()); + Assertions.assertEquals(resultId, find.get().getResultId()); + Assertions.assertEquals(resultRedeemed, find.get().getResult()); } @Test @@ -110,21 +109,22 @@ public void shouldCleanupDelete() { ); create.setCreatedAt(createdAt); testResultRepository.save(create); - Assert.assertNotNull(create); - Assert.assertEquals(createdAt, create.getCreatedAt()); - Assert.assertEquals(resultId, create.getResultId()); + Assertions.assertNotNull(create); + Assertions.assertEquals(createdAt, create.getCreatedAt()); + Assertions.assertEquals(resultId, create.getResultId()); // find Optional find = testResultRepository.findByResultId(resultId); - Assert.assertTrue(find.isPresent()); - Assert.assertEquals(resultId, find.get().getResultId()); - Assert.assertEquals( + Assertions.assertTrue(find.isPresent()); + Assertions.assertEquals(resultId, find.get().getResultId()); + Assertions.assertEquals( createdAt.truncatedTo(ChronoUnit.MILLIS), find.get().getCreatedAt().truncatedTo(ChronoUnit.MILLIS)); - Assert.assertEquals( + Assertions.assertEquals( resultDate.truncatedTo(ChronoUnit.MILLIS), find.get().getResultDate().truncatedTo(ChronoUnit.MILLIS)); - // wait - Single.fromCallable(() -> true).delay(2, TimeUnit.SECONDS).toBlocking().value(); + // manually trigger cleanup + testResultCleanup.redeem(); + testResultCleanup.delete(); // find find = testResultRepository.findByResultId(resultId); - Assert.assertFalse(find.isPresent()); + Assertions.assertFalse(find.isPresent()); } } diff --git a/src/test/java/app/coronawarn/testresult/TestResultControllerTest.java b/src/test/java/app/coronawarn/testresult/TestResultControllerTest.java index 82bfaf3..35a8654 100644 --- a/src/test/java/app/coronawarn/testresult/TestResultControllerTest.java +++ b/src/test/java/app/coronawarn/testresult/TestResultControllerTest.java @@ -24,25 +24,28 @@ import static org.hamcrest.Matchers.is; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import app.coronawarn.testresult.model.*; +import app.coronawarn.testresult.model.PocNatResult; +import app.coronawarn.testresult.model.PocNatResultList; +import app.coronawarn.testresult.model.QuickTestResult; +import app.coronawarn.testresult.model.QuickTestResultList; +import app.coronawarn.testresult.model.TestResult; +import app.coronawarn.testresult.model.TestResultList; +import app.coronawarn.testresult.model.TestResultRequest; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Collections; import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultHandlers; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -@RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc @ContextConfiguration(classes = TestResultApplication.class) @@ -55,7 +58,7 @@ public class TestResultControllerTest { @Autowired private TestResultRepository testResultRepository; - @Before + @BeforeEach public void before() { testResultRepository.deleteAll(); } diff --git a/src/test/java/app/coronawarn/testresult/TestResultRepositoryTest.java b/src/test/java/app/coronawarn/testresult/TestResultRepositoryTest.java index 03db4fa..4412b5a 100644 --- a/src/test/java/app/coronawarn/testresult/TestResultRepositoryTest.java +++ b/src/test/java/app/coronawarn/testresult/TestResultRepositoryTest.java @@ -25,16 +25,14 @@ import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.Optional; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; -@RunWith(SpringRunner.class) @SpringBootTest @ContextConfiguration(classes = TestResultApplication.class) public class TestResultRepositoryTest { @@ -42,7 +40,7 @@ public class TestResultRepositoryTest { @Autowired private TestResultRepository testResultRepository; - @Before + @BeforeEach public void before() { testResultRepository.deleteAll(); } @@ -59,18 +57,18 @@ public void createAndFindByResultId() { .setResultId(resultId) .setResultDate(resultDate) ); - Assert.assertNotNull(create); - Assert.assertEquals(resultId, create.getResultId()); + Assertions.assertNotNull(create); + Assertions.assertEquals(resultId, create.getResultId()); // find Optional find = testResultRepository.findByResultId(resultId); - Assert.assertTrue(find.isPresent()); - Assert.assertEquals(result, find.get().getResult()); - Assert.assertEquals(resultId, find.get().getResultId()); - Assert.assertEquals( + Assertions.assertTrue(find.isPresent()); + Assertions.assertEquals(result, find.get().getResult()); + Assertions.assertEquals(resultId, find.get().getResultId()); + Assertions.assertEquals( resultDate.truncatedTo(ChronoUnit.MILLIS), find.get().getResultDate().truncatedTo(ChronoUnit.MILLIS)); - Assert.assertNotNull(find.get().getCreatedAt()); - Assert.assertNotNull(find.get().getUpdatedAt()); - Assert.assertNotNull(find.get().getVersion()); + Assertions.assertNotNull(find.get().getCreatedAt()); + Assertions.assertNotNull(find.get().getUpdatedAt()); + Assertions.assertNotNull(find.get().getVersion()); } } diff --git a/src/test/java/app/coronawarn/testresult/TestResultServiceTest.java b/src/test/java/app/coronawarn/testresult/TestResultServiceTest.java index bcc3db8..a9fcf17 100644 --- a/src/test/java/app/coronawarn/testresult/TestResultServiceTest.java +++ b/src/test/java/app/coronawarn/testresult/TestResultServiceTest.java @@ -27,10 +27,9 @@ import app.coronawarn.testresult.model.TestResult; import app.coronawarn.testresult.model.TestType; import app.coronawarn.testresult.service.TestResultService; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; @@ -39,7 +38,6 @@ import java.time.Instant; -@RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc @ContextConfiguration(classes = TestResultApplication.class) @@ -50,7 +48,7 @@ public class TestResultServiceTest { @Autowired private TestResultRepository testResultRepository; - @Before + @BeforeEach public void before() { testResultRepository.deleteAll(); } @@ -67,16 +65,16 @@ public void toEntityAndToModel() { .setLabId(labId) .setResult(result); TestResultEntity entity = testResultService.toEntity(model); - Assert.assertNotNull(entity); - Assert.assertEquals(id, entity.getResultId()); - Assert.assertEquals(result, entity.getResult()); - Assert.assertEquals(labId, entity.getLabId()); + Assertions.assertNotNull(entity); + Assertions.assertEquals(id, entity.getResultId()); + Assertions.assertEquals(result, entity.getResult()); + Assertions.assertEquals(labId, entity.getLabId()); // to model model = testResultService.toModel(entity); - Assert.assertNotNull(model); - Assert.assertEquals(id, model.getId()); - Assert.assertEquals(result, model.getResult()); - Assert.assertEquals(labId, model.getLabId()); + Assertions.assertNotNull(model); + Assertions.assertEquals(id, model.getId()); + Assertions.assertEquals(result, model.getResult()); + Assertions.assertEquals(labId, model.getLabId()); } @Test @@ -91,14 +89,14 @@ public void insertOrUpdate() { .setLabId(labId); // create create = testResultService.createOrUpdate(create); - Assert.assertNotNull(create); - Assert.assertEquals(result, create.getResult()); - Assert.assertEquals(labId, create.getLabId()); + Assertions.assertNotNull(create); + Assertions.assertEquals(result, create.getResult()); + Assertions.assertEquals(labId, create.getLabId()); // get TestResult get = testResultService.getOrCreate(id, TestType.PCR, 0L); - Assert.assertNotNull(get); - Assert.assertEquals(result, get.getResult()); - Assert.assertEquals(labId, get.getLabId()); + Assertions.assertNotNull(get); + Assertions.assertEquals(result, get.getResult()); + Assertions.assertEquals(labId, get.getLabId()); } @Test @@ -114,14 +112,14 @@ public void insertAndUpdate() { .setLabId(labId); // create create = testResultService.createOrUpdate(create); - Assert.assertNotNull(create); - Assert.assertEquals(resultCreate, create.getResult()); - Assert.assertEquals(labId, create.getLabId()); + Assertions.assertNotNull(create); + Assertions.assertEquals(resultCreate, create.getResult()); + Assertions.assertEquals(labId, create.getLabId()); // get TestResult get = testResultService.getOrCreate(id, TestType.PCR, 0L); - Assert.assertNotNull(get); - Assert.assertEquals(resultCreate, get.getResult()); - Assert.assertEquals(labId, get.getLabId()); + Assertions.assertNotNull(get); + Assertions.assertEquals(resultCreate, get.getResult()); + Assertions.assertEquals(labId, get.getLabId()); // update TestResult update = new TestResult() .setId(id) @@ -129,14 +127,14 @@ public void insertAndUpdate() { .setLabId(labId) .setSc(Instant.now().getEpochSecond()); update = testResultService.createOrUpdate(update); - Assert.assertNotNull(update); - Assert.assertEquals(resultUpdate, update.getResult()); - Assert.assertEquals(labId, update.getLabId()); + Assertions.assertNotNull(update); + Assertions.assertEquals(resultUpdate, update.getResult()); + Assertions.assertEquals(labId, update.getLabId()); // get get = testResultService.getOrCreate(id, TestType.PCR, 0L); - Assert.assertNotNull(get); - Assert.assertEquals(resultUpdate, get.getResult()); - Assert.assertEquals(labId, get.getLabId()); + Assertions.assertNotNull(get); + Assertions.assertEquals(resultUpdate, get.getResult()); + Assertions.assertEquals(labId, get.getLabId()); } @Test @@ -146,23 +144,23 @@ public void getOrCreate() { Integer result = 0; // get TestResult get = testResultService.getOrCreate(id, TestType.PCR, 0L); - Assert.assertNotNull(get); - Assert.assertEquals(result, get.getResult()); - Assert.assertNull(get.getLabId()); + Assertions.assertNotNull(get); + Assertions.assertEquals(result, get.getResult()); + Assertions.assertNull(get.getLabId()); id = "b".repeat(64); result = 5; get = testResultService.getOrCreate(id, TestType.QUICKTEST, null); - Assert.assertNotNull(get); - Assert.assertEquals(result, get.getResult()); - Assert.assertNull(get.getLabId()); + Assertions.assertNotNull(get); + Assertions.assertEquals(result, get.getResult()); + Assertions.assertNull(get.getLabId()); id = "c".repeat(64); result = 10; get = testResultService.getOrCreate(id, TestType.POCNAT, 0L); - Assert.assertNotNull(get); - Assert.assertEquals(result, get.getResult()); - Assert.assertNull(get.getLabId()); + Assertions.assertNotNull(get); + Assertions.assertEquals(result, get.getResult()); + Assertions.assertNull(get.getLabId()); } @Test @@ -176,8 +174,8 @@ public void createAndDenyRedeemedUpdate() { .setResult(resultCreate); // create create = testResultService.createOrUpdate(create); - Assert.assertNotNull(create); - Assert.assertEquals(resultCreate, create.getResult()); + Assertions.assertNotNull(create); + Assertions.assertEquals(resultCreate, create.getResult()); // redeem testResultRepository.findByResultId(id) .ifPresent(u -> testResultRepository.save(u @@ -187,31 +185,31 @@ public void createAndDenyRedeemedUpdate() { .setId(id) .setResult(resultUpdate); update = testResultService.createOrUpdate(update); - Assert.assertNotNull(update); - Assert.assertNotEquals(resultUpdate, update.getResult()); + Assertions.assertNotNull(update); + Assertions.assertNotEquals(resultUpdate, update.getResult()); } @Test public void conversionCheckIsPocNat() { - Assert.assertEquals(TestResultEntity.Result.PENDING.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POCNAT_PENDING.ordinal())); - Assert.assertEquals(TestResultEntity.Result.REDEEMED.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POCNAT_REDEEMED.ordinal())); - Assert.assertEquals(TestResultEntity.Result.INVALID.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POCNAT_INVALID.ordinal())); - Assert.assertEquals(TestResultEntity.Result.NEGATIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POCNAT_NEGATIVE.ordinal())); - Assert.assertEquals(TestResultEntity.Result.POSITIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POCNAT_POSITIVE.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.PENDING.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POCNAT_PENDING.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.REDEEMED.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POCNAT_REDEEMED.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.INVALID.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POCNAT_INVALID.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.NEGATIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POCNAT_NEGATIVE.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.POSITIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POCNAT_POSITIVE.ordinal())); } @Test public void conversionCheckNotPocNat() { - Assert.assertEquals(TestResultEntity.Result.PENDING.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.PENDING.ordinal())); - Assert.assertEquals(TestResultEntity.Result.REDEEMED.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.REDEEMED.ordinal())); - Assert.assertEquals(TestResultEntity.Result.INVALID.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.INVALID.ordinal())); - Assert.assertEquals(TestResultEntity.Result.NEGATIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.NEGATIVE.ordinal())); - Assert.assertEquals(TestResultEntity.Result.POSITIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POSITIVE.ordinal())); - Assert.assertEquals(TestResultEntity.Result.QUICK_PENDING.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.QUICK_PENDING.ordinal())); - Assert.assertEquals(TestResultEntity.Result.QUICK_REDEEMED.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.QUICK_REDEEMED.ordinal())); - Assert.assertEquals(TestResultEntity.Result.QUICK_INVALID.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.QUICK_INVALID.ordinal())); - Assert.assertEquals(TestResultEntity.Result.QUICK_NEGATIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.QUICK_NEGATIVE.ordinal())); - Assert.assertEquals(TestResultEntity.Result.QUICK_POSITIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.QUICK_POSITIVE.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.PENDING.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.PENDING.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.REDEEMED.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.REDEEMED.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.INVALID.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.INVALID.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.NEGATIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.NEGATIVE.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.POSITIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.POSITIVE.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.QUICK_PENDING.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.QUICK_PENDING.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.QUICK_REDEEMED.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.QUICK_REDEEMED.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.QUICK_INVALID.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.QUICK_INVALID.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.QUICK_NEGATIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.QUICK_NEGATIVE.ordinal())); + Assertions.assertEquals(TestResultEntity.Result.QUICK_POSITIVE.ordinal(), (int) testResultService.conversionCheck(TestResultEntity.Result.QUICK_POSITIVE.ordinal())); } @Test @@ -223,9 +221,9 @@ public void convertQuickTest() { quicktest.setSc(Instant.now().getEpochSecond()); TestResult result = testResultService.convertQuickTest(quicktest,"TestId"); - Assert.assertEquals(quicktest.getResult(), result.getResult()); - Assert.assertEquals(quicktest.getSc(), result.getSc()); - Assert.assertNotEquals(quicktest.getId(), result.getId()); + Assertions.assertEquals(quicktest.getResult(), result.getResult()); + Assertions.assertEquals(quicktest.getSc(), result.getSc()); + Assertions.assertNotEquals(quicktest.getId(), result.getId()); } @Test @@ -237,8 +235,8 @@ public void convertPocNat() { pocnat.setSc(Instant.now().getEpochSecond()); TestResult result = testResultService.convertPocNat(pocnat,"TestId"); - Assert.assertEquals(pocnat.getResult(), result.getResult()); - Assert.assertEquals(pocnat.getSc(), result.getSc()); - Assert.assertNotEquals(pocnat.getId(), result.getId()); + Assertions.assertEquals(pocnat.getResult(), result.getResult()); + Assertions.assertEquals(pocnat.getSc(), result.getSc()); + Assertions.assertNotEquals(pocnat.getId(), result.getId()); } }