@Test
public void generateProperGraphQLQueryForWellbore() throws Exception {

    final String variablesNodeName = "variables";
    final String queryNodeName = "query";
    final String wellboreArgNodeName = "wellboreArgument";
    final String wellboreOpenQuery = "wellboreOpenQuery1411.xml";
    JSONObject wellboreQueryFields = new JSONObject();
    // Get what is expected from the resource...
    String queryString = TestUtilities.getResourceAsString(wellboreOpenQuery);
    ObjWellbores queryObject = WitsmlMarshal.deserialize(queryString, ObjWellbores.class);
    ObjWellbore singularObject = queryObject.getWellbore().get(0);
    JSONObject wellboreJson = new JSONObject(singularObject.getJSONString("1.4.1.1"));
    // Get what the code-under-test produces...
    GraphQLQueryConverter converter = new GraphQLQueryConverter();
    String graphQLQuery = converter.getQuery(singularObject);
    // Perform the tests...
    // 1st: check that the query was produced...
    assertNotNull(graphQLQuery);
    // 2nd: Check if the produced JSON contains all of the populated query fields
    //      from the Resource and build wellbore query fields dynamically ...
    checkNbuildQuery("uid", wellboreJson, graphQLQuery, wellboreQueryFields );
    checkNbuildQuery("uidWell", wellboreJson, graphQLQuery, wellboreQueryFields );
    checkNbuildQuery("name", wellboreJson, graphQLQuery, wellboreQueryFields );
    checkNbuildQuery("nameWell", wellboreJson, graphQLQuery, wellboreQueryFields );
    // 3rd: Create comparable object (to perform an apples-to-apples comparison) & then
    //      perform a deep comparison of the json values...
    JSONObject comparable = new JSONObject();
    comparable.put( queryNodeName, GraphQLQueryConstants.WELLBORE_QUERY );
    // build variables section
    JSONObject variables = new JSONObject();
    variables.put( wellboreArgNodeName, wellboreQueryFields );
    comparable.put( variablesNodeName, variables );
    String comparableToString = comparable.toString(2);
    ObjectMapper om = new ObjectMapper();
    Map<String, Object> producedMap = (Map<String, Object>) (om.readValue(graphQLQuery, Map.class));
    Map<String, Object> expectedMap = (Map<String, Object>) (om.readValue(comparableToString, Map.class));
    assertEquals( producedMap, expectedMap );
}