diff --git a/baseline-refaster-rules/src/main/java/com/palantir/baseline/refaster/AssertjCollectionIsNotEmpty.java b/baseline-refaster-rules/src/main/java/com/palantir/baseline/refaster/AssertjCollectionIsNotEmpty.java index 386ec67ed6..1d359f180f 100644 --- a/baseline-refaster-rules/src/main/java/com/palantir/baseline/refaster/AssertjCollectionIsNotEmpty.java +++ b/baseline-refaster-rules/src/main/java/com/palantir/baseline/refaster/AssertjCollectionIsNotEmpty.java @@ -18,9 +18,12 @@ import static org.assertj.core.api.Assertions.assertThat; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; import java.util.Collection; +import java.util.Collections; public final class AssertjCollectionIsNotEmpty { @@ -39,6 +42,36 @@ void bad3(Collection things) { assertThat(things.size()).isNotEqualTo(0); } + @BeforeTemplate + void bad4(Collection things) { + assertThat(things.isEmpty()).isFalse(); + } + + @BeforeTemplate + void bad5(Collection things) { + assertThat(!things.isEmpty()).isTrue(); + } + + @BeforeTemplate + void bad6(Collection things) { + assertThat(things).isNotEqualTo(Collections.emptyList()); + } + + @BeforeTemplate + void bad7(Collection things) { + assertThat(things).isNotEqualTo(Collections.emptySet()); + } + + @BeforeTemplate + void bad8(Collection things) { + assertThat(things).isNotEqualTo(ImmutableList.of()); + } + + @BeforeTemplate + void bad9(Collection things) { + assertThat(things).isNotEqualTo(ImmutableSet.of()); + } + @AfterTemplate void after(Collection things) { assertThat(things).isNotEmpty();