Skip to content

Commit 0907d4e

Browse files
committed
yolo
1 parent b787c2f commit 0907d4e

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/test/java/victor/training/cleancode/openrewrite/JUnitToAssertJTestDemo.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,30 @@
22

33
import org.junit.jupiter.api.Test;
44

5-
import static org.assertj.core.api.Assertions.assertThat;
65
import static org.junit.jupiter.api.Assertions.assertThrows;
76
import static org.junit.jupiter.api.Assertions.assertTrue;
87

98
class JUnitToAssertJTestDemo {
109
@Test
1110
void test() {
12-
assertThat(notification(false)).isEqualTo("result");
13-
assertTrue(notification(false).contains("es"));
14-
assertTrue(notification(false).startsWith("re"));
11+
assertTrue(testedCode().contains("eS"));
12+
assertTrue(testedCode().startsWith("re"));
1513
}
1614

17-
private String notification(boolean shouldThrow) {
18-
if (shouldThrow) throw new IllegalArgumentException("Boom");
19-
return "result";
15+
private String testedCode() {
16+
return notification(false);
2017
}
2118

19+
2220
@Test
2321
void testExceptions() {
2422
assertThrows(IllegalArgumentException.class, () -> notification(true));
2523
}
2624

25+
private String notification(boolean shouldThrow) {
26+
if (shouldThrow) throw new IllegalArgumentException("Boom");
27+
return "result";
28+
}
2729
// 1) run open-rewrite.yaml in IntelliJ, or
2830
// 2) mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.assertj.JUnitAssertEqualsToAssertThat -Drewrite.exportDatatables=true
2931

0 commit comments

Comments
 (0)