Skip to main content

8.51.0 release (2025-04-25)

Total recipe count: 3707

Info

This changelog only shows what recipes have been added, removed, or changed. OpenRewrite may do releases that do not include these types of changes. To see these changes, please go to the releases page.

New Recipes​

Limitations:

  • If two methods in a class are effectively the same getter then one's name will be corrected and the others name will be left as it is.
  • If the correct name for a method is already taken by another method then the name will not be corrected.
  • Method name swaps or circular renaming within a class cannot be performed because the names block each other. E.g. int getFoo() { return ba; } int getBa() { return foo; } stays as it is.
static final class AssertThatIsEqualByComparingTo<T extends Comparable<? super T>> {

@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isEqualTo(0);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isEqualByComparingTo(expected);
}
}

.

static final class AssertThatIsGreaterThanOrEqualTo<T extends Comparable<? super T>> {

@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isNotNegative();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isGreaterThanOrEqualTo(expected);
}
}

.

static final class AssertThatIsGreaterThan<T extends Comparable<? super T>> {

@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isPositive();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isGreaterThan(expected);
}
}

.

static final class AssertThatIsLessThanOrEqualTo<T extends Comparable<? super T>> {

@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isNotPositive();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isLessThanOrEqualTo(expected);
}
}

.

static final class AssertThatIsLessThan<T extends Comparable<? super T>> {

@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isNegative();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isLessThan(expected);
}
}

.

static final class AssertThatIsNotEqualByComparingTo<T extends Comparable<? super T>> {

@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isNotEqualTo(0);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isNotEqualByComparingTo(expected);
}
}

.

static final class EnumerableAssertHasSameSizeAs<S, E> {

@BeforeTemplate
EnumerableAssert<?, S> before(EnumerableAssert<?, S> enumAssert, Iterable<E> iterable) {
return enumAssert.hasSize(Iterables.size(iterable));
}

@BeforeTemplate
EnumerableAssert<?, S> before(EnumerableAssert<?, S> enumAssert, Collection<E> iterable) {
return enumAssert.hasSize(iterable.size());
}

@BeforeTemplate
EnumerableAssert<?, S> before(EnumerableAssert<?, S> enumAssert, E[] iterable) {
return enumAssert.hasSize(iterable.length);
}

@BeforeTemplate
EnumerableAssert<?, S> before(EnumerableAssert<?, S> enumAssert, CharSequence iterable) {
return enumAssert.hasSize(iterable.length());
}

@AfterTemplate
EnumerableAssert<?, S> after(EnumerableAssert<?, S> enumAssert, Iterable<E> iterable) {
return enumAssert.hasSameSizeAs(iterable);
}
}

.

static final class EnumerableAssertHasSizeBetween<E> {

@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int lower, int upper) {
return enumAssert.size().isBetween(lower, upper).returnToIterable();
}

@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int lower, int upper) {
return enumAssert.size().isBetween(lower, upper);
}

@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int lower, int upper) {
return enumAssert.hasSizeBetween(lower, upper);
}
}

.

static final class EnumerableAssertHasSizeGreaterThanOrEqualTo<E> {

@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isGreaterThanOrEqualTo(size).returnToIterable();
}

@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isGreaterThanOrEqualTo(size);
}

@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int size) {
return enumAssert.hasSizeGreaterThanOrEqualTo(size);
}
}

.

static final class EnumerableAssertHasSizeGreaterThan<E> {

@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isGreaterThan(size).returnToIterable();
}

@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isGreaterThan(size);
}

@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int size) {
return enumAssert.hasSizeGreaterThan(size);
}
}

.

static final class EnumerableAssertHasSizeLessThanOrEqualTo<E> {

@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isLessThanOrEqualTo(size).returnToIterable();
}

@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isLessThanOrEqualTo(size);
}

@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int size) {
return enumAssert.hasSizeLessThanOrEqualTo(size);
}
}

.

static final class EnumerableAssertHasSizeLessThan<E> {

@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isLessThan(size).returnToIterable();
}

@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isLessThan(size);
}

@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int size) {
return enumAssert.hasSizeLessThan(size);
}
}

.

static final class EnumerableAssertHasSize<E> {

@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isEqualTo(size).returnToIterable();
}

@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isEqualTo(size);
}

@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int size) {
return enumAssert.hasSize(size);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes$EnumerableAssertIsEmptyRecipe: Recipe created for the following Refaster template:
static final class EnumerableAssertIsEmpty<E> {

@BeforeTemplate
void before(EnumerableAssert<?, E> enumAssert) {
Refaster.anyOf(enumAssert.hasSize(0), enumAssert.hasSizeLessThanOrEqualTo(0), enumAssert.hasSizeLessThan(1));
}

@BeforeTemplate
void before(AbstractIterableAssert<?, ?, E, ?> enumAssert) {
enumAssert.size().isNotPositive();
}

@AfterTemplate
void after(EnumerableAssert<?, E> enumAssert) {
enumAssert.isEmpty();
}
}

.

static final class EnumerableAssertIsNotEmpty<E> {

@BeforeTemplate
EnumerableAssert<?, E> before(EnumerableAssert<?, E> enumAssert) {
return Refaster.anyOf(enumAssert.hasSizeGreaterThan(0), enumAssert.hasSizeGreaterThanOrEqualTo(1));
}

@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert) {
return Refaster.anyOf(enumAssert.size().isNotEqualTo(0).returnToIterable(), enumAssert.size().isPositive().returnToIterable());
}

@BeforeTemplate
AbstractIntegerAssert<?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert) {
return Refaster.anyOf(enumAssert.size().isNotEqualTo(0), enumAssert.size().isPositive());
}

@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert) {
return enumAssert.isNotEmpty();
}
}

.

