Skip to content

Commit

Permalink
Add cycle hints to fix tests for now (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek authored Jan 23, 2024
1 parent aafe39b commit 94e2849
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ public void defaults(RecipeSpec spec) {
"micronaut-security-oauth2-4.*",
"micronaut-http-4.*"));
spec.recipe(new AddHttpRequestTypeParameter());
spec.expectedCyclesThatMakeChanges(2);
}

@Test
void testAuthenticationProviderNoChangesNeeded() {
rewriteRun(
spec -> spec.expectedCyclesThatMakeChanges(0),
//language=java
java(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public MyInterface myInterface() {
@Test
void parameterizedReturnTypes() {
rewriteRun(
spec -> spec.expectedCyclesThatMakeChanges(2),
java(
"""
package abc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void defaults(RecipeSpec spec) {
generator:
access-token:
expiration: 1d
cookie:
cookie:
enabled: true
cookie-max-age: 1d
cookie-path: foo
Expand All @@ -85,7 +85,7 @@ public void defaults(RecipeSpec spec) {
generator:
access-token:
expiration: 1d
cookie:
cookie:
enabled: true
cookie-max-age: 1d
cookie-path: foo
Expand All @@ -104,7 +104,7 @@ public void defaults(RecipeSpec spec) {
generator:
access-token:
expiration: 1d
cookie:
cookie:
enabled: false
bearer:
enabled: true
Expand All @@ -118,7 +118,7 @@ public void defaults(RecipeSpec spec) {
generator:
access-token:
expiration: 1d
cookie:
cookie:
enabled: false
bearer:
enabled: true
Expand All @@ -145,7 +145,9 @@ void updateYamlConfig() {

@Test
void updatePartialYamlConfig() {
rewriteRun(mavenProject("project", srcMainResources(yaml(initialSecurityYamlPartial, expectedSecurityYamlPartial, s -> s.path("application.yml")))));
rewriteRun(
spec -> spec.expectedCyclesThatMakeChanges(2),
mavenProject("project", srcMainResources(yaml(initialSecurityYamlPartial, expectedSecurityYamlPartial, s -> s.path("application.yml")))));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public void sayHello(@NotBlank String name) {

@Test
void updateJavaCodeAndModifyGradleDependencies() {
rewriteRun(spec -> spec.beforeRecipe(withToolingApi()), mavenProject("project", properties("micronautVersion=" + MicronautRewriteTestVersions.getLatestMN3Version(), s -> s.path("gradle.properties")), srcMainJava(java(annotatedJavaxClass, annotatedJakartaClass)),
rewriteRun(spec -> spec.beforeRecipe(withToolingApi()).expectedCyclesThatMakeChanges(2),
mavenProject("project", properties("micronautVersion=" + MicronautRewriteTestVersions.getLatestMN3Version(), s -> s.path("gradle.properties")), srcMainJava(java(annotatedJavaxClass, annotatedJakartaClass)),
//language=groovy
buildGradle("""
plugins {
Expand Down Expand Up @@ -114,7 +115,8 @@ void updateJavaCodeAndModifyGradleDependencies() {

@Test
void updateJavaCodeAndAddMissingGradleDependencies() {
rewriteRun(spec -> spec.beforeRecipe(withToolingApi()), mavenProject("project", properties("micronautVersion=" + MicronautRewriteTestVersions.getLatestMN3Version(), s -> s.path("gradle.properties")), srcMainJava(java(annotatedJavaxClass, annotatedJakartaClass)),
rewriteRun(spec -> spec.beforeRecipe(withToolingApi()).expectedCyclesThatMakeChanges(2),
mavenProject("project", properties("micronautVersion=" + MicronautRewriteTestVersions.getLatestMN3Version(), s -> s.path("gradle.properties")), srcMainJava(java(annotatedJavaxClass, annotatedJakartaClass)),
//language=groovy
buildGradle("""
plugins {
Expand Down Expand Up @@ -153,7 +155,9 @@ void updateJavaCodeAndAddMissingGradleDependencies() {

@Test
void updateJavaCodeAndModifyMavenDependencies() {
rewriteRun(mavenProject("project", srcMainJava(java(annotatedJavaxClass, annotatedJakartaClass)),
rewriteRun(
spec -> spec.expectedCyclesThatMakeChanges(2),
mavenProject("project", srcMainJava(java(annotatedJavaxClass, annotatedJakartaClass)),
//language=xml
pomXml("""
<project>
Expand Down Expand Up @@ -296,7 +300,9 @@ void updateJavaCodeAndModifyMavenDependencies() {

@Test
void updateJavaCodeAndModifyMavenDependenciesAndAnnotationProcessor() {
rewriteRun(mavenProject("project", srcMainJava(java(annotatedJavaxClass, annotatedJakartaClass)),
rewriteRun(
spec -> spec.expectedCyclesThatMakeChanges(2),
mavenProject("project", srcMainJava(java(annotatedJavaxClass, annotatedJakartaClass)),
//language=xml
pomXml("""
<project>
Expand Down Expand Up @@ -444,7 +450,9 @@ void updateJavaCodeAndModifyMavenDependenciesAndAnnotationProcessor() {

@Test
void updateJavaCodeAndAddMissingMavenDependencies() {
rewriteRun(mavenProject("project", srcMainJava(java(annotatedJavaxClass, annotatedJakartaClass)),
rewriteRun(
spec -> spec.expectedCyclesThatMakeChanges(2),
mavenProject("project", srcMainJava(java(annotatedJavaxClass, annotatedJakartaClass)),
//language=xml
pomXml("""
<project>
Expand Down

0 comments on commit 94e2849

Please sign in to comment.