@Test
  public void fromJsonStringNameMissing_throwsIllegalArgumentException()
      throws InvalidProtocolBufferException {
    String jsonString =
        "{\n"
            + " \"description\": \"functionDescription\",\n"
            + " \"parameters\": {\n"
            + "   \"type\": \"OBJECT\", \n"
            + "   \"properties\": {\n"
            + "     \"param1\": {\n"
            + "       \"type\": \"STRING\",\n"
            + "       \"description\": \"param1Description\"\n"
            + "     }\n"
            + "   }\n"
            + " }\n"
            + "}";

    IllegalArgumentException thrown =
        assertThrows(
            IllegalArgumentException.class,
            () -> FunctionDeclarationMaker.fromJsonString(jsonString));
    assertThat(thrown).hasMessageThat().isEqualTo("name field must be present.");
  }
A function with invalid parameter type to test fromFunc.
java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/generativeai/FunctionDeclarationMakerTest.java