Skip to content

Commit

Permalink
added more test for patientService and patientTypeService
Browse files Browse the repository at this point in the history
  • Loading branch information
josephbate committed Nov 6, 2024
1 parent 456259d commit a218619
Show file tree
Hide file tree
Showing 4 changed files with 227 additions and 453 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ public PatientType readPatientType(String idString) {
public List<PatientType> getPatientTypes(String description) throws LIMSRuntimeException {
List<PatientType> list = new Vector<>();
try {
String sql = "from patientType l where upper(l.description) like upper(:param) order by"
+ " upper(l.description)";
String sql = "from PatientType l where upper(l.description) like upper(:param) order by upper(l.description)";
org.hibernate.query.Query query = entityManager.unwrap(Session.class).createQuery(sql);
query.setParameter("param", description + "%");

Expand Down
47 changes: 40 additions & 7 deletions src/test/java/org/openelisglobal/AppTestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
import static org.mockito.Mockito.mock;

import com.fasterxml.jackson.annotation.JsonInclude;

import ca.uhn.fhir.context.FhirContext;

import java.util.ArrayList;
import java.util.List;
import lombok.NonNull;

import org.apache.http.impl.client.CloseableHttpClient;
import org.openelisglobal.audittrail.dao.AuditTrailService;
import org.openelisglobal.common.services.IStatusService;
import org.openelisglobal.common.util.Versioning;
import org.openelisglobal.dataexchange.fhir.FhirConfig;
import org.openelisglobal.dataexchange.fhir.FhirUtil;
import org.openelisglobal.dataexchange.fhir.service.FhirPersistanceService;
import org.openelisglobal.dataexchange.fhir.service.FhirTransformService;
import org.openelisglobal.dataexchange.service.order.ElectronicOrderService;
import org.openelisglobal.externalconnections.service.BasicAuthenticationDataService;
import org.openelisglobal.externalconnections.service.ExternalConnectionService;
Expand Down Expand Up @@ -77,9 +85,10 @@
"org.openelisglobal.view", "org.openelisglobal.search.service", "org.openelisglobal.sample",
"org.openelisglobal.sampleitem.", "org.openelisglobal.analysis", "org.openelisglobal.result.service",
"org.openelisglobal.result.daoimpl", "org.openelisglobal.resultlimit", "org.openelisglobal.resultlimits",
"org.openelisglobal.typeoftestresult", "org.openelisglobal.samplehuman",
"org.openelisglobal.typeoftestresult", "org.openelisglobal.samplehuman", "org.openelisglobal.provider",
"org.openelisglobal.role", }, excludeFilters = {
@ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openelisglobal.patient.controller.*"),
@ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openelisglobal.provider.controller.*"),
@ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openelisglobal.sample.controller.*"),
@ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openelisglobal.dictionary.controller.*.java"),
@ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openelisglobal.config.*"),
Expand All @@ -95,6 +104,36 @@ public FhirPersistanceService fhirPesistence() {
return mock(FhirPersistanceService.class);
}

@Bean()
@Profile("test")
public FhirUtil fhirUtil() {
return mock(FhirUtil.class);
}

@Bean()
@Profile("test")
public FhirConfig fhirConfig() {
return mock(FhirConfig.class);
}

@Bean()
@Profile("test")
public CloseableHttpClient closeableHttpClient() {
return mock(CloseableHttpClient.class);
}

@Bean()
@Profile("test")
public FhirContext fhirContext() {
return mock(FhirContext.class);
}

@Bean()
@Profile("test")
public FhirTransformService fhirTransformServicehirTransformService() {
return mock(FhirTransformService.class);
}

@Bean()
@Profile("test")
public LocalizationServiceImpl localise() {
Expand Down Expand Up @@ -167,12 +206,6 @@ public TestSectionService testSectionService() {
return mock(TestSectionService.class);
}

@Bean()
@Profile("test")
public ProviderService providerService() {
return mock(ProviderService.class);
}

@Bean()
@Profile("test")
public UserRoleService userRoleService() {
Expand Down
Loading

0 comments on commit a218619

Please sign in to comment.