Extended test cases for AssertThatBooleanCondition and AssertThatObjectIsNullOrNotNull.
This commit is contained in:
parent
3ece81b024
commit
e55acf9c74
@ -14,7 +14,7 @@ internal class AssertThatBooleanConditionInspectionTest : AbstractCajonTest() {
|
||||
runTest {
|
||||
myFixture.enableInspections(AssertThatBooleanConditionInspection::class.java)
|
||||
myFixture.configureByFile("BooleanConditionBefore.java")
|
||||
executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isTrue()"), 4)
|
||||
executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isTrue()"), 6)
|
||||
executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isFalse()"), 5)
|
||||
executeQuickFixes(myFixture, Regex.fromLiteral("Replace isNotEqualTo() with isTrue()"), 4)
|
||||
executeQuickFixes(myFixture, Regex.fromLiteral("Replace isNotEqualTo() with isFalse()"), 4)
|
||||
|
@ -14,8 +14,8 @@ internal class AssertThatObjectIsNullOrNotNullInspectionTest : AbstractCajonTest
|
||||
runTest {
|
||||
myFixture.enableInspections(AssertThatObjectIsNullOrNotNullInspection::class.java)
|
||||
myFixture.configureByFile("ObjectIsNullOrNotNullBefore.java")
|
||||
executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isNull()"), 3)
|
||||
executeQuickFixes(myFixture, Regex.fromLiteral("Replace isNotEqualTo() with isNotNull()"), 3)
|
||||
executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isNull()"), 4)
|
||||
executeQuickFixes(myFixture, Regex.fromLiteral("Replace isNotEqualTo() with isNotNull()"), 4)
|
||||
myFixture.checkResultByFile("ObjectIsNullOrNotNullAfter.java")
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class BooleanCondition {
|
||||
boolean primitive = false;
|
||||
Boolean object = Boolean.TRUE;
|
||||
|
||||
assertThat(primitive).isTrue();
|
||||
assertThat(primitive).as("foo").isTrue();
|
||||
assertThat(primitive).isFalse();
|
||||
assertThat(object).isTrue();
|
||||
assertThat(object).isFalse();
|
||||
@ -15,7 +15,7 @@ public class BooleanCondition {
|
||||
assertThat(object).isTrue();
|
||||
assertThat(object).isFalse();
|
||||
|
||||
assertThat(primitive).isFalse();
|
||||
assertThat(primitive).as("foo").isFalse();
|
||||
assertThat(primitive).isTrue();
|
||||
assertThat(object).isFalse();
|
||||
assertThat(object).isTrue();
|
||||
@ -28,5 +28,7 @@ public class BooleanCondition {
|
||||
assertThat(object).isEqualTo(Boolean.TRUE && !Boolean.TRUE);
|
||||
|
||||
assertThat("").isEqualTo(Boolean.TRUE);
|
||||
|
||||
assertThat(primitive).isTrue().as("foo").isTrue().as("bar").isTrue().isFalse();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class BooleanCondition {
|
||||
boolean primitive = false;
|
||||
Boolean object = Boolean.TRUE;
|
||||
|
||||
assertThat(primitive).isEqualTo(Boolean.TRUE);
|
||||
assertThat(primitive).as("foo").isEqualTo(Boolean.TRUE);
|
||||
assertThat(primitive).isEqualTo(Boolean.FALSE);
|
||||
assertThat(object).isEqualTo(Boolean.TRUE);
|
||||
assertThat(object).isEqualTo(Boolean.FALSE);
|
||||
@ -15,7 +15,7 @@ public class BooleanCondition {
|
||||
assertThat(object).isEqualTo(true);
|
||||
assertThat(object).isEqualTo(false);
|
||||
|
||||
assertThat(primitive).isNotEqualTo(Boolean.TRUE);
|
||||
assertThat(primitive).as("foo").isNotEqualTo(Boolean.TRUE);
|
||||
assertThat(primitive).isNotEqualTo(Boolean.FALSE);
|
||||
assertThat(object).isNotEqualTo(Boolean.TRUE);
|
||||
assertThat(object).isNotEqualTo(Boolean.FALSE);
|
||||
@ -28,5 +28,7 @@ public class BooleanCondition {
|
||||
assertThat(object).isEqualTo(Boolean.TRUE && !Boolean.TRUE);
|
||||
|
||||
assertThat("").isEqualTo(Boolean.TRUE);
|
||||
|
||||
assertThat(primitive).isEqualTo(Boolean.TRUE).as("foo").isEqualTo(true).as("bar").isTrue().isFalse();
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,7 @@ public class ObjectIsNull {
|
||||
assertThat("").isNotNull();
|
||||
assertThat("").as("nah").isNotNull();
|
||||
assertThat(new Object()).isNotNull();
|
||||
|
||||
assertThat(new Object()).as("foo").isNotNull().as("bar").isEqualTo(new Object()).as("etc").isNull();
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,7 @@ public class ObjectIsNull {
|
||||
assertThat("").isNotEqualTo(null);
|
||||
assertThat("").as("nah").isNotEqualTo(null);
|
||||
assertThat(new Object()).isNotEqualTo(null);
|
||||
|
||||
assertThat(new Object()).as("foo").isNotEqualTo(null).as("bar").isEqualTo(new Object()).as("etc").isEqualTo(null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user