@@ -325,6 +325,39 @@ void testActuatorEndpointExists(String endpoint) throws IOException, URISyntaxEx
325
325
326
326
}
327
327
328
+ @ Test
329
+ void testDiffOperationIsRegistered () {
330
+ String methodName = "testDiff" ;
331
+ ourLog .info ("Entering " + methodName + "()..." );
332
+
333
+ Patient pt = new Patient ();
334
+ pt .setActive (true );
335
+ pt .getBirthDateElement ().setValueAsString ("2020-01-01" );
336
+ pt .addIdentifier ().setSystem ("http://foo" ).setValue ("12345" );
337
+ pt .addName ().setFamily (methodName );
338
+ IIdType id = ourClient .create ().resource (pt ).execute ().getId ();
339
+
340
+ //now update the patient
341
+ pt .setId (id );
342
+ pt .getBirthDateElement ().setValueAsString ("2025-01-01" );
343
+ ourClient .update ().resource (pt ).execute ();
344
+
345
+ //now try a diff
346
+ Parameters outParams = ourClient .operation ().onInstance (id ).named ("$diff" ).withNoParameters (Parameters .class ).execute ();
347
+ ourLog .trace ("Params->\n {}" , ourCtx .newJsonParser ().setPrettyPrint (true ).encodeResourceToString (outParams ));
348
+ boolean foundDobChange = false ;
349
+ //really, if we get a response at all, then the Diff worked, but we'll check the contents here anyway for good measure to see that our change is reflected
350
+ for (Parameters .ParametersParameterComponent ppc : outParams .getParameter () ) {
351
+ for (Parameters .ParametersParameterComponent ppc2 : ppc .getPart () ) {
352
+ if ( "Patient.birthDate" .equals (ppc2 .getValue ().toString ()) ){
353
+ foundDobChange = true ;
354
+ break ;
355
+ }
356
+ }
357
+ }
358
+ assertTrue (foundDobChange );
359
+ }
360
+
328
361
@ BeforeEach
329
362
void beforeEach () {
330
363
@@ -338,4 +371,5 @@ void beforeEach() {
338
371
// return activeSubscriptionCount() == 2; // 2 subscription based on mdm-rules.json
339
372
//});
340
373
}
374
+
341
375
}
0 commit comments