/** * Verifies that the actual number is not close to the given one by the given percentage.<br> * If difference is equal to the percentage value, the assertion fails. * <p> * Example with BigDecimal: * <pre><code class='java'> BigDecimal eleven = BigDecimal.valueOf(11.0); * * // assertion will pass: * assertThat(eleven).isNotCloseTo(BigDecimal.TEN, withinPercentage(new BigDecimal("5"))); * * // assertion will fail as the difference is exactly equals to the computed offset (1.0) * assertThat(eleven).isNotCloseTo(BigDecimal.TEN, withinPercentage(new BigDecimal("10"))); * * // assertion will fail * assertThat(eleven).isNotCloseTo(BigDecimal.TEN, withinPercentage(new BigDecimal("20")));</code></pre> * * @param expected the given number to compare the actual value to. * @param percentage the given positive percentage. * @return {@code this} assertion object. * @throws NullPointerException if the given offset is {@code null}. * @throws NullPointerException if the expected number is {@code null}. * @throws AssertionError if the actual value is close to the given one. */ @Override public SELF isNotCloseTo(BigDecimal expected, Percentage percentage) { bigDecimals.assertIsNotCloseToPercentage(info, actual, expected, percentage); return myself; }
/** * Verifies that the actual number is not close to the given one by the given percentage.<br> * If difference is equal to the percentage value, the assertion fails. * <p> * Example with BigDecimal: * <pre><code class='java'> BigDecimal eleven = BigDecimal.valueOf(11.0); * * // assertion will pass: * assertThat(eleven).isNotCloseTo(BigDecimal.TEN, withinPercentage(new BigDecimal("5"))); * * // assertion will fail as the difference is exactly equals to the computed offset (1.0) * assertThat(eleven).isNotCloseTo(BigDecimal.TEN, withinPercentage(new BigDecimal("10"))); * * // assertion will fail * assertThat(eleven).isNotCloseTo(BigDecimal.TEN, withinPercentage(new BigDecimal("20")));</code></pre> * * @param expected the given number to compare the actual value to. * @param percentage the given positive percentage. * @return {@code this} assertion object. * @throws NullPointerException if the given offset is {@code null}. * @throws NullPointerException if the expected number is {@code null}. * @throws AssertionError if the actual value is close to the given one. */ @Override public SELF isNotCloseTo(BigDecimal expected, Percentage percentage) { bigDecimals.assertIsNotCloseToPercentage(info, actual, expected, percentage); return myself; }