### Question:
FormulaFunctions { public static FormulaFunction findFirstMatch(List<Object> arguments, Collection<FormulaFunction> formulaFunctions) { for (FormulaFunction formulaFunction : formulaFunctions) { if (matchArgumentTypes(arguments, formulaFunction, true)) { return formulaFunction; } } return null; }  static boolean matchArgumentTypes(List<Object> arguments, FormulaFunction function); static boolean matchArgumentTypes(List<Object> arguments, FormulaFunction function, boolean allowNull); static boolean matchArgumentCount(int nArguments, FormulaFunction function); static FormulaFunction findFirstMatch(List<Object> arguments, Collection<FormulaFunction> formulaFunctions); static Collection<FormulaFunction> findArgTypeMatch(List<Class<?>> argTypes, Collection<FormulaFunction> formulaFunctions); static String formatSignature(FormulaFunction function); static String format(String function, List<String> args);  }### Answer:
@Test public void findFirstMatch1() { FormulaFunction function1 = mock(FormulaFunction.class); when(function1.isVarArgs()).thenReturn(false); when(function1.getArgumentTypes()).thenReturn(Arrays.<Class<?>>asList(String.class)); FormulaFunction function2 = mock(FormulaFunction.class); when(function2.isVarArgs()).thenReturn(true); when(function2.getArgumentTypes()).thenReturn(Arrays.<Class<?>>asList(Number.class)); List<FormulaFunction> functions = Arrays.asList(function1, function2); assertThat(FormulaFunctions.findFirstMatch(Arrays.<Object>asList(3.0, "test"), functions), nullValue()); assertThat(FormulaFunctions.findFirstMatch(Arrays.<Object>asList(3.0), functions), sameInstance(function2)); assertThat(FormulaFunctions.findFirstMatch(Arrays.<Object>asList(3.0, 4.0), functions), sameInstance(function2)); assertThat(FormulaFunctions.findFirstMatch(Arrays.<Object>asList("test"), functions), sameInstance(function1)); }