Skip to content

Commit

Permalink
Merge pull request #35 from openrewrite/add_editorconfig
Browse files Browse the repository at this point in the history
Add .editorconfig as seen elsewhere & reformat tests
  • Loading branch information
sghill authored Aug 18, 2023
2 parents 880415a + 549a02a commit 98e307d
Show file tree
Hide file tree
Showing 13 changed files with 1,644 additions and 1,641 deletions.
5 changes: 5 additions & 0 deletions src/test/java/org/openrewrite/jenkins/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*.java]
indent_size = 4
ij_continuation_indent_size = 2
905 changes: 452 additions & 453 deletions src/test/java/org/openrewrite/jenkins/AddPluginsBomTest.java

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/test/java/org/openrewrite/jenkins/BomLookupTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import static org.assertj.core.api.Assertions.assertThat;

public class BomLookupTest {
class BomLookupTest {
private final BomLookup bomLookup = new BomLookup();

@Test
Expand Down
342 changes: 171 additions & 171 deletions src/test/java/org/openrewrite/jenkins/CreateIndexJellyTest.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,68 +32,68 @@ public void defaults(RecipeSpec spec) {
@DocumentExample
void shouldAddRelativePathIfMissing() {
rewriteRun(pomXml(
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
</parent>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""".stripIndent(),
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
<relativePath/>
</parent>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""".stripIndent()
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
</parent>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""".stripIndent(),
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
<relativePath/>
</parent>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""".stripIndent()
));
}

@Test
void shouldNoOpIfRelativePathAlreadyPresent() {
rewriteRun(pomXml(
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
<relativePath/>
</parent>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""".stripIndent()
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
<relativePath/>
</parent>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""".stripIndent()
));
}
}
70 changes: 35 additions & 35 deletions src/test/java/org/openrewrite/jenkins/IsJenkinsPluginTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Disabled
class IsJenkinsPluginTest implements RewriteTest {

@Override
public void defaults(RecipeSpec spec) {
spec.recipe(new IsJenkinsPlugin("*"));
Expand All @@ -35,39 +35,39 @@ public void defaults(RecipeSpec spec) {
@DocumentExample
void shouldKnowIfJenkinsPlugin() {
rewriteRun(pomXml(
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
</parent>
<artifactId>my-plugin</artifactId>
<version>0.1</version>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""".stripIndent(),
"""
<!--~~(2.249)~~>--><project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
</parent>
<artifactId>my-plugin</artifactId>
<version>0.1</version>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""".stripIndent()));
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
</parent>
<artifactId>my-plugin</artifactId>
<version>0.1</version>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""".stripIndent(),
"""
<!--~~(2.249)~~>--><project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
</parent>
<artifactId>my-plugin</artifactId>
<version>0.1</version>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""".stripIndent()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import static org.openrewrite.java.Assertions.java;

public class JavaxAnnotationsToSpotBugsTest implements RewriteTest {
class JavaxAnnotationsToSpotBugsTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.parser(JavaParser.fromJavaVersion().classpath("jsr305", "spotbugs-annotations"));
Expand All @@ -33,86 +33,86 @@ public void defaults(RecipeSpec spec) {
@Test
void shouldChangeClassName() {
rewriteRun(java(
"""
import javax.annotation.Nonnull;
public class A {
static @Nonnull String CONSTANT = "A";
}
""".stripIndent(),
"""
import edu.umd.cs.findbugs.annotations.NonNull;
public class A {
static @NonNull String CONSTANT = "A";
}
""".stripIndent()
"""
import javax.annotation.Nonnull;
public class A {
static @Nonnull String CONSTANT = "A";
}
""".stripIndent(),
"""
import edu.umd.cs.findbugs.annotations.NonNull;
public class A {
static @NonNull String CONSTANT = "A";
}
""".stripIndent()
));
}

@Test
void shouldChangePackage() {
rewriteRun(java(
"""
import javax.annotation.CheckForNull;
"""
import javax.annotation.CheckForNull;
public class A {
@CheckForNull
public String key() {
return null;
}
}
""".stripIndent(),
"""
import edu.umd.cs.findbugs.annotations.CheckForNull;
public class A {
@CheckForNull
public String key() {
return null;
}
}
""".stripIndent()
public class A {
@CheckForNull
public String key() {
return null;
}
}
""".stripIndent(),
"""
import edu.umd.cs.findbugs.annotations.CheckForNull;
public class A {
@CheckForNull
public String key() {
return null;
}
}
""".stripIndent()
));
}

@Test
@DocumentExample
void shouldNotOrderImports() {
rewriteRun(java(
"""
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import java.util.Objects;
public class A {
@CheckForNull
public String key() {
return null;
}
public @Nonnull String myMethod(String in) {
return Objects.equals(in, "a") ? "yes" : "no";
}
}
""".stripIndent(),
"""
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import java.util.Objects;
public class A {
@CheckForNull
public String key() {
return null;
}
public @NonNull String myMethod(String in) {
return Objects.equals(in, "a") ? "yes" : "no";
}
}
""".stripIndent()
"""
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import java.util.Objects;
public class A {
@CheckForNull
public String key() {
return null;
}
public @Nonnull String myMethod(String in) {
return Objects.equals(in, "a") ? "yes" : "no";
}
}
""".stripIndent(),
"""
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import java.util.Objects;
public class A {
@CheckForNull
public String key() {
return null;
}
public @NonNull String myMethod(String in) {
return Objects.equals(in, "a") ? "yes" : "no";
}
}
""".stripIndent()
));
}
}
Loading

0 comments on commit 98e307d

Please sign in to comment.