New inspection AssertThatBinaryExpressionIsTrueOrFalse that will find and fix common binary expressions and equals() statements (more than 150 combinations) inside assertThat().

This commit is contained in:
2019-04-07 11:29:07 +02:00
parent 6a44237ca0
commit 5812e72227
12 changed files with 712 additions and 15 deletions
+17
View File
@@ -93,6 +93,22 @@ The plugin also supports the conversion of the most common JUnit 4 assertions to
and analogously for collections...
- AssertThatBinaryExpressionIsTrueOrFalse
```
from: assertThat(primActual == primExpected).isTrue();
to: assertThat(primActual).isEqualTo(primExpected);
from: assertThat(10 < primActual).isNotEqualTo(false);
to: assertThat(primActual).isGreaterThan(primExpected);
from: assertThat(objActual != objExpected).isEqualTo(true);
to: assertThat(objActual).isNotSameAs(objExpected);
from: assertThat(null == objActual).isFalse();
to: assertThat(objActual).isNotNull();
```
and many, many more combinations (more than 150).
- JUnitAssertToAssertJ
```
assertTrue(condition);
@@ -182,3 +198,4 @@ Feel free to use the code (in package de.platon42.intellij.jupiter) for your pro
from: assertThat(object).extracting("propOne", "propNoGetter", "propTwo.innerProp")...
to: assertThat(object).extracting(type::getPropOne, it -> it.propNoGetter, it -> it.getPropTwo().getInnerProp())...
```
- Kotlin support