Skip to content

Commit

Permalink
For yegor256#939: Upgrade to Junit 5
Browse files Browse the repository at this point in the history
  • Loading branch information
paulodamaso committed Jan 27, 2019
1 parent 93f22f1 commit 22b9fab
Show file tree
Hide file tree
Showing 26 changed files with 116 additions and 57 deletions.
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
Expand Down
19 changes: 13 additions & 6 deletions qulice-ant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,26 @@
<artifactId>jcabi-aspects</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
<build>
<plugins>

<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<configuration combine.children="append">
Expand Down
10 changes: 5 additions & 5 deletions qulice-ant/src/test/java/com/qulice/ant/AntEnvironmentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
*/
package com.qulice.ant;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
* Test for AntEnvironment.
Expand All @@ -45,7 +45,7 @@ public class AntEnvironmentTest {
* @throws Exception If something wrong happens inside
*/
@Test
@Ignore
@Disabled
@SuppressWarnings("PMD.UncommentedEmptyMethodBody")
public void buildsClassloader() throws Exception {
}
Expand All @@ -55,7 +55,7 @@ public void buildsClassloader() throws Exception {
* @throws Exception If something wrong happens inside
*/
@Test
@Ignore
@Disabled
@SuppressWarnings("PMD.UncommentedEmptyMethodBody")
public void returnsFiles() throws Exception {
}
Expand All @@ -65,7 +65,7 @@ public void returnsFiles() throws Exception {
* @throws Exception If something wrong happens inside
*/
@Test
@Ignore
@Disabled
@SuppressWarnings("PMD.UncommentedEmptyMethodBody")
public void excludesFiles() throws Exception {
}
Expand Down
8 changes: 8 additions & 0 deletions qulice-checkstyle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
import org.apache.commons.lang3.StringUtils;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.ParameterResolver;
import org.junit.runners.Parameterized;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
Expand All @@ -57,7 +58,7 @@
* Integration test case for all checkstyle checks.
* @since 0.3
*/
@RunWith(Parameterized.class)
@ExtendWith(ParameterResolver.class)
public final class ChecksTest {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.collection.IsIterableContainingInOrder;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link CheckstyleValidator} class.
Expand Down Expand Up @@ -430,7 +430,7 @@ public void allowsOnlyProperlyOrderedAtClauses() throws Exception {
* @throws Exception If something wrong happens inside
*/
@Test
@Ignore
@Disabled
public void passesWindowsEndsOfLineWithoutException() throws Exception {
this.validate("WindowsEol.java", false, "LICENSE found:");
}
Expand All @@ -444,7 +444,7 @@ public void passesWindowsEndsOfLineWithoutException() throws Exception {
* correctly. (see changes done in #61)
*/
@Test
@Ignore
@Disabled
public void testWindowsEndsOfLineWithLinuxSources() throws Exception {
this.runValidation("WindowsEolLinux.java", false);
}
Expand Down Expand Up @@ -689,7 +689,7 @@ public void allowsUppercaseAbbreviationExceptions() throws Exception {
* being placed at end of lines. Correct this behavior and uncomment test
* below.
*/
@Ignore
@Disabled
@Test
public void checkLambdaAndGenericsAtEndOfLine() throws Exception {
this.runValidation("ValidLambdaAndGenericsAtEndOfLine.java", true);
Expand Down
8 changes: 8 additions & 0 deletions qulice-findbugs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import com.qulice.spi.Environment;
import com.qulice.spi.ValidationException;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link FindBugsValidator}.
Expand All @@ -59,7 +59,7 @@ public void passesCorrectFilesWithNoExceptions() throws Exception {
* @throws Exception If something wrong happens inside
*/
@Ignore
@Test(expected = ValidationException.class)
@org.junit.Test(expected = ValidationException.class)
public void reportsIncorrectlyAddedThrows() throws Exception {
final byte[] bytecode = new BytecodeMocker()
.withSource(
Expand Down Expand Up @@ -107,7 +107,7 @@ public void ignoresCorrectlyAddedThrows() throws Exception {
* FindbugsValidator throw exception for invalid file.
* @throws Exception If something wrong happens inside
*/
@Test(expected = ValidationException.class)
@org.junit.Test(expected = ValidationException.class)
public void throwsExceptionOnViolation() throws Exception {
final byte[] bytecode = new BytecodeMocker()
.withSource("class Foo { public Foo clone() { return this; } }")
Expand Down
14 changes: 8 additions & 6 deletions qulice-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,6 @@
<artifactId>maven-plugin-testing-harness</artifactId>
<version>3.1.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand Down Expand Up @@ -224,6 +218,14 @@
<version>5.0.0.Final</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.context.Context;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.apache.maven.project.MavenProject;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import com.qulice.spi.Environment;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link ValidatorsProvider} class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis;
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

/**
Expand Down Expand Up @@ -89,7 +89,7 @@ public void passesIfNoDependencyProblemsFound() throws Exception {
* DependencyValidator can catch dependency problems.
* @throws Exception If something wrong happens inside
*/
@Test(expected = ValidationException.class)
@org.junit.Test(expected = ValidationException.class)
public void catchesDependencyProblemsAndThrowsException() throws Exception {
final ProjectDependencyAnalysis analysis =
Mockito.mock(ProjectDependencyAnalysis.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.apache.commons.io.FileUtils;
import org.cactoos.io.ResourceOf;
import org.cactoos.text.TextOf;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link PomXpathValidator} class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
*/
package com.qulice.maven;

import org.junit.Test;

import org.junit.jupiter.api.Test;

/**
* Test case for {@link SvnPropertiesValidator}.
Expand Down
8 changes: 8 additions & 0 deletions qulice-pmd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import org.hamcrest.core.IsEqual;
import org.hamcrest.core.StringStartsWith;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for LocalVariableCouldBeFinal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@
import java.util.Arrays;
import java.util.Collection;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.ParameterResolver;
import org.junit.runners.Parameterized;

/**
* Tests for disabled rules.
* @since 0.16
*/
@RunWith(Parameterized.class)
@ExtendWith(ParameterResolver.class)
public final class PmdDisabledRulesTest {

/**
Expand Down
2 changes: 1 addition & 1 deletion qulice-pmd/src/test/java/com/qulice/pmd/PmdEmptyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
package com.qulice.pmd;

import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link PmdValidator} class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.hamcrest.Matchers;
import org.hamcrest.core.IsEqual;
import org.hamcrest.core.IsNot;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link PmdValidator} class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import org.hamcrest.core.IsEqual;
import org.hamcrest.core.StringStartsWith;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for LocalVariableCouldBeFinal.
Expand Down
Loading

0 comments on commit 22b9fab

Please sign in to comment.