Skip to content

Commit

Permalink
Further test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Jul 23, 2024
1 parent 3b00391 commit 6bbe21a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void declarativeRecipesDontAddToEstimatedTimeFixed() {
type: specs.openrewrite.org/v1beta/recipe
name: test.ChangeTextToHello
displayName: Change text to hello
description: Test.
recipeList:
- org.openrewrite.text.ChangeText:
toText: Hello
Expand Down Expand Up @@ -74,6 +75,7 @@ void listRecipes() {
type: specs.openrewrite.org/v1beta/recipe
name: test.ChangeTextToHello
displayName: Change text to hello
description: Test.
recipeList:
- org.openrewrite.text.ChangeText:
toText: Hello
Expand Down Expand Up @@ -112,13 +114,15 @@ void activeRecipeNotFoundSuggestions() {
type: specs.openrewrite.org/v1beta/recipe
name: test.ChangeTextToHello
displayName: Change text to hello
description: Test.
recipeList:
- org.openrewrite.text.ChangeText:
toText: Hello
---
type: specs.openrewrite.org/v1beta/recipe
name: test.ChangeTextToHelloWorld
displayName: Change text to hello world
description: Test.
recipeList:
- org.openrewrite.text.ChangeText:
toText: Hello
Expand Down Expand Up @@ -147,6 +151,7 @@ void recipeWithoutRequiredConfiguration() {
type: specs.openrewrite.org/v1beta/recipe
name: test.ChangeTextToHello
displayName: Change text to hello
description: Test.
recipeList:
- org.openrewrite.text.ChangeText
""".getBytes()
Expand All @@ -172,12 +177,14 @@ void recipeDependsOnOtherDeclarativeRecipe() {
type: specs.openrewrite.org/v1beta/recipe
name: test.TextMigration
displayName: Text migration
description: Test.
recipeList:
- test.ChangeTextToHello
---
type: specs.openrewrite.org/v1beta/recipe
name: test.ChangeTextToHello
displayName: Change text to hello
description: Test.
recipeList:
- org.openrewrite.text.ChangeText:
toText: Hello
Expand Down Expand Up @@ -213,6 +220,7 @@ void recipeDependsOnOtherDeclarativeRecipeSpecifiedInAnotherFile() {
type: specs.openrewrite.org/v1beta/recipe
name: test.TextMigration
displayName: Text migration
description: Test.
recipeList:
- test.ChangeTextToHello
""".getBytes()
Expand Down Expand Up @@ -262,6 +270,7 @@ void recipeDependsOnNonExistentRecipe() {
type: specs.openrewrite.org/v1beta/recipe
name: test.TextMigration
displayName: Text migration
description: Test.
recipeList:
- test.DoesNotExist
""".getBytes()
Expand All @@ -286,7 +295,8 @@ void declarativeRecipeListClassCastException() {
"""
type: specs.openrewrite.org/v1beta/recipe
name: test.LicenseHeader
displayName: License header.
displayName: License header
description: Test.
recipeList:
- org.openrewrite.java.AddLicenseHeader: |-
LicenseHeader
Expand All @@ -312,6 +322,7 @@ void declarativeRecipeWrongPackage() {
type: specs.openrewrite.org/v1beta/recipe
name: test.ResultOfFileMkdirsIgnored
displayName: Test
description: Test.
recipeList:
- org.openrewrite.java.ResultOfMethodCallIgnored:
methodPattern: 'java.io.File mkdir*()'
Expand Down Expand Up @@ -427,6 +438,7 @@ void preserveRecipeListOrder() {
type: specs.openrewrite.org/v1beta/recipe
name: test.FooOne
displayName: Test
description: Test.
recipeList:
- org.openrewrite.config.RecipeAcceptingParameters:
foo: "foo"
Expand Down Expand Up @@ -459,6 +471,7 @@ void preserveRecipeListOrder() {
type: specs.openrewrite.org/v1beta/recipe
name: test.OrderPreserved
displayName: Test
description: Test.
recipeList:
- org.openrewrite.config.RecipeNoParameters
- test.FooOne
Expand All @@ -474,7 +487,7 @@ void preserveRecipeListOrder() {
new Properties()
))
.build();
var recipeList = env.activateRecipes("test.OrderPreserved").getRecipeList().get(0).getRecipeList();
var recipeList = env.activateRecipes("test.OrderPreserved").getRecipeList();
assertThat(recipeList.get(0).getName()).isEqualTo("org.openrewrite.config.RecipeNoParameters");
assertThat(recipeList.get(1).getName()).isEqualTo("test.FooOne");
assertThat(recipeList.get(2).getName()).isEqualTo("org.openrewrite.config.RecipeAcceptingParameters");
Expand All @@ -493,17 +506,18 @@ void canCauseAnotherCycle() {
type: specs.openrewrite.org/v1beta/recipe
name: test.Foo
displayName: Test
description: Test.
causesAnotherCycle: true
recipeList:
- org.openrewrite.config.RecipeNoParameters
""".getBytes()
),
URI.create("rewrite.yml"),
new Properties()
)).build();
var recipe = env.activateRecipes("test.Foo");
assertThat(recipe.getRecipeList().get(0).causesAnotherCycle()).isTrue();
assertThat(recipe.causesAnotherCycle()).isTrue();
}

@Test
Expand All @@ -516,6 +530,7 @@ void willBeValidIfIncludesRecipesFromDependencies() {
type: specs.openrewrite.org/v1beta/recipe
name: test.Foo
displayName: Test
description: Test.
recipeList:
- org.openrewrite.config.RecipeNoParameters
""".getBytes()
Expand All @@ -530,6 +545,7 @@ void willBeValidIfIncludesRecipesFromDependencies() {
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.config.RecipeNoParameters
displayName: Test
description: Test.
recipeList:
- org.openrewrite.config.RecipeSomeParameters
""".getBytes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.text.ChangeTextToJon
displayName: Change Text To Jon
description: Changes Text to "Hello Jon!"
description: Changes Text to "Hello Jon!".
tags:
- testing
- plain text
Expand Down

0 comments on commit 6bbe21a

Please sign in to comment.