@Test
  public void fromValidJsonStringTested_returnsFunctionDeclaration()
      throws InvalidProtocolBufferException {
    String jsonString =
        "{\n"
            + " \"name\": \"functionName\",\n"
            + " \"description\": \"functionDescription\",\n"
            + " \"parameters\": {\n"
            + "   \"type\": \"OBJECT\", \n"
            + "   \"properties\": {\n"
            + "     \"stringParam\": {\n"
            + "       \"type\": \"STRING\",\n"
            + "       \"description\": \"stringParam\"\n"
            + "     },\n"
            + "     \"integerParam\": {\n"
            + "       \"type\": \"INTEGER\",\n"
            + "       \"description\": \"integerParam\"\n"
            + "     },\n"
            + "     \"doubleParam\": {\n"
            + "       \"type\": \"NUMBER\",\n"
            + "       \"description\": \"doubleParam\"\n"
            + "     },\n"
            + "     \"floatParam\": {\n"
            + "       \"type\": \"NUMBER\",\n"
            + "       \"description\": \"floatParam\"\n"
            + "     },\n"
            + "     \"booleanParam\": {\n"
            + "       \"type\": \"BOOLEAN\",\n"
            + "       \"description\": \"booleanParam\"\n"
            + "     }\n"
            + "   },\n"
            + "   \"required\": [\"stringParam\", \"integerParam\", \"doubleParam\","
            + " \"floatParam\", \"booleanParam\"]\n"
            + " }\n"
            + "}";

    FunctionDeclaration functionDeclaration = FunctionDeclarationMaker.fromJsonString(jsonString);

    assertThat(functionDeclaration).isEqualTo(EXPECTED_FUNCTION_DECLARATION);
  }
A function with invalid parameter type to test fromFunc.
java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/generativeai/FunctionDeclarationMakerTest.java