Implemented AssertThatStringIsEmpty.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package de.platon42.intellij.playground;
|
||||
|
||||
import org.assertj.core.api.AbstractStringAssert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -48,4 +50,10 @@ public class Playground {
|
||||
assertThat("").isEqualTo(Boolean.TRUE);
|
||||
}
|
||||
|
||||
private void stringIsEmpty() {
|
||||
String foo = "bar";
|
||||
AbstractStringAssert<?> abstractStringAssert = assertThat(foo);
|
||||
abstractStringAssert.isEqualTo("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package de.platon42.intellij.plugins.cajon.inspections
|
||||
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
||||
import de.platon42.intellij.jupiter.MyFixture
|
||||
import de.platon42.intellij.jupiter.TestDataSubPath
|
||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class AssertThatStringIsEmptyInspectionTest : AbstractCajonTest() {
|
||||
|
||||
@Test
|
||||
@TestDataSubPath("inspections/StringIsEmpty")
|
||||
internal fun assertThat_with_isEqualTo_emptyString_can_use_isEmpty(@MyFixture myFixture: JavaCodeInsightTestFixture) {
|
||||
runTest {
|
||||
myFixture.enableInspections(AssertThatStringIsEmptyInspection::class.java)
|
||||
myFixture.configureByFile("StringIsEmptyBefore.java")
|
||||
executeQuickFixes(myFixture, Regex("Replace is.*"), 1)
|
||||
myFixture.checkResultByFile("StringIsEmptyAfter.java")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user