org.assertj.core.internal.Objects.assertEqual()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中org.assertj.core.internal.Objects.assertEqual()方法的一些代码示例,展示了Objects.assertEqual()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objects.assertEqual()方法的具体详情如下:
包路径:org.assertj.core.internal.Objects
类名称:Objects
方法名:assertEqual

Objects.assertEqual介绍

[英]Asserts that two objects are equal.
[中]断言两个对象相等。

代码示例

代码示例来源:origin: org.assertj/assertj-core

/** {@inheritDoc} */
@Override
public SELF isEqualTo(Object expected) {
 objects.assertEqual(info, actual, expected);
 return myself;
}

代码示例来源:origin: joel-costigliola/assertj-core

/** {@inheritDoc} */
@Override
public SELF isEqualTo(Object expected) {
 objects.assertEqual(info, actual, expected);
 return myself;
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * 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;
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * 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;
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * 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;
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * 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;
}

代码示例来源:origin: org.assertj/assertj-core

@Override
public IterableAssert<ELEMENT> isEqualTo(Object expected) {
 if (actual instanceof LazyIterable) {
  objects.assertEqual(info, asLazyIterable().iterator, expected);
  return myself;
 }
 return super.isEqualTo(expected);
}

代码示例来源:origin: palantir/atlasdb

private void checkPresentAndCheckCount(MetricName metricName, long count) {
  assertMetricExists(metricName);
  objects.assertEqual(writableAssertionInfo, taggedMetricRegistry.meter(metricName).getCount(), count);
}

代码示例来源:origin: palantir/atlasdb

public void hasEntriesReadConservativeEqualTo(long value) {
  objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.ENTRIES_READ).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasTombstonesPutConservativeEqualTo(long value) {
  objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.TOMBSTONES_PUT).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasSweepTimestampConservativeEqualTo(Long value) {
  objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.SWEEP_TS).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasTombstonesPutThoroughEqualTo(long value) {
  objects.assertEqual(info, getGaugeThorough(AtlasDbMetricNames.TOMBSTONES_PUT).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasLegacyOutcomeEqualTo(SweepOutcome outcome, long value) {
  objects.assertEqual(info, getGaugeForLegacyOutcome(outcome).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasLastSweptTimestampConservativeEqualTo(Long value) {
  objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.LAST_SWEPT_TS).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasMillisSinceLastSweptConservativeEqualTo(Long value) {
  objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.LAG_MILLIS).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasEntriesReadThoroughEqualTo(long value) {
  objects.assertEqual(info, getGaugeThorough(AtlasDbMetricNames.ENTRIES_READ).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasAbortedWritesDeletedThoroughEqualTo(long value) {
  objects.assertEqual(info, getGaugeThorough(AtlasDbMetricNames.ABORTED_WRITES_DELETED).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasMillisSinceLastSweptThoroughEqualTo(long value) {
  objects.assertEqual(info, getGaugeThorough(AtlasDbMetricNames.LAG_MILLIS).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasAbortedWritesDeletedConservativeEquals(long value) {
  objects.assertEqual(info, getGaugeConservative(AtlasDbMetricNames.ABORTED_WRITES_DELETED).getValue(), value);
}

代码示例来源:origin: palantir/atlasdb

public void hasTargetedOutcomeEqualTo(SweepOutcome outcome, Long value) {
  objects.assertEqual(info, getGaugeForTargetedOutcome(outcome).getValue(), value);
}

相关文章