Skip to content

Commit

Permalink
Add an example test without an after text block
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Feb 26, 2024
1 parent bbce369 commit e7915ea
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/test/java/com/yourorg/NoGuavaListsNewArrayListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,24 @@ class Test {
)
);
}

// Often you want to make sure no changes are made when the target state is already achieved.
// To do so only passs in a before state and no after state to the rewriteRun method SourceSpecs.
@Test
void noChangeNecessary() {
rewriteRun(
//language=java
java(
"""
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Test {
List<Integer> cardinalsWorldSeries = Collections.unmodifiableList(new ArrayList<>());
}
"""
)
);
}
}

0 comments on commit e7915ea

Please sign in to comment.