### Question:
EventAttribute extends AbstractAttribute { public Command findCommand(BindingContext bindingContext, Class<?>... parameterTypes) { Function function = bindingContext.findFunction(commandName, parameterTypes); if (function != null) { return isArrayNotEmpty(parameterTypes) ? new CommandImpl(function, true) : new CommandImpl(function, false); } else { return null; } } EventAttribute(String name, String value); Command findCommand(BindingContext bindingContext, Class<?>... parameterTypes); String getCommandName();  }### Answer:
@Test public void givenFunctionWithParameters_whenFind_thenReturnCommandWithParametersSupported() { when(bindingContext.findFunction(COMMAND_NAME, withParameterTypes())).thenReturn(function); CommandImpl command = (CommandImpl) attribute.findCommand(bindingContext, withParameterTypes()); assertNotNull(command); assertTrue(command.supportsPreferredParameterType); }
@Test public void givenFunctionWithoutParameters_whenFind_thenReturnCommandWithoutParametersSupported() { when(bindingContext.findFunction(COMMAND_NAME)).thenReturn(function); CommandImpl command = (CommandImpl) attribute.findCommand(bindingContext); assertNotNull(command); assertFalse(command.supportsPreferredParameterType); }
@Test public void whenFindANonExistingCommand_thenReturnNull() { Command command = attribute.findCommand(bindingContext); assertNull(command); }