Skip to content

Commit

Permalink
Add hints in AppendToReleaseNotesTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed May 27, 2024
1 parent 21388ba commit 8b8b766
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/test/java/com/yourorg/AppendToReleaseNotesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,24 @@ public void defaults(RecipeSpec spec) {

@Test
void createNewReleaseNotes() {
// Notice how the before text is null, indicating that the file does not exist yet.
// The after text is the content of the file after the recipe is applied.
rewriteRun(
text(null,
text(
null,
"""
Hello world
"""
""",
spec -> spec.path(Paths.get("RELEASE.md")
)
)
);
}

@DocumentExample
@Test
void editExistingReleaseNotes() {
// When the file does already exist, we assert the content is modified as expected.
rewriteRun(
text(
"""
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/yourorg/AssertEqualsToAssertThatTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void twoArgument() {
java(
"""
import org.junit.jupiter.api.Assertions;
class A {
void foo() {
Assertions.assertEquals(1, 2);
Expand All @@ -49,7 +49,7 @@ void foo() {
""",
"""
import org.assertj.core.api.Assertions;
class A {
void foo() {
Assertions.assertThat(2).isEqualTo(1);
Expand All @@ -67,7 +67,7 @@ void withDescription() {
java(
"""
import org.junit.jupiter.api.Assertions;
class A {
void foo() {
Assertions.assertEquals(1, 2, "one equals two, everyone knows that");
Expand All @@ -76,7 +76,7 @@ void foo() {
""",
"""
import org.assertj.core.api.Assertions;
class A {
void foo() {
Assertions.assertThat(2).as("one equals two, everyone knows that").isEqualTo(1);
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/yourorg/UseOpenRewriteNullableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ void replacesNullableAnnotation() {
java(
"""
import org.jetbrains.annotations.Nullable;
class A {
@Nullable
String s;
}
""",
"""
import org.openrewrite.internal.lang.Nullable;
class A {
@Nullable
String s;
Expand Down

0 comments on commit 8b8b766

Please sign in to comment.