IsDecimalFunction implements DDMExpressionFunction.Function1<Object, Boolean> { @Override public Boolean apply(Object value) { try { new BigDecimal(value.toString()); return true; } catch (NumberFormatException numberFormatException) { return false; } }  @Override Boolean apply(Object value); @Override String getName(); static final String NAME; }
@Test public void testApplyFalse() { IsDecimalFunction isDecimalFunction = new IsDecimalFunction(); Boolean result = isDecimalFunction.apply("NUMBER"); Assert.assertFalse(result); }
@Test public void testApplyTrue1() { IsDecimalFunction isDecimalFunction = new IsDecimalFunction(); Boolean result = isDecimalFunction.apply("1.2"); Assert.assertTrue(result); }
@Test public void testApplyTrue2() { IsDecimalFunction isDecimalFunction = new IsDecimalFunction(); Boolean result = isDecimalFunction.apply("3"); Assert.assertTrue(result); }