Skip to content

Commit 6cbbb84

Browse files
BAH-2711 | Fixed test failures
1 parent f029f66 commit 6cbbb84

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

.github/workflows/build_and_upload.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
push:
88
branches:
99
- master
10-
- BAH-2711
1110
workflow_dispatch:
1211
env:
1312
ORG_NAME: BahmniIndiaDistro

omod/src/test/java/org/bahmni/module/hip/web/controller/PatientControllerTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.openmrs.module.webservices.rest.web.RestConstants;
1818
import org.springframework.beans.factory.annotation.Autowired;
1919
import org.springframework.http.MediaType;
20-
import org.springframework.http.ResponseEntity;
2120
import org.springframework.test.context.ContextConfiguration;
2221
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
2322
import org.springframework.test.context.web.WebAppConfiguration;
@@ -27,6 +26,7 @@
2726
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
2827
import org.springframework.web.context.WebApplicationContext;
2928

29+
import javax.servlet.http.Cookie;
3030
import java.util.ArrayList;
3131
import java.util.Collections;
3232
import java.util.HashSet;
@@ -68,7 +68,7 @@ public void shouldReturn200OKWhenMatchingPatientFound() throws Exception {
6868
ExistingPatient existingPatient = new ExistingPatient("sam tom", "35", "null, null", "M", "3f81c3b4-04fc-4311-9b50-b863fbe023dc", "9123456780");
6969
when(existingPatientService.getMatchingPatients("+91-9876543210"))
7070
.thenReturn(new ArrayList<>());
71-
when(existingPatientService.getMatchingPatients(anyString(), anyInt(), anyString()))
71+
when(existingPatientService.getMatchingPatients(anyString(),anyString(), anyInt(), anyString()))
7272
.thenReturn(patients);
7373
when(existingPatientService.getMatchingPatientDetails(new HashSet<>(patients)))
7474
.thenReturn(Collections.singletonList(existingPatient));
@@ -78,6 +78,7 @@ public void shouldReturn200OKWhenMatchingPatientFound() throws Exception {
7878
.param("patientYearOfBirth", "1985")
7979
.param("patientGender", "M")
8080
.param("phoneNumber", "+91-9876543210")
81+
.cookie(new Cookie("bahmni.user.location", "{\"name\":\"General Ward\",\"uuid\":\"baf7bd38-d225-11e4-9c67-080027b662ec\"}"))
8182
.accept(MediaType.APPLICATION_JSON))
8283
.andExpect(status().isOk());
8384
}
@@ -87,14 +88,15 @@ public void shouldReturnNoRecordsWhenNoMatchingPatientFound() throws Exception {
8788
List<Patient> patients = new ArrayList<>();
8889
when(existingPatientService.getMatchingPatients("+91-9876543210"))
8990
.thenReturn(new ArrayList<>());
90-
when(existingPatientService.getMatchingPatients(anyString(), anyInt(), anyString()))
91+
when(existingPatientService.getMatchingPatients(anyString(),anyString(), anyInt(), anyString()))
9192
.thenReturn(patients);
9293

9394
MvcResult mvcResult = mockMvc.perform(get(String.format("/rest/%s/hip/existingPatients", RestConstants.VERSION_1))
9495
.param("patientName", "sam tom")
9596
.param("patientYearOfBirth", "1985")
9697
.param("patientGender", "M")
9798
.param("phoneNumber", "+91-9876543210")
99+
.cookie(new Cookie("bahmni.user.location", "{\"name\":\"General Ward\",\"uuid\":\"baf7bd38-d225-11e4-9c67-080027b662ec\"}"))
98100
.accept(MediaType.APPLICATION_JSON))
99101
.andReturn();
100102

0 commit comments

Comments
 (0)