From a1ffe0d1c3b3b6ec4285a97626e120df63c3b97c Mon Sep 17 00:00:00 2001 From: James Date: Tue, 31 Oct 2017 20:55:36 -0400 Subject: [PATCH] Sort methods --- .../ca/uhn/fhir/util/GraphQLEngineTest.java | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java index 573f6e0e324..32267a6a2d9 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java @@ -24,10 +24,36 @@ public class GraphQLEngineTest { private static FhirContext ourCtx; private org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(GraphQLEngineTest.class); - @BeforeClass - public static void beforeClass() { - ourCtx = FhirContext.forR4(); - ourWorkerCtx = new HapiWorkerContext(ourCtx, new DefaultProfileValidationSupport()); + private Observation createObservation() { + Observation obs = new Observation(); + obs.setId("http://foo.com/Patient/PATA"); + obs.setValue(new Quantity().setValue(123).setUnit("cm")); + obs.setSubject(new Reference("Patient/123")); + return obs; + } + + private IGraphQLStorageServices createStorageServices() throws FHIRException { + IGraphQLStorageServices retVal = mock(IGraphQLStorageServices.class); + when(retVal.lookup(any(Object.class), any(Resource.class), any(Reference.class))).thenAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) throws Throwable { + Object appInfo = invocation.getArguments()[0]; + Resource context = (Resource) invocation.getArguments()[1]; + Reference reference = (Reference) invocation.getArguments()[2]; + ourLog.info("AppInfo: {} / Context: {} / Reference: {}", appInfo, context.getId(), reference.getReference()); + + if (reference.getReference().equalsIgnoreCase("Patient/123")) { + Patient p = new Patient(); + p.getBirthDateElement().setValueAsString("2011-02-22"); + return new ReferenceResolution<>(context, p); + } + + ourLog.info("Not found!"); + return null; + } + }); + + return retVal; } @Test @@ -54,14 +80,6 @@ public class GraphQLEngineTest { } - private Observation createObservation() { - Observation obs = new Observation(); - obs.setId("http://foo.com/Patient/PATA"); - obs.setValue(new Quantity().setValue(123).setUnit("cm")); - obs.setSubject(new Reference("Patient/123")); - return obs; - } - @Test public void testReferences() throws EGraphQLException, EGraphEngine, IOException, FHIRException { @@ -99,28 +117,10 @@ public class GraphQLEngineTest { } - private IGraphQLStorageServices createStorageServices() throws FHIRException { - IGraphQLStorageServices retVal = mock(IGraphQLStorageServices.class); - when(retVal.lookup(any(Object.class), any(Resource.class), any(Reference.class))).thenAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocation) throws Throwable { - Object appInfo = invocation.getArguments()[0]; - Resource context = (Resource) invocation.getArguments()[1]; - Reference reference = (Reference) invocation.getArguments()[2]; - ourLog.info("AppInfo: {} / Context: {} / Reference: {}", appInfo, context.getId(), reference.getReference()); - - if (reference.getReference().equalsIgnoreCase("Patient/123")) { - Patient p = new Patient(); - p.getBirthDateElement().setValueAsString("2011-02-22"); - return new ReferenceResolution<>(context, p); - } - - ourLog.info("Not found!"); - return null; - } - }); - - return retVal; + @BeforeClass + public static void beforeClass() { + ourCtx = FhirContext.forR4(); + ourWorkerCtx = new HapiWorkerContext(ourCtx, new DefaultProfileValidationSupport()); } }