/** {@inheritDoc} */ @Override public SELF isEqualTo(Object expected) { objects.assertEqual(info, actual, expected); return myself; }
/** {@inheritDoc} */ @Override public SELF isEqualTo(Object expected) { objects.assertEqual(info, actual, expected); return myself; }
/** * Verifies that the actual group contains only the given values and nothing else, <b>in order</b>. * <p> * Example : * <pre><code class='java'> // assertion will pass * assertThat(new byte[] { 1, 2, 3 }).containsExactly((byte) 1, (byte) 2, (byte) 3); * * // assertion will fail as actual and expected order differ * assertThat(new byte[] { 1, 2, 3 }).containsExactly((byte) 2, (byte) 1, (byte) 3);</code></pre> * * @param values the given values. * @return {@code this} assertion object. * @throws NullPointerException if the given argument is {@code null}. * @throws AssertionError if the actual group is {@code null}. * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual * group * contains some or none of the given values, or the actual group contains more values * than the given ones * or values are the same but the order is not. */ public SELF containsExactly(byte... values) { objects.assertEqual(info, actual, values); return myself; }
/** * Verifies that the actual group contains only the given values and nothing else, <b>in order</b>. * <p> * Example : * <pre><code class='java'> // assertion will pass * assertThat(new byte[] { 1, 2, 3 }).containsExactly((byte) 1, (byte) 2, (byte) 3); * * // assertion will fail as actual and expected order differ * assertThat(new byte[] { 1, 2, 3 }).containsExactly((byte) 2, (byte) 1, (byte) 3);</code></pre> * * @param values the given values. * @return {@code this} assertion object. * @throws NullPointerException if the given argument is {@code null}. * @throws AssertionError if the actual group is {@code null}. * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual * group * contains some or none of the given values, or the actual group contains more values * than the given ones * or values are the same but the order is not. */ public SELF containsExactly(byte... values) { objects.assertEqual(info, actual, values); return myself; }
/** * Verifies that the object under test returns the given expected value from the given {@link Function}, * a typical usage is to pass a method reference to assert object's property. * <p> * Wrapping the given {@link Function} with {@link Assertions#from(Function)} makes the assertion more readable. * <p> * Example: * <pre><code class="java"> // from is not mandatory but it makes the assertions more readable * assertThat(frodo).returns("Frodo", from(TolkienCharacter::getName)) * .returns("Frodo", TolkienCharacter::getName) // no from :( * .returns(HOBBIT, from(TolkienCharacter::getRace));</code></pre> * * @param expected the value the object under test method's call should return. * @param from {@link Function} used to acquire the value to test from the object under test. Must not be {@code null} * @param <T> the expected value type the given {@code method} returns. * @return {@code this} assertion object. * @throws NullPointerException if given {@code from} function is null */ public <T> SELF returns(T expected, Function<ACTUAL, T> from) { requireNonNull(from, "The given getter method/Function must not be null"); objects.assertEqual(info, from.apply(actual), expected); return myself; }
/** * Verifies that the object under test returns the given expected value from the given {@link Function}, * a typical usage is to pass a method reference to assert object's property. * <p> * Wrapping the given {@link Function} with {@link Assertions#from(Function)} makes the assertion more readable. * <p> * Example: * <pre><code class="java"> // from is not mandatory but it makes the assertions more readable * assertThat(frodo).returns("Frodo", from(TolkienCharacter::getName)) * .returns("Frodo", TolkienCharacter::getName) // no from :( * .returns(HOBBIT, from(TolkienCharacter::getRace));</code></pre> * * @param expected the value the object under test method's call should return. * @param from {@link Function} used to acquire the value to test from the object under test. Must not be {@code null} * @param <T> the expected value type the given {@code method} returns. * @return {@code this} assertion object. * @throws NullPointerException if given {@code from} function is null */ public <T> SELF returns(T expected, Function<ACTUAL, T> from) { requireNonNull(from, "The given getter method/Function must not be null"); objects.assertEqual(info, from.apply(actual), expected); return myself; }
@Override public IterableAssert<ELEMENT> isEqualTo(Object expected) { if (actual instanceof LazyIterable) { objects.assertEqual(info, asLazyIterable().iterator, expected); return myself; } return super.isEqualTo(expected); }
private void checkPresentAndCheckCount(MetricName metricName, long count) { assertMetricExists(metricName); objects.assertEqual(writableAssertionInfo, taggedMetricRegistry.meter(metricName).getCount(), count); }
public void hasEntriesReadConservativeEqualTo(long value) { objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.ENTRIES_READ).getValue(), value); }
public void hasTombstonesPutConservativeEqualTo(long value) { objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.TOMBSTONES_PUT).getValue(), value); }
public void hasSweepTimestampConservativeEqualTo(Long value) { objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.SWEEP_TS).getValue(), value); }
public void hasTombstonesPutThoroughEqualTo(long value) { objects.assertEqual(info, getGaugeThorough(AtlasDbMetricNames.TOMBSTONES_PUT).getValue(), value); }
public void hasLegacyOutcomeEqualTo(SweepOutcome outcome, long value) { objects.assertEqual(info, getGaugeForLegacyOutcome(outcome).getValue(), value); }
public void hasLastSweptTimestampConservativeEqualTo(Long value) { objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.LAST_SWEPT_TS).getValue(), value); }
public void hasMillisSinceLastSweptConservativeEqualTo(Long value) { objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.LAG_MILLIS).getValue(), value); }
public void hasEntriesReadThoroughEqualTo(long value) { objects.assertEqual(info, getGaugeThorough(AtlasDbMetricNames.ENTRIES_READ).getValue(), value); }
public void hasAbortedWritesDeletedThoroughEqualTo(long value) { objects.assertEqual(info, getGaugeThorough(AtlasDbMetricNames.ABORTED_WRITES_DELETED).getValue(), value); }
public void hasMillisSinceLastSweptThoroughEqualTo(long value) { objects.assertEqual(info, getGaugeThorough(AtlasDbMetricNames.LAG_MILLIS).getValue(), value); }
public void hasAbortedWritesDeletedConservativeEquals(long value) { objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.ABORTED_WRITES_DELETED).getValue(), value); }
public void hasTargetedOutcomeEqualTo(SweepOutcome outcome, Long value) { objects.assertEqual(info, getGaugeForTargetedOutcome(outcome).getValue(), value); }