@Test
  public void fromFuncWithInstanceMethod_throwsIllegalArgumentException()
      throws NoSuchMethodException {
    Method function = FunctionDeclarationMakerTest.class.getMethod("instanceMethod", String.class);

    IllegalArgumentException thrown =
        assertThrows(
            IllegalArgumentException.class,
            () ->
                FunctionDeclarationMaker.fromFunc(
                    FUNCTION_DESCRIPTION, function, STRING_PARAM_NAME));
    assertThat(thrown)
        .hasMessageThat()
        .isEqualTo("Instance methods are not supported. Please use static methods.");
  }
A function with invalid parameter type to test fromFunc.
java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/generativeai/FunctionDeclarationMakerTest.java