use of org.assertj.core.util.CheckReturnValue in project assertj-core by joel-costigliola.
the class AbstractDateAssert method usingComparator.
@Override
@CheckReturnValue
public SELF usingComparator(Comparator<? super Date> customComparator, String customComparatorDescription) {
super.usingComparator(customComparator, customComparatorDescription);
this.dates = new Dates(new ComparatorBasedComparisonStrategy(customComparator, customComparatorDescription));
return myself;
}
use of org.assertj.core.util.CheckReturnValue in project assertj-core by joel-costigliola.
the class AbstractDoubleAssert method usingComparator.
@Override
@CheckReturnValue
public SELF usingComparator(Comparator<? super Double> customComparator, String customComparatorDescription) {
super.usingComparator(customComparator, customComparatorDescription);
doubles = new Doubles(new ComparatorBasedComparisonStrategy(customComparator, customComparatorDescription));
return myself;
}
use of org.assertj.core.util.CheckReturnValue in project assertj-core by joel-costigliola.
the class AtomicLongAssert method usingComparator.
@Override
@CheckReturnValue
public AtomicLongAssert usingComparator(Comparator<? super AtomicLong> customComparator, String customComparatorDescription) {
super.usingComparator(customComparator, customComparatorDescription);
longs = new Longs(new ComparatorBasedComparisonStrategy(customComparator, customComparatorDescription));
return myself;
}
use of org.assertj.core.util.CheckReturnValue in project assertj-core by joel-costigliola.
the class AtomicReferenceArrayAssert method usingComparatorForType.
/**
* Allows to set a specific comparator for the given type of elements or their fields.
* Extends {@link #usingComparatorForElementFieldsWithType} by applying comparator specified for given type
* to elements themselves, not only to their fields.
* <p>
* Usage of this method affects comparators set by next methods:
* <ul>
* <li>{@link #usingFieldByFieldElementComparator}</li>
* <li>{@link #usingElementComparatorOnFields}</li>
* <li>{@link #usingElementComparatorIgnoringFields}</li>
* <li>{@link #usingRecursiveFieldByFieldElementComparator}</li>
* </ul>
* <p>
* Example:
* <pre><code class='java'> // assertion will pass
* assertThat(new AtomicReferenceArray<>(new Object[] { "some", new BigDecimal("4.2") }))
* .usingComparatorForType(BIG_DECIMAL_COMPARATOR, BigDecimal.class)
* .contains(new BigDecimal("4.20"));
* </code></pre>
*
* @param <C> the type to compare.
* @param comparator the {@link java.util.Comparator} to use
* @param type the {@link java.lang.Class} of the type of the element or element fields the comparator should be used for
* @return {@code this} assertions object
* @since 2.9.0 / 3.9.0
*/
@CheckReturnValue
public <C> AtomicReferenceArrayAssert<T> usingComparatorForType(Comparator<C> comparator, Class<C> type) {
if (arrays.getComparator() == null) {
usingElementComparator(new ExtendedByTypesComparator(getComparatorsByType()));
}
getComparatorsForElementPropertyOrFieldTypes().put(type, comparator);
getComparatorsByType().put(type, comparator);
return myself;
}
Aggregations