Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .editorconfig as seen elsewhere & reformat tests #35

Merged
merged 2 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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