-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor unit tests in MedicationRequestMapperTests
to use nested classes.
#869
Conversation
ce439a8
to
5922501
Compare
…lassed for the grouped tests for `acute` and `repeat` when two `ehrSupplyPrescribe` reference one `ehrSupplyAuthorise`.
5922501
to
a84c330
Compare
@DisplayName("WhenTwoEhrSupplyPrescribeReferenceOneRepeatEhrSupplyAuthorise") | ||
class TwoEhrSupplyPrescribeReferenceOneRepeatEhrSupplyAuthorise { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the display is only 4 characters different to the class name, what was the thinking for using DisplayName?
); | ||
} | ||
assertAll( | ||
() -> assertThat(planMedicationRequests).as("Plans").hasSize(1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This as
is new to me. Like a whole new junit
.
.mapResources(ehrExtract, (Patient) new Patient().setId(PATIENT_ID), List.of(), PRACTISE_CODE); | ||
@Nested() | ||
@DisplayName("WhenTwoEhrSupplyPrescribeReferenceOneAcuteEhrSupplyAuthorise") | ||
class TwoEhrSupplyPrescribeReferenceOneAcuteEhrSupplyAuthorise { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar DisplayName thing here, but it's not major.
@BeforeAll | ||
static void beforeAll() { | ||
ehrExtract = unmarshallEhrExtract( | ||
"ehrExtract_MultipleSupplyPrescribeInFulfilmentOfSingleNonAcuteSupplyAuthorise.xml" | ||
); | ||
} | ||
|
||
var earliestOrder = getMedicationRequestById(resources, EARLIEST_ORDER_ID); | ||
@BeforeEach | ||
void beforeEach() { | ||
setupMultipleOrdersToOnePlanStubs(REPEAT_PRESCRIPTION_EXTENSION); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor, but I've never really understood the benefit of beforeAll
, unless the setup is actually very slow and there is a performance benefit. Otherwise it just mildly hampers the readability.
What
Refactor unit tests in
MedicationRequestMapperTests
to use nested classes for the grouped tests foracute
andrepeat
when twoehrSupplyPrescribe
reference oneehrSupplyAuthorise
.Why
Refactoring to group similar tests into nested test classes for readability and to allow more descriptive test names
Type of change
Please delete options that are not relevant.
Checklist: