Implemented AssertThatEnumerableIsEmptyInspection. Improved literal values by constant value calculation, more refactoring.

This commit is contained in:
2019-03-24 14:42:02 +01:00
parent e2ffce753c
commit 582e254195
14 changed files with 160 additions and 31 deletions
@@ -0,0 +1,18 @@
import java.util.ArrayList;
import static org.assertj.core.api.Assertions.assertThat;
public class EnumerableIsEmpty {
private void enumerableIsEmpty() {
assertThat("string").as("foo").isEmpty();
assertThat(new StringBuilder()).as("bar").isEmpty();
assertThat(new ArrayList<Long>()).as("etc").isEmpty();
assertThat(new Long[1]).as("etc").isEmpty();
assertThat("string").as("foo").hasSize(1);
assertThat(new StringBuilder()).as("bar").hasSize(1);
assertThat(new ArrayList<Long>()).as("etc").hasSize(1);
assertThat(new Long[1]).as("etc").hasSize(1);
}
}
@@ -0,0 +1,18 @@
import java.util.ArrayList;
import static org.assertj.core.api.Assertions.assertThat;
public class EnumerableIsEmpty {
private void enumerableIsEmpty() {
assertThat("string").as("foo").hasSize(0);
assertThat(new StringBuilder()).as("bar").hasSize(0 + 0);
assertThat(new ArrayList<Long>()).as("etc").hasSize(10 / 100);
assertThat(new Long[1]).as("etc").hasSize(1 - 1);
assertThat("string").as("foo").hasSize(1);
assertThat(new StringBuilder()).as("bar").hasSize(1);
assertThat(new ArrayList<Long>()).as("etc").hasSize(1);
assertThat(new Long[1]).as("etc").hasSize(1);
}
}
@@ -11,7 +11,7 @@ public class StringIsEmpty {
assertThat(string).as("bar").hasSize(0);
assertThat(stringBuilder).isEqualTo("foo");
assertThat(stringBuilder).as("foo").isEqualTo("");
assertThat(stringBuilder).as("foo").isEqualTo("" + "");
assertThat(stringBuilder).as("bar").hasSize(0);
assertThat(new Object()).isEqualTo("");