-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PRMT-3523] Dependency injected for PdsAdaptorService
- Loading branch information
1 parent
31846d7
commit b898583
Showing
12 changed files
with
87 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/uk/nhs/prm/e2etests/exception/InvalidPdsAdaptorUsernameException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package uk.nhs.prm.e2etests.exception; | ||
|
||
public class InvalidPdsAdaptorUsernameException extends RuntimeException { | ||
private static final String MESSAGE = "The given PDS Adaptor username was invalid, details: %s"; | ||
|
||
public InvalidPdsAdaptorUsernameException(String details) { | ||
super(String.format(MESSAGE, details)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 25 additions & 10 deletions
35
src/main/java/uk/nhs/prm/e2etests/service/PdsAdaptorService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 8 additions & 17 deletions
25
...uk/nhs/prm/e2etests/live_technical_test/repo/ValidateSyntheticPatientIsSuspendedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,40 @@ | ||
package uk.nhs.prm.e2etests.live_technical_test.repo; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestInstance; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import uk.nhs.prm.e2etests.property.PdsAdaptorProperties; | ||
import org.springframework.test.context.TestPropertySource; | ||
import uk.nhs.prm.e2etests.model.response.PdsAdaptorResponse; | ||
import uk.nhs.prm.e2etests.live_technical_test.TestParameters; | ||
import uk.nhs.prm.e2etests.live_technical_test.helpers.TestPatientValidator; | ||
import uk.nhs.prm.e2etests.service.PdsAdaptorService; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@SpringBootTest | ||
@TestPropertySource(properties = {"test.pds.username=live-test"}) | ||
@TestInstance(TestInstance.Lifecycle.PER_CLASS) | ||
class ValidateSyntheticPatientIsSuspendedTest { | ||
|
||
private final TestPatientValidator patientValidator; | ||
private final String pdsAdaptorApiKey; | ||
private final String pdsAdaptorUrl; | ||
private static final String PDS_ADAPTOR_TEST_USERNAME = "live-test"; | ||
private PdsAdaptorService pdsAdaptorService; | ||
private final PdsAdaptorService pdsAdaptorService; | ||
|
||
@Autowired | ||
public ValidateSyntheticPatientIsSuspendedTest( | ||
TestPatientValidator testPatientValidator, | ||
PdsAdaptorProperties pdsAdaptorProperties | ||
PdsAdaptorService pdsAdaptorService | ||
) { | ||
patientValidator = testPatientValidator; | ||
pdsAdaptorApiKey = pdsAdaptorProperties.getLiveTestApiKey(); | ||
pdsAdaptorUrl = pdsAdaptorProperties.getPdsAdaptorUrl(); | ||
} | ||
|
||
// TODO: PRMT-3523 @TestPropertySource(properties = {"PDS_ADAPTOR_TEST_USERNAME = live-test", apiKey = something}) could be useful. | ||
@BeforeEach | ||
void setUp() { | ||
pdsAdaptorService = new PdsAdaptorService(PDS_ADAPTOR_TEST_USERNAME, pdsAdaptorApiKey, pdsAdaptorUrl); | ||
this.pdsAdaptorService = pdsAdaptorService; | ||
} | ||
|
||
@Test | ||
void shouldUpdateMofToRepoAndSuccessfullyRetrieveEhrFromPreviousPractise() { | ||
var testPatientNhsNumber = TestParameters.fetchTestParameter("LIVE_TECHNICAL_TEST_NHS_NUMBER"); | ||
String testPatientNhsNumber = TestParameters.fetchTestParameter("LIVE_TECHNICAL_TEST_NHS_NUMBER"); | ||
assertThat(patientValidator.isIncludedInTheTest(testPatientNhsNumber)).isTrue(); | ||
|
||
var pdsResponse = pdsAdaptorService.getSuspendedPatientStatus(testPatientNhsNumber); | ||
PdsAdaptorResponse pdsResponse = pdsAdaptorService.getSuspendedPatientStatus(testPatientNhsNumber); | ||
assertThat(pdsResponse.getIsSuspended()).as("patient status should be suspended").isTrue(); | ||
} | ||
} |
Oops, something went wrong.