StringLengthFunction extends BaseFEELFunction { public FEELFnResult<BigDecimal> invoke(@ParameterName("string") String string) { if ( string == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "string", "cannot be null")); } else { return FEELFnResult.ofResult(EvalHelper.getBigDecimalOrNull(string.codePointCount(0, string.length()))); } } StringLengthFunction(); FEELFnResult<BigDecimal> invoke(@ParameterName("string") String string);  }
@Test public void invokeNull() { FunctionTestUtil.assertResultError(stringLengthFunction.invoke(null), InvalidParametersEvent.class); }
@Test public void invokeEmptyString() { FunctionTestUtil.assertResult(stringLengthFunction.invoke(""), BigDecimal.ZERO); }
@Test public void invoke() { FunctionTestUtil.assertResult(stringLengthFunction.invoke("testString"), BigDecimal.TEN); }