/**
   * Queries for an existing FICR Coverage Extension Request Pharmacy message then modifies and
   * commits several changes.
   *
   * @throws IOException
   */
  public void testUpdate() throws IOException {
    QPaymentRequest query = QPaymentRequest.newQuery();
    query.select(query.wildcard()).select(query.reasonOf().invoiceElementGroup().wildcard());

    query.where(
        query
            .classCode()
            .eq("XACT")
            .and(query.moodCode().eq("PRP").and(query.amt().eq(this.amount))));

    DataGraph[] results = this.service.find(query);
    assertTrue(results != null);
    assertTrue(results.length == 1);

    PaymentRequest paymentRequest = (PaymentRequest) results[0].getRootObject();
    assertTrue(paymentRequest.getAmt() == this.amount);

    PaymentRequestReason requestReason = paymentRequest.getReasonOf();
    assertTrue(requestReason != null);
    requestReason.getInvoiceElementGroup().setConfidentialityCode("Y");

    this.service.commit(paymentRequest.getDataGraph(), USERNAME);

    results = this.service.find(query);
    assertTrue(results != null);
    assertTrue(results.length == 1);
    requestReason = paymentRequest.getReasonOf();
    assertTrue(requestReason != null);
    assertTrue("Y".equals(requestReason.getInvoiceElementGroup().getConfidentialityCode()));
  }
  /**
   * Queries for an existing FICR Coverage Extension Request Pharmacy message
   *
   * @throws IOException
   */
  public void testQuery() throws IOException {
    QPaymentRequest request = QPaymentRequest.newQuery();
    request
        .select(request.wildcard())
        .select(request.primaryPerformer().wildcard())
        .select(request.primaryPerformer().contactParty().wildcard())
        .select(request.primaryPerformer().contactParty().contactPerson().wildcard())
        .select(request.reasonOf().wildcard())
        .select(request.reasonOf().invoiceElementGroup().wildcard());

    request.where(
        request
            .classCode()
            .eq("XACT")
            .and(request.moodCode().eq("PRP").and(request.amt().eq(this.amount))));

    DataGraph[] results = this.service.find(request);
    assertTrue(results != null);
    for (DataGraph graph : results) {
      String xml = this.serializeGraph(graph);
      // log.info(xml);
    }

    assertTrue(results.length == 1);

    PaymentRequest paymentRequest = (PaymentRequest) results[0].getRootObject();
    assertTrue(paymentRequest.getAmt() == this.amount);
  }