File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
service/src/test/java/uk/nhs/adaptors/gp2gp/ehr/mapper Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1313import org .mockito .junit .jupiter .MockitoSettings ;
1414import org .mockito .quality .Strictness ;
1515import java .util .Optional ;
16+
17+ import static org .junit .Assert .assertFalse ;
1618import static org .junit .Assert .assertTrue ;
1719import static org .mockito .ArgumentMatchers .any ;
1820import static org .mockito .Mockito .when ;
@@ -72,4 +74,18 @@ void When_ReferencedResourceHasNotBeenMapped_Expect_MapMedicationRequest() {
7274 assertTrue (result );
7375 }
7476
77+ @ Test
78+ void When_ReferencedResourceHasBeenMapped_Expect_MedicationRequestIsNotMapped () {
79+
80+ MedicationRequest medRequest = new MedicationRequest ();
81+ medRequest .setId ("MedicationRequest/1" );
82+ medRequest .addBasedOn (new Reference ("ServiceRequest/123" ));
83+ when (inputBundleHolder .getResource (new IdType ("ServiceRequest/123" ))).thenReturn (Optional .empty ());
84+ when (idMapper .hasIdBeenMapped (any (), any ())).thenReturn (true );
85+
86+ boolean result = resourceMapper .shouldMapResource (medRequest );
87+
88+ assertFalse (result );
89+ }
90+
7591}
You can’t perform that action at this time.
0 commit comments