BigDecimalUtil { public static BigDecimal parseFromNumberStringPercentage(@Nullable String numberString) { return StringsUtil.isEmptyValue(numberString) ? null : new BigDecimal(numberString.replaceAll("\\s|%|>|<", "")); } private  BigDecimalUtil(); static BigDecimal parseFromNumberString(@Nullable String numberString); static BigDecimal parseFromNumberStringPercentage(@Nullable String numberString); static String formatAsReadable(@Nullable BigDecimal number); static BigDecimal parseFromMoneyString(@Nullable String numberString);  }
@Test public void testDash() { String numString = "--"; BigDecimal parsed = BigDecimalUtil.parseFromNumberStringPercentage(numString); assertNull("The parsed value is not null.", parsed); }
@Test public void testPercentStringNull() { String numString = null; BigDecimal parsed = BigDecimalUtil.parseFromNumberStringPercentage(numString); assertNull("The parsed value is not null.", parsed); }
@Test public void testPercentStringEmpty() { String numString = ""; BigDecimal parsed = BigDecimalUtil.parseFromNumberStringPercentage(numString); assertNull("The parsed value is not null.", parsed); }