@Test
  public void fromFuncWithInvalidParameterType_throwsIllegalArgumentException()
      throws NoSuchMethodException {
    Method function =
        FunctionDeclarationMakerTest.class.getMethod("functionWithInvalidType", Object.class);

    IllegalArgumentException thrown =
        assertThrows(
            IllegalArgumentException.class,
            () -> FunctionDeclarationMaker.fromFunc(FUNCTION_DESCRIPTION, function, "objectParam"));
    assertThat(thrown)
        .hasMessageThat()
        .isEqualTo(
            "Unsupported parameter type " + Object.class.getName() + " for parameter objectParam");
  }
A function with invalid parameter type to test fromFunc.
java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/generativeai/FunctionDeclarationMakerTest.java