static final class AssertThatIterableHasOneElementEqualTo<S, E extends S> {

@BeforeTemplate
ObjectAssert<S> before(Iterable<S> iterable, E element) {
return assertThat(Iterables.getOnlyElement(iterable)).isEqualTo(element);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
IterableAssert<S> after(Iterable<S> iterable, E element) {
return assertThat(iterable).containsExactly(element);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJIterableRulesRecipes$AssertThatIterableIsEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatIterableIsEmpty<E> {

@BeforeTemplate
void before(Iterable<E> iterable) {
assertThat(iterable.iterator()).isExhausted();
}

@BeforeTemplate
void before(Collection<E> iterable) {
assertThat(iterable.isEmpty()).isTrue();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Collection<E> iterable) {
assertThat(iterable).isEmpty();
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJIterableRulesRecipes$AssertThatIterableIsNotEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatIterableIsNotEmpty<E> {

@BeforeTemplate
AbstractAssert<?, ?> before(Iterable<E> iterable) {
return assertThat(iterable.iterator()).hasNext();
}

@BeforeTemplate
AbstractAssert<?, ?> before(Collection<E> iterable) {
return assertThat(iterable.isEmpty()).isFalse();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
IterableAssert<E> after(Iterable<E> iterable) {
return assertThat(iterable).isNotEmpty();
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJIterableRulesRecipes$AssertThatIterableSizeRecipe: Recipe created for the following Refaster template:
static final class AssertThatIterableSize<E> {

@BeforeTemplate
AbstractIntegerAssert<?> before(Iterable<E> iterable) {
return assertThat(Iterables.size(iterable));
}

@BeforeTemplate
AbstractIntegerAssert<?> before(Collection<E> iterable) {
return assertThat(iterable.size());
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractIntegerAssert<?> after(Iterable<E> iterable) {
return assertThat(iterable).size();
}
}

.

static final class AssertThatHasNext<T> {

@BeforeTemplate
AbstractBooleanAssert<?> before(Iterator<T> iterator) {
return assertThat(iterator.hasNext()).isTrue();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
IteratorAssert<T> after(Iterator<T> iterator) {
return assertThat(iterator).hasNext();
}
}

.

static final class AssertThatIsExhausted<T> {

@BeforeTemplate
AbstractBooleanAssert<?> before(Iterator<T> iterator) {
return assertThat(iterator.hasNext()).isFalse();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
IteratorAssert<T> after(Iterator<T> iterator) {
return assertThat(iterator).isExhausted();
}
}

.

static final class AbstractMapAssertContainsExactlyEntriesOf<K, V> {

@BeforeTemplate
AbstractMapAssert<?, ?, K, V> before(AbstractMapAssert<?, ?, K, V> mapAssert, K key, V value) {
return mapAssert.containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(key, value));
}

@AfterTemplate
AbstractMapAssert<?, ?, K, V> after(AbstractMapAssert<?, ?, K, V> mapAssert, K key, V value) {
return mapAssert.containsExactlyEntriesOf(ImmutableMap.of(key, value));
}
}

.

static final class AbstractMapAssertContainsExactlyInAnyOrderEntriesOf<K, V> {

@BeforeTemplate
AbstractMapAssert<?, ?, K, V> before(AbstractMapAssert<?, ?, K, V> mapAssert, Map<? extends K, ? extends V> map) {
return mapAssert.isEqualTo(map);
}

@AfterTemplate
AbstractMapAssert<?, ?, K, V> after(AbstractMapAssert<?, ?, K, V> mapAssert, Map<? extends K, ? extends V> map) {
return mapAssert.containsExactlyInAnyOrderEntriesOf(map);
}
}

.

static final class AbstractMapAssertHasSameSizeAs<K, V> {

@BeforeTemplate
AbstractMapAssert<?, ?, K, V> before(AbstractMapAssert<?, ?, K, V> mapAssert, Map<?, ?> map) {
return mapAssert.hasSize(map.size());
}

@AfterTemplate
AbstractMapAssert<?, ?, K, V> after(AbstractMapAssert<?, ?, K, V> mapAssert, Map<?, ?> map) {
return mapAssert.hasSameSizeAs(map);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapContainsKeyRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapContainsKey<K, V> {

@BeforeTemplate
AbstractBooleanAssert<?> before(Map<K, V> map, K key) {
return assertThat(map.containsKey(key)).isTrue();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, K key) {
return assertThat(map).containsKey(key);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapContainsOnlyKeysRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapContainsOnlyKeys<K, V> {

@BeforeTemplate
AbstractCollectionAssert<?, Collection<? extends K>, K, ?> before(Map<K, V> map, Iterable<? extends K> keys) {
return assertThat(map.keySet()).hasSameElementsAs(keys);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, Iterable<? extends K> keys) {
return assertThat(map).containsOnlyKeys(keys);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapContainsValueRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapContainsValue<K, V> {

@BeforeTemplate
AbstractBooleanAssert<?> before(Map<K, V> map, V value) {
return assertThat(map.containsValue(value)).isTrue();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, V value) {
return assertThat(map).containsValue(value);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapDoesNotContainKeyRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapDoesNotContainKey<K, V> {

@BeforeTemplate
AbstractBooleanAssert<?> before(Map<K, V> map, K key) {
return assertThat(map.containsKey(key)).isFalse();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, K key) {
return assertThat(map).doesNotContainKey(key);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapDoesNotContainValueRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapDoesNotContainValue<K, V> {

@BeforeTemplate
AbstractBooleanAssert<?> before(Map<K, V> map, V value) {
return assertThat(map.containsValue(value)).isFalse();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, V value) {
return assertThat(map).doesNotContainValue(value);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapIsEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapIsEmpty<K, V> {

@BeforeTemplate
void before(Map<K, V> map) {
Refaster.anyOf(assertThat(map).hasSize(0), assertThat(map.isEmpty()).isTrue(), assertThat(map.size()).isEqualTo(0L), assertThat(map.size()).isNotPositive());
}

@BeforeTemplate
void before2(Map<K, V> map) {
assertThat(Refaster.anyOf(map.keySet(), map.values(), map.entrySet())).isEmpty();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Map<K, V> map) {
assertThat(map).isEmpty();
}
}

.

static final class AssertThatHasToString<T> {

@BeforeTemplate
AbstractStringAssert<?> before(T object, String str) {
return assertThat(object.toString()).isEqualTo(str);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ObjectAssert<T> after(T object, String str) {
return assertThat(object).hasToString(str);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJObjectRulesRecipes$AssertThatIsIsEqualToRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsIsEqualTo<S, T> {

@BeforeTemplate
AbstractBooleanAssert<?> before(S object1, T object2) {
return assertThat(object1.equals(object2)).isTrue();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ObjectAssert<S> after(S object1, T object2) {
return assertThat(object1).isEqualTo(object2);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJObjectRulesRecipes$AssertThatIsIsNotEqualToRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsIsNotEqualTo<S, T> {

@BeforeTemplate
AbstractBooleanAssert<?> before(S object1, T object2) {
return assertThat(object1.equals(object2)).isFalse();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ObjectAssert<S> after(S object1, T object2) {
return assertThat(object1).isNotEqualTo(object2);
}
}

.

static final class AbstractOptionalAssertContainsSame<T> {

@BeforeTemplate
AbstractAssert<?, ?> before(AbstractOptionalAssert<?, T> optionalAssert, T value) {
return Refaster.anyOf(optionalAssert.get().isSameAs(value), optionalAssert.isPresent().isSameAs(value));
}

@AfterTemplate
AbstractOptionalAssert<?, T> after(AbstractOptionalAssert<?, T> optionalAssert, T value) {
return optionalAssert.containsSame(value);
}
}

.

static final class AbstractOptionalAssertHasValue<T> {

@BeforeTemplate
AbstractAssert<?, ?> before(AbstractOptionalAssert<?, T> optionalAssert, T value) {
return Refaster.anyOf(optionalAssert.get().isEqualTo(value), optionalAssert.isEqualTo(Optional.of(value)), optionalAssert.contains(value), optionalAssert.isPresent().hasValue(value));
}

@AfterTemplate
AbstractOptionalAssert<?, T> after(AbstractOptionalAssert<?, T> optionalAssert, T value) {
return optionalAssert.hasValue(value);
}
}

.

static final class AbstractOptionalAssertIsEmpty<T> {

@BeforeTemplate
AbstractAssert<?, ?> before(AbstractOptionalAssert<?, T> optionalAssert) {
return Refaster.anyOf(optionalAssert.isNotPresent(), optionalAssert.isEqualTo(Optional.empty()));
}

@AfterTemplate
AbstractOptionalAssert<?, T> after(AbstractOptionalAssert<?, T> optionalAssert) {
return optionalAssert.isEmpty();
}
}

.

static final class AbstractOptionalAssertIsPresent<T> {

@BeforeTemplate
AbstractAssert<?, ?> before(AbstractOptionalAssert<?, T> optionalAssert) {
return Refaster.anyOf(optionalAssert.isNotEmpty(), optionalAssert.isNotEqualTo(Optional.empty()));
}

@AfterTemplate
AbstractOptionalAssert<?, T> after(AbstractOptionalAssert<?, T> optionalAssert) {
return optionalAssert.isPresent();
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AssertThatOptionalHasValueMatchingRecipe: Recipe created for the following Refaster template:
static final class AssertThatOptionalHasValueMatching<T> {

@BeforeTemplate
AbstractOptionalAssert<?, T> before(Optional<T> optional, Predicate<? super T> predicate) {
return assertThat(optional.filter(predicate)).isPresent();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractObjectAssert<?, T> after(Optional<T> optional, Predicate<? super T> predicate) {
return assertThat(optional).get().matches(predicate);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AssertThatOptionalIsEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatOptionalIsEmpty<T> {

@BeforeTemplate
AbstractAssert<?, ?> before(Optional<T> optional) {
return Refaster.anyOf(assertThat(optional.isEmpty()).isTrue(), assertThat(optional.isPresent()).isFalse());
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
OptionalAssert<T> after(Optional<T> optional) {
return assertThat(optional).isEmpty();
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AssertThatOptionalIsPresentRecipe: Recipe created for the following Refaster template:
static final class AssertThatOptionalIsPresent<T> {

@BeforeTemplate
AbstractAssert<?, ?> before(Optional<T> optional) {
return Refaster.anyOf(assertThat(optional.isPresent()).isTrue(), assertThat(optional.isEmpty()).isFalse());
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
OptionalAssert<T> after(Optional<T> optional) {
return assertThat(optional).isPresent();
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AssertThatOptionalRecipe: Recipe created for the following Refaster template:
static final class AssertThatOptional<T> {

@BeforeTemplate
ObjectAssert<T> before(Optional<T> optional) {
return assertThat(optional.orElseThrow());
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractObjectAssert<?, T> after(Optional<T> optional) {
return assertThat(optional).get();
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatListsAreEqualRecipe: Recipe created for the following Refaster template:
static final class AssertThatListsAreEqual<S, T extends S> {

@BeforeTemplate
ListAssert<S> before(List<S> list1, Iterable<T> list2) {
return assertThat(list1).isEqualTo(list2);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(List<S> list1, Iterable<T> list2) {
return assertThat(list1).containsExactlyElementsOf(list2);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatMapContainsEntryRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapContainsEntry<K, V> {

@BeforeTemplate
ObjectAssert<?> before(Map<K, V> map, K key, V value) {
return assertThat(map.get(key)).isEqualTo(value);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, K key, V value) {
return assertThat(map).containsEntry(key, value);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatMultisetsAreEqualRecipe: Recipe created for the following Refaster template:
static final class AssertThatMultisetsAreEqual<S, T extends S> {

@BeforeTemplate
AbstractCollectionAssert<?, ?, S, ?> before(Multiset<S> multiset1, Iterable<T> multiset2) {
return assertThat(multiset1).isEqualTo(multiset2);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractCollectionAssert<?, ?, S, ?> after(Multiset<S> multiset1, Iterable<T> multiset2) {
return assertThat(multiset1).containsExactlyInAnyOrderElementsOf(multiset2);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatPredicateAcceptsRecipe: Recipe created for the following Refaster template:
static final class AssertThatPredicateAccepts<T> {

@BeforeTemplate
void before(Predicate<T> predicate, T object) {
assertThat(predicate.test(object)).isTrue();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Predicate<T> predicate, T object) {
assertThat(predicate).accepts(object);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatPredicateRejectsRecipe: Recipe created for the following Refaster template:
static final class AssertThatPredicateRejects<T> {

@BeforeTemplate
void before(Predicate<T> predicate, T object) {
assertThat(predicate.test(object)).isFalse();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Predicate<T> predicate, T object) {
assertThat(predicate).rejects(object);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatSetContainsExactlyOneElementRecipe: Recipe created for the following Refaster template:
static final class AssertThatSetContainsExactlyOneElement<S, T extends S> {

@BeforeTemplate
ObjectEnumerableAssert<?, S> before(Set<S> set, T element) {
return assertThat(set).containsOnly(element);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ObjectEnumerableAssert<?, S> after(Set<S> set, T element) {
return assertThat(set).containsExactly(element);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatSetsAreEqualRecipe: Recipe created for the following Refaster template:
static final class AssertThatSetsAreEqual<S, T extends S> {

@BeforeTemplate
AbstractCollectionAssert<?, ?, S, ?> before(Set<S> set1, Iterable<T> set2) {
return Refaster.anyOf(assertThat(set1).isEqualTo(set2), assertThat(set1).containsExactlyInAnyOrderElementsOf(set2));
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractCollectionAssert<?, ?, S, ?> after(Set<S> set1, Iterable<T> set2) {
return assertThat(set1).hasSameElementsAs(set2);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsAllRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsAll<S, T extends S, U extends T> {

@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).containsAll(iterable);
}

@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsAll(iterable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsAll(iterable);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsAnyElementsOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsAnyElementsOf<S, T extends S, U extends T> {

@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).containsAnyElementsOf(iterable);
}

@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsAnyElementsOf(iterable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsAnyElementsOf(iterable);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsAnyOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsAnyOf<S, T extends S, U extends T> {

@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).containsAnyOf(array);
}

@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsAnyOf(array);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).containsAnyOf(array);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsExactlyElementsOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsExactlyElementsOf<S, T extends S, U extends T> {

@BeforeTemplate
ListAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsExactlyElementsOf(iterable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsExactlyElementsOf(iterable);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsExactlyInAnyOrderElementsOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsExactlyInAnyOrderElementsOf<S, T extends S, U extends T> {

@BeforeTemplate
ListAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsExactlyInAnyOrderElementsOf(iterable);
}

@BeforeTemplate
AbstractCollectionAssert<?, ?, T, ?> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Multiset<T>> collector) {
return assertThat(stream.collect(collector)).containsExactlyInAnyOrderElementsOf(iterable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsExactlyInAnyOrderElementsOf(iterable);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsExactlyInAnyOrderRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsExactlyInAnyOrder<S, T extends S, U extends T> {

@BeforeTemplate
ListAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsExactlyInAnyOrder(array);
}

@BeforeTemplate
AbstractCollectionAssert<?, ?, T, ?> before2(Stream<S> stream, U[] array, Collector<S, ?, ? extends Multiset<T>> collector) {
return assertThat(stream.collect(collector)).containsExactlyInAnyOrder(array);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).containsExactlyInAnyOrder(array);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsExactlyRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsExactly<S, T extends S, U extends T> {

@BeforeTemplate
ListAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsExactly(array);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).containsExactly(array);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsOnlyRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsOnly<S, T extends S, U extends T> {

@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).containsOnly(array);
}

@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsOnly(array);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).containsOnly(array);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContains<S, T extends S, U extends T> {

@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).contains(array);
}

@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).contains(array);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).contains(array);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsSequenceRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsSequence<S, T extends S, U extends T> {

@BeforeTemplate
ListAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsSequence(iterable);
}

@BeforeTemplate
ListAssert<T> before(Stream<S> stream, U[] iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsSequence(iterable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsSequence(iterable);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsSubsequenceRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsSubsequence<S, T extends S, U extends T> {

@BeforeTemplate
ListAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsSubsequence(iterable);
}

@BeforeTemplate
ListAssert<T> before(Stream<S> stream, U[] iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsSubsequence(iterable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsSubsequence(iterable);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamDoesNotContainAnyElementsOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamDoesNotContainAnyElementsOf<S, T extends S, U extends T> {

@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContainAnyElementsOf(iterable);
}

@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContainAnyElementsOf(iterable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).doesNotContainAnyElementsOf(iterable);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamDoesNotContainRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamDoesNotContain<S, T extends S, U extends T> {

@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContain(array);
}

@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContain(array);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).doesNotContain(array);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamDoesNotContainSequenceRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamDoesNotContainSequence<S, T extends S, U extends T> {

@BeforeTemplate
ListAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContainSequence(iterable);
}

@BeforeTemplate
ListAssert<T> before(Stream<S> stream, U[] iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContainSequence(iterable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).doesNotContainSequence(iterable);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamHasSameElementsAsRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamHasSameElementsAs<S, T extends S, U extends T> {

@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).hasSameElementsAs(iterable);
}

@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).hasSameElementsAs(iterable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).hasSameElementsAs(iterable);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamHasSizeRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamHasSize<T> {

@BeforeTemplate
void before(Stream<T> stream, int size) {
assertThat(stream.count()).isEqualTo(size);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Stream<T> stream, int size) {
assertThat(stream).hasSize(size);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamIsEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamIsEmpty<S, T extends S> {

@BeforeTemplate
void before(Stream<S> stream, Collector<S, ?, ? extends Iterable<T>> collector) {
assertThat(stream.collect(collector)).isEmpty();
}

@BeforeTemplate
void before2(Stream<S> stream, Collector<S, ?, ? extends List<T>> collector) {
assertThat(stream.collect(collector)).isEmpty();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Stream<S> stream) {
assertThat(stream).isEmpty();
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamIsNotEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamIsNotEmpty<S, T extends S> {

@BeforeTemplate
void before(Stream<S> stream, Collector<S, ?, ? extends Iterable<T>> collector) {
assertThat(stream.collect(collector)).isNotEmpty();
}

@BeforeTemplate
void before2(Stream<S> stream, Collector<S, ?, ? extends List<T>> collector) {
assertThat(stream.collect(collector)).isNotEmpty();
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Stream<S> stream) {
assertThat(stream).isNotEmpty();
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamIsSubsetOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamIsSubsetOf<S, T extends S, U extends T> {

@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).isSubsetOf(iterable);
}

@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, U[] iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).isSubsetOf(iterable);
}

@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).isSubsetOf(iterable);
}

@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, U[] iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).isSubsetOf(iterable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] iterable) {
return assertThat(stream).isSubsetOf(iterable);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$ObjectEnumerableContainsOneElementRecipe: Recipe created for the following Refaster template:
static final class ObjectEnumerableContainsOneElement<S, T extends S> {

@BeforeTemplate
@SuppressWarnings(value = "unchecked")
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T element) {
return Refaster.anyOf(iterAssert.containsAnyOf(element), iterAssert.containsSequence(element), iterAssert.containsSubsequence(element));
}

@AfterTemplate
@SuppressWarnings(value = "unchecked")
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T element) {
return iterAssert.contains(element);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$ObjectEnumerableDoesNotContainOneElementRecipe: Recipe created for the following Refaster template:
static final class ObjectEnumerableDoesNotContainOneElement<S, T extends S> {

@BeforeTemplate
@SuppressWarnings(value = "unchecked")
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T element) {
return iterAssert.doesNotContainSequence(element);
}

@AfterTemplate
@SuppressWarnings(value = "unchecked")
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T element) {
return iterAssert.doesNotContain(element);
}
}

.

static final class AssertThatThrownByAsInstanceOfThrowable<T extends Throwable> {

@BeforeTemplate
ThrowableAssertAlternative<T> before(ThrowingCallable throwingCallable, Class<T> exceptionType) {
return assertThatExceptionOfType(exceptionType).isThrownBy(throwingCallable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractThrowableAssert<?, T> after(ThrowingCallable throwingCallable, Class<T> exceptionType) {
return assertThatThrownBy(throwingCallable).asInstanceOf(throwable(exceptionType));
}
}

.

static final class AssertThatThrownByIsInstanceOf<T extends Throwable> {

@BeforeTemplate
void before(ThrowingCallable throwingCallable, Class<T> exceptionType) {
Refaster.anyOf(assertThatThrownBy(throwingCallable).asInstanceOf(throwable(exceptionType)), assertThatThrownBy(throwingCallable).asInstanceOf(type(exceptionType)));
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, Class<T> exceptionType) {
assertThatThrownBy(throwingCallable).isInstanceOf(exceptionType);
}
}

.

  • tech.picnic.errorprone.refasterrules.AssortedRulesRecipes$DisjointCollectionsRecipe: Don't unnecessarily copy collections before passing them to Collections#disjoint(Collection, Collection).
  • tech.picnic.errorprone.refasterrules.AssortedRulesRecipes$DisjointSetsRecipe: Prefer Collections#disjoint(Collection, Collection) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.AssortedRulesRecipes$IterableIsEmptyRecipe: Prefer Iterables#isEmpty(Iterable) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.AssortedRulesRecipes$IteratorGetNextOrDefaultRecipe: Prefer Iterators#getNext(Iterator, Object) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.AssortedRulesRecipes$UnboundedSingleElementStreamRecipe: Prefer Stream#generate(java.util.function.Supplier) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ClassRulesRecipes: Refaster rules related to expressions dealing with classes. Source.
  • tech.picnic.errorprone.refasterrules.ClassRulesRecipes$ClassIsInstanceRecipe: Prefer Class#isInstance(Object) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes: Refaster rules related to expressions dealing with (arbitrary) collections. Source.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionAddAllToCollectionBlockRecipe: Recipe created for the following Refaster template:
static final class CollectionAddAllToCollectionBlock<T, S extends T> {

@BeforeTemplate
void before(Collection<T> addTo, Collection<S> elementsToAdd) {
elementsToAdd.forEach(addTo::add);
}

@BeforeTemplate
void before2(Collection<T> addTo, Collection<S> elementsToAdd) {
for (T element : elementsToAdd) {
addTo.add(element);
}
}

@BeforeTemplate
void before3(Collection<T> addTo, Collection<S> elementsToAdd) {
for (S element : elementsToAdd) {
addTo.add(element);
}
}

@AfterTemplate
void after(Collection<T> addTo, Collection<S> elementsToAdd) {
addTo.addAll(elementsToAdd);
}
}

.

static final class CollectionRemoveAllFromCollectionBlock<T, S extends T> {

@BeforeTemplate
void before(Collection<T> removeFrom, Collection<S> elementsToRemove) {
elementsToRemove.forEach(removeFrom::remove);
}

@BeforeTemplate
void before2(Collection<T> removeFrom, Collection<S> elementsToRemove) {
for (T element : elementsToRemove) {
removeFrom.remove(element);
}
}

@BeforeTemplate
void before3(Collection<T> removeFrom, Collection<S> elementsToRemove) {
for (S element : elementsToRemove) {
removeFrom.remove(element);
}
}

@AfterTemplate
void after(Collection<T> removeFrom, Collection<S> elementsToRemove) {
removeFrom.removeAll(elementsToRemove);
}
}

.

  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionRemoveAllFromCollectionExpressionRecipe: Don't call Iterables#removeAll(Iterable, Collection) when the elements to be removed are already part of a Collection.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionSizeRecipe: Prefer Collection#size() over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionToArrayRecipe: Prefer calling Collection#toArray() over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionAsListRecipe: Prefer ImmutableCollection#asList() over the more verbose alternative.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionContainsRecipe: Don't call ImmutableCollection#asList() if Collection#contains(Object) is called on the result; call it directly.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionParallelStreamRecipe: Don't call ImmutableCollection#asList() if ImmutableCollection#parallelStream() is called on the result; call it directly.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionStreamRecipe: Don't call ImmutableCollection#asList() if the result is going to be streamed; stream directly.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionToArrayWithArrayRecipe: Don't call ImmutableCollection#asList() if `ImmutableCollection#toArray(Object[])`` is called on the result; call it directly.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionToArrayWithGeneratorRecipe: Don't call ImmutableCollection#asList() if ImmutableCollection#toArray(IntFunction)} is called on the result; call it directly.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionToStringRecipe: Don't call ImmutableCollection#asList() if ImmutableCollection#toString() is called on the result; call it directly.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$NewArrayListFromCollectionRecipe: Prefer ArrayList#ArrayList(Collection) over the Guava alternative.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$OptionalFirstCollectionElementRecipe: Don't use the ternary operator to extract the first element of a possibly-empty Collection as an Optional, and (when applicable) prefer Stream#findFirst() over Stream#findAny() to communicate that the collection's first element (if any, according to iteration order) will be returned.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$RemoveOptionalFirstNavigableSetElementRecipe: Avoid contrived constructions when extracting the first element from a possibly empty NavigableSet.
  • tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$SetStreamRecipe: Don't unnecessarily call Stream#distinct() on an already-unique stream of elements.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes: Refaster rules related to expressions dealing with Comparators. Source.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CollectionsMaxRecipe: Prefer Collections#max(Collection) over more verbose alternatives.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CollectionsMaxWithComparatorRecipe: Avoid unnecessary creation of a Stream to determine the maximum of a known collection of values.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CollectionsMinRecipe: Prefer Collections#min(Collection) over more verbose alternatives.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CollectionsMinWithComparatorRecipe: Avoid unnecessary creation of a Stream to determine the minimum of a known collection of values.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CollectionsSortRecipe: Prefer Collections#sort(List) over more verbose alternatives.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CompareToRecipe: Prefer Comparable#compareTo(Object)} over more verbose alternatives.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$IsLessThanOrEqualToRecipe: Don't explicitly compare enums by their ordinal.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$IsLessThanRecipe: Don't explicitly compare enums by their ordinal.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$MaxByNaturalOrderRecipe: Prefer Comparator#naturalOrder() over Comparator#reverseOrder() where possible.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$MaxOfArrayRecipe: Avoid unnecessary creation of a Stream to determine the maximum of a known collection of values.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$MinByNaturalOrderRecipe: Prefer Comparator#naturalOrder() over Comparator#reverseOrder() where possible.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$MinOfArrayRecipe: Avoid unnecessary creation of a Stream to determine the minimum of a known collection of values.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ReverseOrderRecipe: Prefer Comparator#reverseOrder() over more complicated constructs.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingCustomRecipe: Don't explicitly create Comparators unnecessarily.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingCustomReversedRecipe: Don't explicitly create Comparators unnecessarily.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingDoubleRecipe: Don't explicitly create Comparators unnecessarily.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingIntRecipe: Don't explicitly create Comparators unnecessarily.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingLongRecipe: Don't explicitly create Comparators unnecessarily.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingRecipe: Don't explicitly create Comparators unnecessarily.
  • tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingReversedRecipe: Don't explicitly create Comparators unnecessarily.
  • tech.picnic.errorprone.refasterrules.EqualityRulesRecipes$EnumReferenceEqualityRecipe: Prefer reference-based equality for enums.
  • tech.picnic.errorprone.refasterrules.EqualityRulesRecipes$EqualsRecipe: Avoid contrived ways of handling null values during equality testing.
  • tech.picnic.errorprone.refasterrules.EqualityRulesRecipes$ObjectsEqualsRecipe: Avoid contrived ways of handling null values during equality testing.
  • tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes: Refaster rules related to expressions dealing with com.google.common.collect.ImmutableEnumSets. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet1Recipe: Prefer Sets#immutableEnumSet(Enum, Enum[]) for enum collections to take advantage of the internally used EnumSet.
  • tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet2Recipe: Warning: this rule is not completely behavior preserving: while the ImmutableSet#of expression produces a set that iterates over its elements in the listed order, the replacement code iterates over the elements in enum definition order.
  • tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet3Recipe: Warning: this rule is not completely behavior preserving: while the ImmutableSet#of expression produces a set that iterates over its elements in the listed order, the replacement code iterates over the elements in enum definition order.
  • tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet4Recipe: Warning: this rule is not completely behavior preserving: while the ImmutableSet#of expression produces a set that iterates over its elements in the listed order, the replacement code iterates over the elements in enum definition order.
  • tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet5Recipe: Warning: this rule is not completely behavior preserving: while the ImmutableSet#of expression produces a set that iterates over its elements in the listed order, the replacement code iterates over the elements in enum definition order.
  • tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet6Recipe: Warning: this rule is not completely behavior preserving: while the original code produces a set that iterates over its elements in the listed order, the replacement code iterates over the elements in enum definition order.
  • tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSetArraysAsListRecipe: Warning: this rule is not completely behavior preserving: while the original code produces a set that iterates over its elements in the same order as defined in the array, the replacement code iterates over the elements in enum definition order.
  • tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSetIterableRecipe: Warning: this rule is not completely behavior preserving: while the original code produces a set that iterates over its elements in the same order as the input Iterable, the replacement code iterates over the elements in enum definition order.
  • tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$StreamToImmutableEnumSetRecipe: Warning: this rule is not completely behavior preserving: while the original code produces a set that iterates over its elements in encounter order, the replacement code iterates over the elements in enum definition order.
  • tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes: Refaster rules related to expressions dealing with ImmutableListMultimaps. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$EmptyImmutableListMultimapRecipe: Prefer ImmutableListMultimap#of() over more contrived or less-specific alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$EntryToImmutableListMultimapRecipe: Prefer ImmutableListMultimap#of(Object, Object) over more contrived or less-specific alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$ImmutableListMultimapBuilderRecipe: Prefer ImmutableListMultimap#builder() over the associated constructor on constructions that produce a less-specific type.
  • tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$IterableToImmutableListMultimapRecipe: Prefer ImmutableListMultimap#copyOf(Iterable) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$PairToImmutableListMultimapRecipe: Prefer ImmutableListMultimap#of(Object, Object) over more contrived or less-specific alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$TransformMultimapValuesToImmutableListMultimap2Recipe: Prefer creating an immutable copy of the result of Multimaps#transformValues(Multimap, com.google.common.base.Function) over creating and directly collecting a stream.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes: Refaster rules related to expressions dealing with ImmutableLists. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListBuilderRecipe: Prefer ImmutableList#builder() over the associated constructor.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOf1Recipe: Prefer ImmutableList#of(Object) over more contrived alternatives or alternatives that don't communicate the immutability of the resulting list at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOf2Recipe: Prefer ImmutableList#of(Object, Object) over alternatives that don't communicate the immutability of the resulting list at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOf3Recipe: Prefer ImmutableList#of(Object, Object, Object) over alternatives that don't communicate the immutability of the resulting list at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOf4Recipe: Prefer ImmutableList#of(Object, Object, Object, Object) over alternatives that don't communicate the immutability of the resulting list at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOf5Recipe: Prefer ImmutableList#of(Object, Object, Object, Object, Object) over alternatives that don't communicate the immutability of the resulting list at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOfRecipe: Prefer ImmutableList#of() over more contrived alternatives or alternatives that don't communicate the immutability of the resulting list at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListSortedCopyOfRecipe: Prefer ImmutableList#sortedCopyOf(Iterable) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListSortedCopyOfWithCustomComparatorRecipe: Prefer ImmutableList#sortedCopyOf(Comparator, Iterable) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$IterableToImmutableListRecipe: Prefer ImmutableList#copyOf(Iterable) and variants over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$StreamToDistinctImmutableListRecipe: Collecting to an ImmutableSet and converting the result to an ImmutableList may be more efficient than deduplicating a stream and collecting the result to an ImmutableList.
  • tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$StreamToImmutableListRecipe: Prefer ImmutableList#toImmutableList() over less idiomatic alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes: Refaster rules related to expressions dealing with ImmutableMaps. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$EntryIterableToImmutableMapRecipe: Prefer ImmutableMap#copyOf(Iterable) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$EntryToImmutableMapRecipe: Prefer ImmutableMap#of(Object, Object) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapBuilderBuildOrThrowRecipe: Prefer ImmutableMap.Builder#buildOrThrow() over the less explicit ImmutableMap.Builder#build().
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapBuilderRecipe: Prefer ImmutableMap#builder() over the associated constructor.
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOf1Recipe: Prefer ImmutableMap#of(Object, Object) over more contrived alternatives or alternatives that don't communicate the immutability of the resulting map at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOf2Recipe: Prefer ImmutableMap#of(Object, Object, Object, Object) over alternatives that don't communicate the immutability of the resulting map at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOf3Recipe: Prefer ImmutableMap#of(Object, Object, Object, Object, Object, Object) over alternatives that don't communicate the immutability of the resulting map at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOf4Recipe: Prefer ImmutableMap#of(Object, Object, Object, Object, Object, Object, Object, Object) over alternatives that don't communicate the immutability of the resulting map at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOf5Recipe: Prefer ImmutableMap#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) over alternatives that don't communicate the immutability of the resulting map at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOfRecipe: Prefer ImmutableMap#of() over more contrived alternatives or alternatives that don't communicate the immutability of the resulting map at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableMultisetRulesRecipes: Refaster rules related to expressions dealing with ImmutableMultisets. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableMultisetRulesRecipes$EmptyImmutableMultisetRecipe: Prefer ImmutableMultiset#of() over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableMultisetRulesRecipes$ImmutableMultisetBuilderRecipe: Prefer ImmutableMultiset#builder() over the associated constructor.
  • tech.picnic.errorprone.refasterrules.ImmutableMultisetRulesRecipes$IterableToImmutableMultisetRecipe: Prefer ImmutableMultiset#copyOf(Iterable) and variants over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableMultisetRulesRecipes$StreamToImmutableMultisetRecipe: Prefer ImmutableMultiset#toImmutableMultiset() over less idiomatic alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes: Refaster rules related to expressions dealing with ImmutableSetMultimaps. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$EmptyImmutableSetMultimapRecipe: Prefer ImmutableSetMultimap#of() over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$EntryToImmutableSetMultimapRecipe: Prefer ImmutableSetMultimap#of(Object, Object) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$ImmutableSetMultimapBuilderRecipe: Prefer ImmutableSetMultimap#builder() over the associated constructor.
  • tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$IterableToImmutableSetMultimapRecipe: Prefer ImmutableSetMultimap#copyOf(Iterable) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$PairToImmutableSetMultimapRecipe: Prefer ImmutableSetMultimap#of(Object, Object) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$TransformMultimapValuesToImmutableSetMultimap2Recipe: Prefer creating an immutable copy of the result of Multimaps#transformValues(Multimap, com.google.common.base.Function) over creating and directly collecting a stream.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes: Refaster rules related to expressions dealing with ImmutableSets. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetBuilderRecipe: Prefer ImmutableSet#builder() over the associated constructor.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetCopyOfSetViewRecipe: Prefer SetView#immutableCopy() over the more verbose alternative.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOf1Recipe: Prefer ImmutableSet#of(Object) over more contrived alternatives or alternatives that don't communicate the immutability of the resulting set at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOf2Recipe: Prefer ImmutableSet#of(Object, Object) over alternatives that don't communicate the immutability of the resulting set at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOf3Recipe: Prefer ImmutableSet#of(Object, Object, Object) over alternatives that don't communicate the immutability of the resulting set at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOf4Recipe: Prefer ImmutableSet#of(Object, Object, Object, Object) over alternatives that don't communicate the immutability of the resulting set at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOf5Recipe: Prefer ImmutableSet#of(Object, Object, Object, Object, Object) over alternatives that don't communicate the immutability of the resulting set at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOfRecipe: Prefer ImmutableSet#of() over more contrived alternatives or alternatives that don't communicate the immutability of the resulting set at the type level.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$IterableToImmutableSetRecipe: Prefer ImmutableSet#copyOf(Iterable) and variants over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsDifferenceMapRecipe: Prefer an immutable copy of Sets#difference(Set, Set) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsDifferenceMultimapRecipe: Prefer an immutable copy of Sets#difference(Set, Set) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsDifferenceRecipe: Prefer an immutable copy of Sets#difference(Set, Set) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsIntersectionMapRecipe: Prefer an immutable copy of Sets#intersection(Set, Set) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsIntersectionMultimapRecipe: Prefer an immutable copy of Sets#intersection(Set, Set) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsIntersectionRecipe: Prefer an immutable copy of Sets#intersection(Set, Set) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsUnionRecipe: Prefer an immutable copy of Sets#union(Set, Set) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$StreamToImmutableSetRecipe: Prefer ImmutableSet#toImmutableSet() over less idiomatic alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes: Refaster rules related to expressions dealing with ImmutableSortedMaps. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$EmptyImmutableSortedMapRecipe: Prefer ImmutableSortedMap#of() over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$EntryToImmutableSortedMapRecipe: Prefer ImmutableSortedMap#of(Object, Object) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$ImmutableSortedMapBuilderRecipe: Prefer ImmutableSortedMap#orderedBy(Comparator) over the associated constructor.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$ImmutableSortedMapNaturalOrderBuilderRecipe: Prefer ImmutableSortedMap#naturalOrder() over the alternative that requires explicitly providing the Comparator.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$ImmutableSortedMapReverseOrderBuilderRecipe: Prefer ImmutableSortedMap#reverseOrder() over the alternative that requires explicitly providing the Comparator.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$IterableToImmutableSortedMapRecipe: Prefer ImmutableSortedMap#copyOf(Iterable) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$PairToImmutableSortedMapRecipe: Prefer ImmutableSortedMap#of(Object, Object) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes: Refaster rules related to expressions dealing with ImmutableSortedMultisets. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$EmptyImmutableSortedMultisetRecipe: Prefer ImmutableSortedMultiset#of() over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$ImmutableSortedMultisetBuilderRecipe: Prefer ImmutableSortedMultiset#orderedBy(Comparator) over the associated constructor.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$ImmutableSortedMultisetNaturalOrderBuilderRecipe: Prefer ImmutableSortedMultiset#naturalOrder() over the alternative that requires explicitly providing the Comparator.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$ImmutableSortedMultisetReverseOrderBuilderRecipe: Prefer ImmutableSortedMultiset#reverseOrder() over the alternative that requires explicitly providing the Comparator.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$IterableToImmutableSortedMultisetRecipe: Prefer ImmutableSortedMultiset#copyOf(Iterable) and variants over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$StreamToImmutableSortedMultisetRecipe: Prefer ImmutableSortedMultiset#toImmutableSortedMultiset(Comparator) over less idiomatic alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes: Refaster rules related to expressions dealing with ImmutableSortedSets. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$EmptyImmutableSortedSetRecipe: Prefer ImmutableSortedSet#of() over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$ImmutableSortedSetBuilderRecipe: Prefer ImmutableSortedSet#orderedBy(Comparator) over the associated constructor.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$ImmutableSortedSetNaturalOrderBuilderRecipe: Prefer ImmutableSortedSet#naturalOrder() over the alternative that requires explicitly providing the Comparator.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$ImmutableSortedSetReverseOrderBuilderRecipe: Prefer ImmutableSortedSet#reverseOrder() over the alternative that requires explicitly providing the Comparator.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$IterableToImmutableSortedSetRecipe: Prefer ImmutableSortedSet#copyOf(Iterable) and variants over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$StreamToImmutableSortedSetRecipe: Prefer ImmutableSortedSet#toImmutableSortedSet(Comparator) over less idiomatic alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableTableRulesRecipes: Refaster rules related to expressions dealing with ImmutableTables. Source.
  • tech.picnic.errorprone.refasterrules.ImmutableTableRulesRecipes$CellToImmutableTableRecipe: Prefer ImmutableTable#of(Object, Object, Object) over more contrived alternatives.
  • tech.picnic.errorprone.refasterrules.ImmutableTableRulesRecipes$ImmutableTableBuilderBuildOrThrowRecipe: Prefer ImmutableTable.Builder#buildOrThrow() over the less explicit ImmutableTable.Builder#build().
  • tech.picnic.errorprone.refasterrules.ImmutableTableRulesRecipes$ImmutableTableBuilderRecipe: Prefer ImmutableTable#builder() over the associated constructor.
  • tech.picnic.errorprone.refasterrules.ImmutableTableRulesRecipes$ImmutableTableOfRecipe: Prefer ImmutableTable#of() over more contrived alternatives .
  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsInstanceOf<T> {

@BeforeTemplate
void before(Object actual, Class<T> clazz) {
assertInstanceOf(clazz, actual);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Object actual, Class<T> clazz) {
assertThat(actual).isInstanceOf(clazz);
}
}

.

  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByIsExactlyInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByIsExactlyInstanceOf<T extends Throwable> {

@BeforeTemplate
void before(Executable throwingCallable, Class<T> clazz) {
assertThrowsExactly(clazz, throwingCallable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, Class<T> clazz) {
assertThatThrownBy(throwingCallable).isExactlyInstanceOf(clazz);
}
}

.

  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByIsInstanceOf<T extends Throwable> {

@BeforeTemplate
void before(Executable throwingCallable, Class<T> clazz) {
assertThrows(clazz, throwingCallable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, Class<T> clazz) {
assertThatThrownBy(throwingCallable).isInstanceOf(clazz);
}
}

.

  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByWithFailMessageStringIsExactlyInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByWithFailMessageStringIsExactlyInstanceOf<T extends Throwable> {

@BeforeTemplate
void before(Executable throwingCallable, String message, Class<T> clazz) {
assertThrowsExactly(clazz, throwingCallable, message);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, String message, Class<T> clazz) {
assertThatThrownBy(throwingCallable).withFailMessage(message).isExactlyInstanceOf(clazz);
}
}

.

  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByWithFailMessageStringIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByWithFailMessageStringIsInstanceOf<T extends Throwable> {

@BeforeTemplate
void before(Executable throwingCallable, String message, Class<T> clazz) {
assertThrows(clazz, throwingCallable, message);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, String message, Class<T> clazz) {
assertThatThrownBy(throwingCallable).withFailMessage(message).isInstanceOf(clazz);
}
}

.

  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByWithFailMessageSupplierIsExactlyInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByWithFailMessageSupplierIsExactlyInstanceOf<T extends Throwable> {

@BeforeTemplate
void before(Executable throwingCallable, Supplier<String> supplier, Class<T> clazz) {
assertThrowsExactly(clazz, throwingCallable, supplier);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, Supplier<String> supplier, Class<T> clazz) {
assertThatThrownBy(throwingCallable).withFailMessage(supplier).isExactlyInstanceOf(clazz);
}
}

.

  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByWithFailMessageSupplierIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByWithFailMessageSupplierIsInstanceOf<T extends Throwable> {

@BeforeTemplate
void before(Executable throwingCallable, Supplier<String> supplier, Class<T> clazz) {
assertThrows(clazz, throwingCallable, supplier);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, Supplier<String> supplier, Class<T> clazz) {
assertThatThrownBy(throwingCallable).withFailMessage(supplier).isInstanceOf(clazz);
}
}

.

  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatWithFailMessageStringIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatWithFailMessageStringIsInstanceOf<T> {

@BeforeTemplate
void before(Object actual, String message, Class<T> clazz) {
assertInstanceOf(clazz, actual, message);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Object actual, String message, Class<T> clazz) {
assertThat(actual).withFailMessage(message).isInstanceOf(clazz);
}
}

.

  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatWithFailMessageSupplierIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatWithFailMessageSupplierIsInstanceOf<T> {

@BeforeTemplate
void before(Object actual, Supplier<String> supplier, Class<T> clazz) {
assertInstanceOf(clazz, actual, supplier);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Object actual, Supplier<String> supplier, Class<T> clazz) {
assertThat(actual).withFailMessage(supplier).isInstanceOf(clazz);
}
}

.

static final class Fail<T> {

@BeforeTemplate
T before() {
return Assertions.fail();
}

@AfterTemplate
@DoNotCall
T after() {
return fail();
}
}

.

  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$FailWithMessageAndThrowableRecipe: Recipe created for the following Refaster template:
static final class FailWithMessageAndThrowable<T> {

@BeforeTemplate
T before(String message, Throwable throwable) {
return Assertions.fail(message, throwable);
}

@AfterTemplate
T after(String message, Throwable throwable) {
return fail(message, throwable);
}
}

.

  • tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$FailWithMessageRecipe: Recipe created for the following Refaster template:
static final class FailWithMessage<T> {

@BeforeTemplate
T before(String message) {
return Assertions.fail(message);
}

@AfterTemplate
T after(String message) {
return fail(message);
}
}

.

static final class FailWithThrowable<T> {

@BeforeTemplate
T before(Throwable throwable) {
return Assertions.fail(throwable);
}

@AfterTemplate
@DoNotCall
T after(Throwable throwable) {
return fail(throwable);
}
}

.

static final class MapGetOrNull<K, V, T> {

@BeforeTemplate
@Nullable
V before(Map<K, V> map, T key) {
return map.getOrDefault(key, null);
}

@AfterTemplate
@Nullable
V after(Map<K, V> map, T key) {
return map.get(key);
}
}

.

static final class OptionalOfNullable<T> {

@BeforeTemplate
@SuppressWarnings(value = "TernaryOperatorOptionalNegativeFiltering")
Optional<T> before(@Nullable
T object) {
return object == null ? Optional.empty() : Optional.of(object);
}

@AfterTemplate
Optional<T> after(T object) {
return Optional.ofNullable(object);
}
}

.

static final class OrOrElseThrow<T> {

@BeforeTemplate
@SuppressWarnings(value = "NullAway")
T before(Optional<T> o1, Optional<T> o2) {
return o1.orElseGet(()->o2.orElseThrow());
}

@AfterTemplate
@SuppressWarnings(value = "NullAway")
T after(Optional<T> o1, Optional<T> o2) {
return o1.or(()->o2).orElseThrow();
}
}

.

static final class StreamCount<T> {

@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
long before(Stream<T> stream) {
return stream.collect(counting());
}

@AfterTemplate
long after(Stream<T> stream) {
return stream.count();
}
}

.

static final class StreamFilterCollect<T, R> {

@BeforeTemplate
R before(Stream<T> stream, Predicate<? super T> predicate, Collector<? super T, ?, R> collector) {
return stream.collect(filtering(predicate, collector));
}

@AfterTemplate
R after(Stream<T> stream, Predicate<? super T> predicate, Collector<? super T, ?, R> collector) {
return stream.filter(predicate).collect(collector);
}
}

.

static final class StreamFlatMapCollect<T, U, R> {

@BeforeTemplate
R before(Stream<T> stream, Function<? super T, ? extends Stream<? extends U>> mapper, Collector<? super U, ?, R> collector) {
return stream.collect(flatMapping(mapper, collector));
}

@AfterTemplate
R after(Stream<T> stream, Function<? super T, ? extends Stream<? extends U>> mapper, Collector<? super U, ?, R> collector) {
return stream.flatMap(mapper).collect(collector);
}
}

.

static final class StreamMapCollect<T, U, R> {

@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
R before(Stream<T> stream, Function<? super T, ? extends U> mapper, Collector<? super U, ?, R> collector) {
return stream.collect(mapping(mapper, collector));
}

@AfterTemplate
R after(Stream<T> stream, Function<? super T, ? extends U> mapper, Collector<? super U, ?, R> collector) {
return stream.map(mapper).collect(collector);
}
}

.

  • tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMapFilterRecipe: Prefer an unconditional Map#get(Object) call followed by a null check over a call to Map#containsKey(Object), as the former avoids a second lookup operation.
  • tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMapFirstRecipe: Where possible, clarify that a mapping operation will be applied only to a single stream element.
  • tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMapToDoubleSummaryStatisticsRecipe: Recipe created for the following Refaster template:
static final class StreamMapToDoubleSummaryStatistics<T> {

@BeforeTemplate
DoubleSummaryStatistics before(Stream<T> stream, ToDoubleFunction<T> mapper) {
return stream.collect(summarizingDouble(mapper));
}

@AfterTemplate
DoubleSummaryStatistics after(Stream<T> stream, ToDoubleFunction<T> mapper) {
return stream.mapToDouble(mapper).summaryStatistics();
}
}

.

static final class StreamMapToIntSummaryStatistics<T> {

@BeforeTemplate
IntSummaryStatistics before(Stream<T> stream, ToIntFunction<T> mapper) {
return stream.collect(summarizingInt(mapper));
}

@AfterTemplate
IntSummaryStatistics after(Stream<T> stream, ToIntFunction<T> mapper) {
return stream.mapToInt(mapper).summaryStatistics();
}
}

.

static final class StreamMapToLongSummaryStatistics<T> {

@BeforeTemplate
LongSummaryStatistics before(Stream<T> stream, ToLongFunction<T> mapper) {
return stream.collect(summarizingLong(mapper));
}

@AfterTemplate
LongSummaryStatistics after(Stream<T> stream, ToLongFunction<T> mapper) {
return stream.mapToLong(mapper).summaryStatistics();
}
}

.

static final class StreamMaxNaturalOrder<T extends Comparable<? super T>> {

@BeforeTemplate
Optional<T> before(Stream<T> stream) {
return Refaster.anyOf(stream.min(reverseOrder()), Streams.findLast(stream.sorted()));
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
Optional<T> after(Stream<T> stream) {
return stream.max(naturalOrder());
}
}

.

static final class StreamMax<T> {

@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
Optional<T> before(Stream<T> stream, Comparator<? super T> comparator) {
return Refaster.anyOf(stream.min(comparator.reversed()), Streams.findLast(stream.sorted(comparator)), stream.collect(maxBy(comparator)));
}

@AfterTemplate
Optional<T> after(Stream<T> stream, Comparator<? super T> comparator) {
return stream.max(comparator);
}
}

.

static final class StreamMinNaturalOrder<T extends Comparable<? super T>> {

@BeforeTemplate
Optional<T> before(Stream<T> stream) {
return Refaster.anyOf(stream.max(reverseOrder()), stream.sorted().findFirst());
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
Optional<T> after(Stream<T> stream) {
return stream.min(naturalOrder());
}
}

.

static final class StreamMin<T> {

@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
Optional<T> before(Stream<T> stream, Comparator<? super T> comparator) {
return Refaster.anyOf(stream.max(comparator.reversed()), stream.sorted(comparator).findFirst(), stream.collect(minBy(comparator)));
}

@AfterTemplate
Optional<T> after(Stream<T> stream, Comparator<? super T> comparator) {
return stream.min(comparator);
}
}

.

static final class StreamReduce<T> {

@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
Optional<T> before(Stream<T> stream, BinaryOperator<T> accumulator) {
return stream.collect(reducing(accumulator));
}

@AfterTemplate
Optional<T> after(Stream<T> stream, BinaryOperator<T> accumulator) {
return stream.reduce(accumulator);
}
}

.

  • tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamReduceWithIdentityRecipe: Recipe created for the following Refaster template:
static final class StreamReduceWithIdentity<T> {

@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
T before(Stream<T> stream, T identity, BinaryOperator<T> accumulator) {
return stream.collect(reducing(identity, accumulator));
}

@AfterTemplate
T after(Stream<T> stream, T identity, BinaryOperator<T> accumulator) {
return stream.reduce(identity, accumulator);
}
}

.

static final class StreamTakeWhile<T> {

@BeforeTemplate
Stream<T> before(Stream<T> stream, Predicate<? super T> predicate) {
return stream.takeWhile(predicate).filter(predicate);
}

@AfterTemplate
Stream<T> after(Stream<T> stream, Predicate<? super T> predicate) {
return stream.takeWhile(predicate);
}
}

.

  • tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualIterableIterationOrderRecipe: Recipe created for the following Refaster template:
static final class AssertEqualIterableIterationOrder<S, T extends S> {

@BeforeTemplate
void before(Iterable<S> actual, Iterable<T> expected) {
assertEquals(actual, expected);
}

@BeforeTemplate
void before(Collection<S> actual, Collection<T> expected) {
assertEquals(actual, expected);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Iterable<S> actual, Iterable<T> expected) {
assertThat(actual).containsExactlyElementsOf(expected);
}
}

.

  • tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualIterableIterationOrderWithMessageRecipe: Recipe created for the following Refaster template:
static final class AssertEqualIterableIterationOrderWithMessage<S, T extends S> {

@BeforeTemplate
void before(Iterable<S> actual, String message, Iterable<T> expected) {
assertEquals(actual, expected, message);
}

@BeforeTemplate
void before(Collection<S> actual, String message, Collection<T> expected) {
assertEquals(actual, expected, message);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Iterable<S> actual, String message, Iterable<T> expected) {
assertThat(actual).withFailMessage(message).containsExactlyElementsOf(expected);
}
}

.

  • tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualIteratorIterationOrderRecipe: Recipe created for the following Refaster template:
static final class AssertEqualIteratorIterationOrder<S, T extends S> {

@BeforeTemplate
void before(Iterator<S> actual, Iterator<T> expected) {
assertEquals(actual, expected);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Iterator<S> actual, Iterator<T> expected) {
assertThat(actual).toIterable().containsExactlyElementsOf(ImmutableList.copyOf(expected));
}
}

.

  • tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualIteratorIterationOrderWithMessageRecipe: Recipe created for the following Refaster template:
static final class AssertEqualIteratorIterationOrderWithMessage<S, T extends S> {

@BeforeTemplate
void before(Iterator<S> actual, String message, Iterator<T> expected) {
assertEquals(actual, expected, message);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Iterator<S> actual, String message, Iterator<T> expected) {
assertThat(actual).toIterable().withFailMessage(message).containsExactlyElementsOf(ImmutableList.copyOf(expected));
}
}

.

  • tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualSetsRecipe: Recipe created for the following Refaster template:
static final class AssertEqualSets<S, T extends S> {

@BeforeTemplate
void before(Set<S> actual, Set<T> expected) {
assertEquals(actual, expected);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Set<S> actual, Set<T> expected) {
assertThat(actual).hasSameElementsAs(expected);
}
}

.

  • tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualSetsWithMessageRecipe: Recipe created for the following Refaster template:
static final class AssertEqualSetsWithMessage<S, T extends S> {

@BeforeTemplate
void before(Set<S> actual, String message, Set<T> expected) {
assertEquals(actual, expected, message);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Set<S> actual, String message, Set<T> expected) {
assertThat(actual).withFailMessage(message).hasSameElementsAs(expected);
}
}

.

  • tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertThrowsWithTypeRecipe: Recipe created for the following Refaster template:
static final class AssertThrowsWithType<T extends Throwable> {

@BeforeTemplate
void before(ThrowingRunnable runnable, Class<T> clazz) {
assertThrows(clazz, runnable);
}

@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable runnable, Class<T> clazz) {
assertThatThrownBy(runnable).isInstanceOf(clazz);
}
}

.

  • tech.picnic.errorprone.refasterrules.WebClientRulesRecipes$BodyValueRecipe: Prefer RequestBodySpec#bodyValue(Object) over more contrived alternatives.

Removed Recipes​

  • org.openrewrite.recipes.JavaRecipeBestPractices: Best practices for Java recipe development.
  • org.openrewrite.recipes.RecipeNullabilityBestPractices: Use JSpecify nullable annotations; drop Nonnull annotations; use NullMarked on package-info.java instead.
  • org.openrewrite.recipes.RecipeTestingBestPractices: Best practices for testing recipes.

Changed Recipes​

  • org.openrewrite.kubernetes.services.FindServiceExternalIPs was changed:
    • Old Options:
      • externalIPs: { type: Set, required: true }
      • fileMatcher: { type: String, required: false }
      • findMissing: { type: boolean, required: false }
    • New Options:
      • externalIPs: { type: Set, required: true }
      • fileMatcher: { type: String, required: false }
      • findMissing: { type: Boolean, required: false }