Skip to content

Commit

Permalink
More cases for AssertjCollectionIsNotEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdanfox committed Sep 18, 2019
1 parent 6f6b6b2 commit f114452
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> {

Expand All @@ -39,6 +42,36 @@ void bad3(Collection<T> things) {
assertThat(things.size()).isNotEqualTo(0);
}

@BeforeTemplate
void bad4(Collection<T> things) {
assertThat(things.isEmpty()).isFalse();
}

@BeforeTemplate
void bad5(Collection<T> things) {
assertThat(!things.isEmpty()).isTrue();
}

@BeforeTemplate
void bad6(Collection<T> things) {
assertThat(things).isNotEqualTo(Collections.emptyList());
}

@BeforeTemplate
void bad7(Collection<T> things) {
assertThat(things).isNotEqualTo(Collections.emptySet());
}

@BeforeTemplate
void bad8(Collection<T> things) {
assertThat(things).isNotEqualTo(ImmutableList.of());
}

@BeforeTemplate
void bad9(Collection<T> things) {
assertThat(things).isNotEqualTo(ImmutableSet.of());
}

@AfterTemplate
void after(Collection<T> things) {
assertThat(things).isNotEmpty();
Expand Down

0 comments on commit f114452

Please sign in to comment.