@Test public void runAdditionalTest() throws EvaluationException { IsNumberFunction function = new IsNumberFunction(); ParameterCallback cbIntMock = mock(ParameterCallback.class); when(cbIntMock.getParameterCount()).thenReturn(1); when(cbIntMock.getType(anyInt())).thenReturn(NumberType.GENERIC_NUMBER); when(cbIntMock.getValue(anyInt())).thenReturn(new Long(55)); ParameterCallback cbStrMock = mock(ParameterCallback.class); when(cbStrMock.getParameterCount()).thenReturn(1); when(cbStrMock.getType(anyInt())).thenReturn(TextType.TYPE); when(cbStrMock.getValue(anyInt())).thenReturn(new String("55")); TypeValuePair result = function.evaluate(getContext(), cbIntMock); assertEquals(result.getValue(), Boolean.TRUE); result = function.evaluate(getContext(), cbStrMock); assertEquals(result.getValue(), Boolean.FALSE); }
public TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters) throws EvaluationException { final int parameterCount = parameters.getParameterCount(); if (parameterCount < 1) { throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE); } final Object value = parameters.getValue(0); if(value instanceof Number) { return RETURN_TRUE; } return RETURN_FALSE; }
IsNumberFunction implements Function { public TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters) throws EvaluationException { final int parameterCount = parameters.getParameterCount(); if (parameterCount < 1) { throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE); } final Object value = parameters.getValue(0); if(value instanceof Number) { return RETURN_TRUE; } return RETURN_FALSE; } }
IsNumberFunction implements Function { public TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters) throws EvaluationException { final int parameterCount = parameters.getParameterCount(); if (parameterCount < 1) { throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE); } final Object value = parameters.getValue(0); if(value instanceof Number) { return RETURN_TRUE; } return RETURN_FALSE; } IsNumberFunction(); }
IsNumberFunction implements Function { public TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters) throws EvaluationException { final int parameterCount = parameters.getParameterCount(); if (parameterCount < 1) { throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE); } final Object value = parameters.getValue(0); if(value instanceof Number) { return RETURN_TRUE; } return RETURN_FALSE; } IsNumberFunction(); TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters); String getCanonicalName(); }
IsNumberFunction implements Function { public TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters) throws EvaluationException { final int parameterCount = parameters.getParameterCount(); if (parameterCount < 1) { throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE); } final Object value = parameters.getValue(0); if(value instanceof Number) { return RETURN_TRUE; } return RETURN_FALSE; } IsNumberFunction(); TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters); String getCanonicalName();  }