Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 8c613c4

Browse files
SORMAS-Foundation#3599 update data dictionary, user rights, External Journal test
1 parent 5960311 commit 8c613c4

4 files changed

Lines changed: 8 additions & 12 deletions

File tree

305 Bytes
Binary file not shown.
15 Bytes
Binary file not shown.

sormas-backend/src/main/java/de/symeda/sormas/backend/externaljournal/ExternalJournalService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public Optional<PatientDiaryPersonDto> getPatientDiaryPerson(String personUuid)
301301
* the person to register as a patient in CLIMEDO
302302
* @return true if the registration was successful, false otherwise
303303
*/
304-
public PatientDiaryRegisterResult registerPatientDiaryPerson(de.symeda.sormas.api.person.PersonDto person) {
304+
public PatientDiaryRegisterResult registerPatientDiaryPerson(PersonDto person) {
305305
try {
306306
Invocation.Builder invocationBuilder = getExternalDataPersonInvocationBuilder(person.getUuid());
307307
Response response = invocationBuilder.post(Entity.json(""));
@@ -338,7 +338,7 @@ private Invocation.Builder getExternalDataPersonInvocationBuilder(String personU
338338
* the person to validate
339339
* @return the result of the validation
340340
*/
341-
public ExternalJournalValidation validatePatientDiaryPerson(de.symeda.sormas.api.person.PersonDto person) {
341+
public ExternalJournalValidation validatePatientDiaryPerson(PersonDto person) {
342342
EnumSet<PatientDiaryValidationError> validationErrors = EnumSet.noneOf(PatientDiaryValidationError.class);
343343

344344
String email = person.getEmailAddress();
@@ -385,7 +385,7 @@ public ExternalJournalValidation validatePatientDiaryPerson(de.symeda.sormas.api
385385
return new ExternalJournalValidation(validationErrors.isEmpty(), getValidationMessage(validationErrors));
386386
}
387387

388-
private boolean isEmailAvailable(de.symeda.sormas.api.person.PersonDto person) {
388+
private boolean isEmailAvailable(PersonDto person) {
389389
PatientDiaryQueryResponse response = queryPatientDiary(EMAIL_QUERY_PARAM, person.getEmailAddress())
390390
.orElseThrow(() -> new RuntimeException("Could not query patient diary for Email address availability"));
391391
boolean notUsed = response.getCount() == 0;
@@ -398,7 +398,7 @@ private boolean isEmailAvailable(de.symeda.sormas.api.person.PersonDto person) {
398398
return notUsed || samePerson;
399399
}
400400

401-
private boolean isPhoneAvailable(de.symeda.sormas.api.person.PersonDto person, String phone) {
401+
private boolean isPhoneAvailable(PersonDto person, String phone) {
402402
PatientDiaryQueryResponse response = queryPatientDiary(MOBILE_PHONE_QUERY_PARAM, phone)
403403
.orElseThrow(() -> new RuntimeException("Could not query patient diary for phone number availability"));
404404
boolean notUsed = response.getCount() == 0;

sormas-backend/src/test/java/de/symeda/sormas/backend/externaljournal/ExternalJournalServiceTest.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010

1111
import org.junit.Before;
1212
import org.junit.Test;
13+
import org.mockito.Mockito;
1314
import org.mockito.MockitoAnnotations;
1415
import org.mockito.Spy;
1516

1617
import java.lang.reflect.InvocationTargetException;
1718
import java.lang.reflect.Method;
19+
import java.util.Collections;
1820
import java.util.HashMap;
1921
import java.util.Map;
2022
import java.util.Optional;
@@ -33,14 +35,8 @@ public void setUp() {
3335
MockitoAnnotations.initMocks(this);
3436
PatientDiaryQueryResponse queryResponse = new PatientDiaryQueryResponse();
3537
queryResponse.setCount(0);
36-
doReturn(Optional.ofNullable(queryResponse)).when(externalJournalService).queryPatientDiary("Email", "[email protected]");
37-
doReturn(Optional.ofNullable(queryResponse)).when(externalJournalService).queryPatientDiary("Email", "test@test");
38-
doReturn(Optional.ofNullable(queryResponse)).when(externalJournalService).queryPatientDiary("Email", "[email protected]");
39-
doReturn(Optional.ofNullable(queryResponse)).when(externalJournalService)
40-
.queryPatientDiary("Mobile phone", "+49 621 1218490");
41-
doReturn(Optional.ofNullable(queryResponse)).when(externalJournalService)
42-
.queryPatientDiary("Mobile phone", "+49 621 1218491");
43-
doReturn(Optional.ofNullable(queryResponse)).when(externalJournalService).queryPatientDiary("Mobile phone", "0");;
38+
queryResponse.setResults(Collections.emptyList());
39+
doReturn(Optional.of(queryResponse)).when(externalJournalService).queryPatientDiary(Mockito.any(String.class), Mockito.any(String.class));
4440
}
4541

4642
@Test

0 commit comments

Comments
 (0)