Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;

import static org.openrewrite.java.Assertions.java;

@SuppressWarnings("DoubleNegation")
class BooleanChecksNotInvertedTest implements RewriteTest {

@Override
public void defaults(RecipeSpec spec) {
spec.recipe(new BooleanChecksNotInverted());
}

@DocumentExample
@SuppressWarnings("StatementWithEmptyBody")
@Test
void rspec1940() {
rewriteRun(
spec -> spec.recipe(new BooleanChecksNotInverted()),
//language=java
java(
"""
Expand Down Expand Up @@ -61,7 +66,6 @@ void test() {
@Test
void doubleNegation() {
rewriteRun(
spec -> spec.recipe(new BooleanChecksNotInverted()),
//language=java
java(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;

import static org.openrewrite.java.Assertions.java;

class SimplifyTernaryTest implements RewriteTest {

@Override
public void defaults(RecipeSpec spec) {
spec.recipe(new SimplifyTernaryRecipes());
}

@DocumentExample
@Test
void simplified() {
rewriteRun(
spec -> spec.recipe(new SimplifyTernaryRecipes()),
//language=java
java(
"""
Expand Down Expand Up @@ -88,7 +94,6 @@ boolean booleanExpression() {
@Test
void unchanged() {
rewriteRun(
spec -> spec.recipe(new SimplifyTernaryRecipes()),
//language=java
java(
"""
Expand Down