public FEELFnResult<Object> invoke(@ParameterName("n") Object[] list) { if ( list == null ) { // Arrays.asList does not accept null as parameter return FEELFnResult.ofError( new InvalidParametersEvent( FEELEvent.Severity.ERROR, "n", "the single value list cannot be null" ) ); } return invoke( Arrays.asList( list ) ); } }
@Test public void testModeFunction() { assertResult(modeFunction.invoke(new Object[]{6, 3, 9, 6, 6}), Collections.singletonList(valueOf(6))); assertResult(modeFunction.invoke(Arrays.asList(6, 1, 9, 6, 1)), Arrays.asList(valueOf(1), valueOf(6))); assertResult(modeFunction.invoke(Collections.emptyList()), Collections.emptyList()); }