Esempio n. 1
0
  @Test
  public final void shouldParseEmptyDecimalString() {
    // given
    String stringValue = "";

    // when
    Either<Exception, Optional<BigDecimal>> res =
        BigDecimalUtils.tryParse(stringValue, Locale.ENGLISH);

    // then
    Assert.assertEquals(Either.right(Optional.<BigDecimal>absent()), res);
  }
Esempio n. 2
0
  @Test
  public final void shouldParseNotEmptyPlDecimalString() {
    // given
    String stringValue = "1,2";

    // when
    Either<Exception, Optional<BigDecimal>> res =
        BigDecimalUtils.tryParse(stringValue, new Locale("pl"));

    // then
    Assert.assertEquals(Either.right(Optional.of(new BigDecimal("1.2"))), res);
  }