@Test
  public void fromJsonStringWithInvalidType_throwsInvalidProtocolBufferException()
      throws InvalidProtocolBufferException {
    // Here we use "parameter" (singular) instead of "parameters"
    String jsonString =
        "{\n"
            + " \"name\": \"functionName\",\n"
            + " \"parameter\": {\n"
            + "   \"type\": \"OBJECT\", \n"
            + "   \"properties\": {\n"
            + "     \"param1\": {\n"
            + "       \"type\": \"STRING\",\n"
            + "       \"description\": \"param1Description\"\n"
            + "     }\n"
            + "   }\n"
            + " }\n"
            + "}";
    assertThrows(
        InvalidProtocolBufferException.class,
        () -> FunctionDeclarationMaker.fromJsonString(jsonString));
  }
A function with invalid parameter type to test fromFunc.
java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/generativeai/FunctionDeclarationMakerTest.java