Skip to content

Commit

Permalink
Test cased added
Browse files Browse the repository at this point in the history
  • Loading branch information
mohit10696 committed Nov 25, 2024
1 parent c5f4a76 commit bf6f09f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/org/isf/medtype/TestMedicalType.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}
19 changes: 19 additions & 0 deletions src/test/java/org/isf/medtype/Tests.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<MedicalType> medicalTypes = medicalTypeIoOperation.getMedicalTypesNotDeleted();
assertThat(medicalTypes.get(medicalTypes.size() - 1).getDescription()).isEqualTo(foundMedicalType.getDescription());
}

@Test
void testIoUpdateMedicalType() throws Exception {
String code = setupTestMedicalType(false);
Expand Down Expand Up @@ -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<MedicalType> medicalTypes = medicalTypeBrowserManager.getAllActiveMedicalType();
assertThat(medicalTypes.get(medicalTypes.size() - 1).getDescription()).isEqualTo(foundMedicalType.getDescription());
}

@Test
void testMgrUpdateMedicalType() throws Exception {
String code = setupTestMedicalType(false);
Expand Down

0 comments on commit bf6f09f

Please sign in to comment.