From bf6f09f2b32720efb81e478e99efcc954f3be72d Mon Sep 17 00:00:00 2001 From: Mohit Rajeshkumar Sojitra Date: Mon, 25 Nov 2024 09:40:53 -0400 Subject: [PATCH] Test cased added --- .../MedicalTypeIoOperationRepository.java | 2 -- .../java/org/isf/medtype/TestMedicalType.java | 3 +++ src/test/java/org/isf/medtype/Tests.java | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/isf/medtype/service/MedicalTypeIoOperationRepository.java b/src/main/java/org/isf/medtype/service/MedicalTypeIoOperationRepository.java index ec2d306cd..99f1a10f5 100644 --- a/src/main/java/org/isf/medtype/service/MedicalTypeIoOperationRepository.java +++ b/src/main/java/org/isf/medtype/service/MedicalTypeIoOperationRepository.java @@ -25,9 +25,7 @@ import org.isf.medtype.model.MedicalType; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; @Repository diff --git a/src/test/java/org/isf/medtype/TestMedicalType.java b/src/test/java/org/isf/medtype/TestMedicalType.java index 54d8f4cdd..5c0d81b78 100644 --- a/src/test/java/org/isf/medtype/TestMedicalType.java +++ b/src/test/java/org/isf/medtype/TestMedicalType.java @@ -30,6 +30,7 @@ public class TestMedicalType { private String code = "Z"; private String description = "TestDescription"; + private char deleted = 'N'; public MedicalType setup(boolean usingSet) throws OHException { MedicalType medicalType; @@ -48,10 +49,12 @@ public MedicalType setup(boolean usingSet) throws OHException { public void setParameters(MedicalType medicalType) { medicalType.setCode(code); medicalType.setDescription(description); + medicalType.setDeleted(deleted); } public void check(MedicalType medicalType) { assertThat(medicalType.getCode()).isEqualTo(code); assertThat(medicalType.getDescription()).isEqualTo(description); + assertThat(medicalType.getDeleted()).isEqualTo(deleted); } } diff --git a/src/test/java/org/isf/medtype/Tests.java b/src/test/java/org/isf/medtype/Tests.java index 6983a20ff..a2f9f5a45 100644 --- a/src/test/java/org/isf/medtype/Tests.java +++ b/src/test/java/org/isf/medtype/Tests.java @@ -34,6 +34,7 @@ import org.isf.utils.exception.OHDataIntegrityViolationException; import org.isf.utils.exception.OHDataValidationException; import org.isf.utils.exception.OHException; +import org.isf.utils.exception.OHServiceException; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -81,6 +82,15 @@ void testIoGetMedicalType() throws Exception { assertThat(medicalTypes.get(medicalTypes.size() - 1).getDescription()).isEqualTo(foundMedicalType.getDescription()); } + @Test + void testIoGetAllActiveMedicalType() throws Exception { + String code = setupTestMedicalType(false); + MedicalType foundMedicalType = medicalTypeIoOperationRepository.findById(code).orElse(null); + assertThat(foundMedicalType).isNotNull(); + List medicalTypes = medicalTypeIoOperation.getMedicalTypesNotDeleted(); + assertThat(medicalTypes.get(medicalTypes.size() - 1).getDescription()).isEqualTo(foundMedicalType.getDescription()); + } + @Test void testIoUpdateMedicalType() throws Exception { String code = setupTestMedicalType(false); @@ -125,6 +135,15 @@ void testMgrGetMedicalType() throws Exception { assertThat(medicalTypes.get(medicalTypes.size() - 1).getDescription()).isEqualTo(foundMedicalType.getDescription()); } + @Test + void testMgrGetAllActiveMedicalType() throws Exception { + String code = setupTestMedicalType(false); + MedicalType foundMedicalType = medicalTypeIoOperationRepository.findById(code).orElse(null); + assertThat(foundMedicalType).isNotNull(); + List medicalTypes = medicalTypeBrowserManager.getAllActiveMedicalType(); + assertThat(medicalTypes.get(medicalTypes.size() - 1).getDescription()).isEqualTo(foundMedicalType.getDescription()); + } + @Test void testMgrUpdateMedicalType() throws Exception { String code = setupTestMedicalType(false);