assertThat((String) result, is("a-b-c"));
}
@Test
public void check_varags_only() throws Throwable {
CallSite concat = MethodInvocationSupport.bootstrap(lookup(), "defaultConcat", methodType(Object.class, Object.class, Object.class, Object.class, Object.class), 0);
VarargsChecking receiver = varargsChecking();
Object result = concat.dynamicInvoker().invokeWithArguments(receiver, "a", "b", "c");
assertThat(result, notNullValue());
assertThat(result, instanceOf(String.class));
assertThat((String) result, is("a-b-c"));
concat = MethodInvocationSupport.bootstrap(lookup(), "defaultConcat", methodType(Object.class, Object.class, Object.class), 0);
result = concat.dynamicInvoker().invokeWithArguments(receiver, new String[]{"a", "b", "c"});
assertThat(result, notNullValue());
assertThat(result, instanceOf(String.class));
assertThat((String) result, is("a-b-c"));
concat = MethodInvocationSupport.bootstrap(lookup(), "defaultConcat", methodType(Object.class, Object.class, Object.class), 0);
receiver = varargsChecking();
assertThat((String) concat.dynamicInvoker().invokeWithArguments(receiver, "a"), is("a"));
concat = MethodInvocationSupport.bootstrap(lookup(), "defaultConcat", methodType(Object.class, Object.class), 0);
receiver = varargsChecking();
assertThat((String) concat.dynamicInvoker().invokeWithArguments(receiver), is(""));
}