Fixed broken code in test classes (missing imports, undefined variables).

This commit is contained in:
Chris Hodges 2019-07-30 19:39:16 +02:00
parent b84a781134
commit 5048c898ec
30 changed files with 56 additions and 28 deletions

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class BinaryExpression { public class BinaryExpression {
@ -196,7 +197,7 @@ public class BinaryExpression {
assertThat(numberObjAct.equals(numberObjExp)).as("doh!").isTrue().isEqualTo(true); assertThat(numberObjAct.equals(numberObjExp)).as("doh!").isTrue().isEqualTo(true);
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(stringAct, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class BinaryExpression { public class BinaryExpression {
@ -196,7 +197,7 @@ public class BinaryExpression {
assertThat(numberObjAct.equals(numberObjExp)).as("doh!").isTrue().isEqualTo(true); assertThat(numberObjAct.equals(numberObjExp)).as("doh!").isTrue().isEqualTo(true);
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(stringAct, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class BooleanCondition { public class BooleanCondition {
@ -32,7 +33,7 @@ public class BooleanCondition {
assertThat(primitive).isTrue().as("foo").isTrue().as("bar").isTrue().isFalse(); assertThat(primitive).isTrue().as("foo").isTrue().as("bar").isTrue().isFalse();
assertThat(object).isEqualTo(Boolean.TYPE); assertThat(object).isEqualTo(Boolean.TYPE);
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(object, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class BooleanCondition { public class BooleanCondition {
@ -32,7 +33,7 @@ public class BooleanCondition {
assertThat(primitive).isEqualTo(Boolean.TRUE).as("foo").isEqualTo(true).as("bar").isTrue().isFalse(); assertThat(primitive).isEqualTo(Boolean.TRUE).as("foo").isEqualTo(true).as("bar").isTrue().isFalse();
assertThat(object).isEqualTo(Boolean.TYPE); assertThat(object).isEqualTo(Boolean.TYPE);
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(object, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import java.util.*; import java.util.*;
@ -41,7 +42,7 @@ public class CollectionMapExpression {
assertThat(stringList.isEmpty()).as("foo").isEqualTo(false).as("bar").isTrue(); assertThat(stringList.isEmpty()).as("foo").isEqualTo(false).as("bar").isTrue();
assertThat(stringList.isEmpty()).as("foo").satisfies(it -> it.booleanValue()).as("bar").isFalse(); assertThat(stringList.isEmpty()).as("foo").satisfies(it -> it.booleanValue()).as("bar").isFalse();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(stringList, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import java.util.*; import java.util.*;
@ -41,7 +42,7 @@ public class CollectionMapExpression {
assertThat(stringList.isEmpty()).as("foo").isEqualTo(false).as("bar").isTrue(); assertThat(stringList.isEmpty()).as("foo").isEqualTo(false).as("bar").isTrue();
assertThat(stringList.isEmpty()).as("foo").satisfies(it -> it.booleanValue()).as("bar").isFalse(); assertThat(stringList.isEmpty()).as("foo").satisfies(it -> it.booleanValue()).as("bar").isFalse();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(stringList, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,6 +1,7 @@
import java.util.ArrayList; import java.util.ArrayList;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class EnumerableIsEmpty { public class EnumerableIsEmpty {
@ -17,7 +18,7 @@ public class EnumerableIsEmpty {
assertThat("string").as("foo").hasSize(0).hasSameSizeAs("foo").isEmpty(); assertThat("string").as("foo").hasSize(0).hasSameSizeAs("foo").isEmpty();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat("foo", null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,6 +1,7 @@
import java.util.ArrayList; import java.util.ArrayList;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class EnumerableIsEmpty { public class EnumerableIsEmpty {
@ -17,7 +18,7 @@ public class EnumerableIsEmpty {
assertThat("string").as("foo").hasSize(0).hasSameSizeAs("foo").hasSize(0); assertThat("string").as("foo").hasSize(0).hasSameSizeAs("foo").hasSize(0);
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat("foo", null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,6 +1,7 @@
import com.google.common.base.Optional; import com.google.common.base.Optional;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.guava.api.Assertions.assertThat; import static org.assertj.guava.api.Assertions.assertThat;
public class GuavaOptional { public class GuavaOptional {
@ -59,7 +60,7 @@ public class GuavaOptional {
assertThat(opt.orNull()).as("foo").isEqualTo(null).isNotNull(); assertThat(opt.orNull()).as("foo").isEqualTo(null).isNotNull();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(opt, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,6 +1,7 @@
import com.google.common.base.Optional; import com.google.common.base.Optional;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.guava.api.Assertions.assertThat; import static org.assertj.guava.api.Assertions.assertThat;
public class GuavaOptional { public class GuavaOptional {
@ -59,7 +60,7 @@ public class GuavaOptional {
assertThat(opt.orNull()).as("foo").isEqualTo(null).isNotNull(); assertThat(opt.orNull()).as("foo").isEqualTo(null).isNotNull();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(opt, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -6,6 +6,7 @@ import java.util.Optional;
import java.util.function.Consumer; import java.util.function.Consumer;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.guava.api.Assertions.assertThat; import static org.assertj.guava.api.Assertions.assertThat;
public class ImplicitAssertion { public class ImplicitAssertion {
@ -285,7 +286,7 @@ public class ImplicitAssertion {
assertThat(guavaOptional).extractingValue().isEqualTo("foo"); assertThat(guavaOptional).extractingValue().isEqualTo("foo");
assertThat(guavaOptional).extractingCharSequence().isEqualTo("foo"); assertThat(guavaOptional).extractingCharSequence().isEqualTo("foo");
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(string, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -6,6 +6,7 @@ import java.util.Optional;
import java.util.function.Consumer; import java.util.function.Consumer;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.guava.api.Assertions.assertThat; import static org.assertj.guava.api.Assertions.assertThat;
public class ImplicitAssertion { public class ImplicitAssertion {
@ -285,7 +286,7 @@ public class ImplicitAssertion {
assertThat(guavaOptional).isPresent().extractingValue().isEqualTo("foo"); assertThat(guavaOptional).isPresent().extractingValue().isEqualTo("foo");
assertThat(guavaOptional).isPresent().extractingCharSequence().isEqualTo("foo"); assertThat(guavaOptional).isPresent().extractingCharSequence().isEqualTo("foo");
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(string, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class InstanceOf { public class InstanceOf {
@ -22,7 +23,7 @@ public class InstanceOf {
assertThat(object).as("foo").isInstanceOf(Boolean.class).as("bar").isInstanceOf(Boolean.class); assertThat(object).as("foo").isInstanceOf(Boolean.class).as("bar").isInstanceOf(Boolean.class);
assertThat(object instanceof Boolean).as("foo").isEqualTo(Boolean.TRUE).as("bar").isEqualTo(false); assertThat(object instanceof Boolean).as("foo").isEqualTo(Boolean.TRUE).as("bar").isEqualTo(false);
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(object, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class InstanceOf { public class InstanceOf {
@ -22,7 +23,7 @@ public class InstanceOf {
assertThat(object instanceof Boolean).as("foo").isEqualTo(Boolean.TRUE).as("bar").isEqualTo(true); assertThat(object instanceof Boolean).as("foo").isEqualTo(Boolean.TRUE).as("bar").isEqualTo(true);
assertThat(object instanceof Boolean).as("foo").isEqualTo(Boolean.TRUE).as("bar").isEqualTo(false); assertThat(object instanceof Boolean).as("foo").isEqualTo(Boolean.TRUE).as("bar").isEqualTo(false);
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(object, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class InvertedBooleanCondition { public class InvertedBooleanCondition {
@ -36,7 +37,7 @@ public class InvertedBooleanCondition {
assertThat(primitive).as("foo").isFalse().as("bar").isFalse(); assertThat(primitive).as("foo").isFalse().as("bar").isFalse();
assertThat(primitive).as("foo").isFalse().as("bar").isTrue(); assertThat(primitive).as("foo").isFalse().as("bar").isTrue();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(object, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class InvertedBooleanCondition { public class InvertedBooleanCondition {
@ -36,7 +37,7 @@ public class InvertedBooleanCondition {
assertThat(!primitive).as("foo").isEqualTo(Boolean.TRUE).as("bar").isNotEqualTo(false); assertThat(!primitive).as("foo").isEqualTo(Boolean.TRUE).as("bar").isNotEqualTo(false);
assertThat(!primitive).as("foo").isEqualTo(Boolean.TRUE).as("bar").isNotEqualTo(true); assertThat(!primitive).as("foo").isEqualTo(Boolean.TRUE).as("bar").isNotEqualTo(true);
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(object, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,6 +1,7 @@
import java.util.Optional; import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class Java8Optional { public class Java8Optional {
@ -46,7 +47,7 @@ public class Java8Optional {
assertThat(opt.orElse(null)).as("foo").isEqualTo(null).isNotNull(); assertThat(opt.orElse(null)).as("foo").isEqualTo(null).isNotNull();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(opt, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,6 +1,7 @@
import java.util.Optional; import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class Java8Optional { public class Java8Optional {
@ -46,7 +47,7 @@ public class Java8Optional {
assertThat(opt.orElse(null)).as("foo").isEqualTo(null).isNotNull(); assertThat(opt.orElse(null)).as("foo").isEqualTo(null).isNotNull();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(opt, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -66,7 +66,7 @@ public class JoinStatements {
assertThat(list.get(--i)).isEqualTo("foo"); assertThat(list.get(--i)).isEqualTo("foo");
assertThat(list.get(--i)).isEqualTo("foo"); assertThat(list.get(--i)).isEqualTo("foo");
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(list, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -63,7 +63,7 @@ public class JoinStatements {
assertThat(list.get(--i)).isEqualTo("foo"); assertThat(list.get(--i)).isEqualTo("foo");
assertThat(list.get(--i)).isEqualTo("foo"); assertThat(list.get(--i)).isEqualTo("foo");
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(list, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class ObjectExpression { public class ObjectExpression {

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class ObjectExpression { public class ObjectExpression {

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class ObjectIsNull { public class ObjectIsNull {
@ -14,7 +15,7 @@ public class ObjectIsNull {
assertThat(new Object()).as("foo").isNotNull().as("bar").isEqualTo(new Object()).as("etc").isNull(); assertThat(new Object()).as("foo").isNotNull().as("bar").isEqualTo(new Object()).as("etc").isNull();
assertThat(new Object()).as("foo").isEqualTo(null).as("bar").isEqualTo(new Object()).as("etc").isNotNull(); assertThat(new Object()).as("foo").isEqualTo(null).as("bar").isEqualTo(new Object()).as("etc").isNotNull();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat("foo", null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class ObjectIsNull { public class ObjectIsNull {
@ -14,7 +15,7 @@ public class ObjectIsNull {
assertThat(new Object()).as("foo").isNotEqualTo(null).as("bar").isEqualTo(new Object()).as("etc").isEqualTo(null); assertThat(new Object()).as("foo").isNotEqualTo(null).as("bar").isEqualTo(new Object()).as("etc").isEqualTo(null);
assertThat(new Object()).as("foo").isEqualTo(null).as("bar").isEqualTo(new Object()).as("etc").isNotEqualTo(null); assertThat(new Object()).as("foo").isEqualTo(null).as("bar").isEqualTo(new Object()).as("etc").isNotEqualTo(null);
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat("foo", null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,6 +1,7 @@
import java.util.ArrayList; import java.util.ArrayList;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class Size { public class Size {
@ -104,7 +105,7 @@ public class Size {
assertThat(foo).isEqualTo(0); assertThat(foo).isEqualTo(0);
assertThat(string.length()).isPositive(); assertThat(string.length()).isPositive();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(string, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,6 +1,7 @@
import java.util.ArrayList; import java.util.ArrayList;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class Size { public class Size {
@ -104,7 +105,7 @@ public class Size {
assertThat(foo).isEqualTo(0); assertThat(foo).isEqualTo(0);
assertThat(string.length()).isPositive(); assertThat(string.length()).isPositive();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(string, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class StringExpression { public class StringExpression {
@ -50,7 +51,7 @@ public class StringExpression {
assertThat(string.endsWith("foo")).as("foo").isEqualTo(false).as("bar").isTrue(); assertThat(string.endsWith("foo")).as("foo").isEqualTo(false).as("bar").isTrue();
assertThat(string.endsWith("foo")).as("foo").satisfies(it -> it.booleanValue()).as("bar").isFalse(); assertThat(string.endsWith("foo")).as("foo").satisfies(it -> it.booleanValue()).as("bar").isFalse();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(string, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class StringExpression { public class StringExpression {
@ -50,7 +51,7 @@ public class StringExpression {
assertThat(string.endsWith("foo")).as("foo").isEqualTo(false).as("bar").isTrue(); assertThat(string.endsWith("foo")).as("foo").isEqualTo(false).as("bar").isTrue();
assertThat(string.endsWith("foo")).as("foo").satisfies(it -> it.booleanValue()).as("bar").isFalse(); assertThat(string.endsWith("foo")).as("foo").satisfies(it -> it.booleanValue()).as("bar").isFalse();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(string, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class StringIsEmpty { public class StringIsEmpty {
@ -19,7 +20,7 @@ public class StringIsEmpty {
assertThat(string).as("foo").isEqualTo("").as("bar").hasSize(0).hasSameSizeAs("foo").isEmpty(); assertThat(string).as("foo").isEqualTo("").as("bar").hasSize(0).hasSameSizeAs("foo").isEmpty();
assertThat(string).as("foo").isEqualTo("").as("bar").hasSize(0).hasSameSizeAs("foo").isEmpty(); assertThat(string).as("foo").isEqualTo("").as("bar").hasSize(0).hasSameSizeAs("foo").isEmpty();
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(string, null);
fail("oh no!"); fail("oh no!");
} }
} }

View File

@ -1,4 +1,5 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class StringIsEmpty { public class StringIsEmpty {
@ -19,7 +20,7 @@ public class StringIsEmpty {
assertThat(string).as("foo").isEqualTo("").as("bar").hasSize(0).hasSameSizeAs("foo").isEqualTo(""); assertThat(string).as("foo").isEqualTo("").as("bar").hasSize(0).hasSameSizeAs("foo").isEqualTo("");
assertThat(string).as("foo").isEqualTo("").as("bar").hasSize(0).hasSameSizeAs("foo").hasSize(0); assertThat(string).as("foo").isEqualTo("").as("bar").hasSize(0).hasSameSizeAs("foo").hasSize(0);
org.junit.Assert.assertThat(foo, null); org.junit.Assert.assertThat(string, null);
fail("oh no!"); fail("oh no!");
} }
} }