/**
   * Test the casting of a JSON object array.
   *
   * <p>This test asserts that a the class of a elements of the cast JSON object matches the class
   * provided to the cast element method.
   */
  @Test
  public void testCastElement() {
    JsonObjectArray<JsonObject> testJsonObjectArray =
        this.createJsonObjectArray(this.createUnderlyingJsonArray());
    JsonObjectArray<CastJsonObject> testCastJsonObjectArray =
        testJsonObjectArray.castElement(CastJsonObject.class);

    assertEquals(testJsonObjectArray, testCastJsonObjectArray);

    testJsonObjectArray.set(0, this.createJsonObject(this.createUnderlyingJsonObject()));

    assertTrue(
        "testCastJsonObjectArray[0] !instanceof " + CastJsonObject.class.getName(),
        testCastJsonObjectArray.get(0) instanceof CastJsonObject);
  }
  /**
   * Test the retrieval of an element of the array.
   *
   * <p>This test asserts that the retrieved elements are the same as the elements at the
   * corresponding index of the underlying array.
   */
  @Test
  @SuppressWarnings("unchecked")
  public void testGet() {
    JsonObject[] jsonObjects = this.createJsonObjects(5);

    J array = this.createUnderlyingJsonArray();

    for (int i = 0; i < 5; i++) {
      this.setObjectElement(array, i, (J) jsonObjects[i].getObject());
    }

    JsonObjectArray<JsonObject> testJsonObjectArray = this.createJsonObjectArray(array);

    assertEquals("testJsonBooleanArray.length", 5, testJsonObjectArray.getLength());
    for (int i = 0; i < 5; i++) {
      assertEquals("testJsonBooleanArray[" + i + "]", jsonObjects[i], testJsonObjectArray.get(i));
    }
  }