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

[SHRINKRES-342] Migrate to JUnit5 #241

Merged
merged 3 commits into from
Sep 13, 2024
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
4 changes: 2 additions & 2 deletions gradle/impl-gradle-embedded-archive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

<!-- testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {

dependencies {
implementation 'commons-codec:commons-codec:1.7'
testImplementation 'junit:junit:4.10'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.3'
implementation('org.jboss.spec:jboss-javaee-web-6.0:3.0.2.Final') {
exclude(module: 'xalan')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
*/
package test;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
* Test cases for MavenImporter with Jar
*
* @author <a href="kpiwko@redhat.com>Karel Piwko</a>
*
*/
public class JarTestCase {
class JarTestCase {

@Test
public void testJar() {
Assert.assertTrue(true);
void testJar() {
Assertions.assertTrue(true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repositories {

dependencies {
implementation 'commons-codec:commons-codec:1.7'
testImplementation 'junit:junit:4.10'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.3'
implementation('org.jboss.spec:jboss-javaee-web-6.0:3.0.2.Final') {
exclude(module: 'xalan')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repositories {

dependencies {
implementation group: 'commons-codec', name: 'commons-codec', version:'1.7'
testImplementation group: 'junit', name: 'junit', version:'4.10'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version:'5.10.3'
providedCompile group: 'org.slf4j', name: 'slf4j-api', version:'1.6.1'
providedCompile(group: 'org.jboss.spec', name: 'jboss-javaee-web-6.0', version:'3.0.2.Final') {
exclude(module: 'xalan')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
*/
package test;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
* A simple JUnit test in a WAR. This is not executed when MavenImporter is used.
*
* @author <a href="kpiwko@redhat.com>Karel Piwko</a>
*
*/
public class WarTestCase {
class WarTestCase {

@Test
public void testWar() {
Assert.assertTrue(true);
void testWar() {
Assertions.assertTrue(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.gradle.archive.importer.embedded.EmbeddedGradleImporter;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.File;

Expand All @@ -29,10 +29,10 @@
/**
* @author <a href="mailto:mmatloka@gmail.com">Michal Matloka</a>
*/
public class JarEmbeddedGradleImporterTestCase {
class JarEmbeddedGradleImporterTestCase {

@Test
public void shouldImportFromDefaultLocation() {
void shouldImportFromDefaultLocation() {
final String dir = "src/it/jar-sample/";
final JavaArchive javaArchive = ShrinkWrap.create(EmbeddedGradleImporter.class).forProjectDirectory(dir)
.importBuildOutput().as(JavaArchive.class);
Expand All @@ -43,7 +43,7 @@ public void shouldImportFromDefaultLocation() {
}

@Test
public void shouldImportFromSpecificPath() {
void shouldImportFromSpecificPath() {
final String dir = "src/it/jar-sample/";
final JavaArchive javaArchive = ShrinkWrap
.create(EmbeddedGradleImporter.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.gradle.archive.importer.embedded.EmbeddedGradleImporter;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* @author <a href="mailto:mmatloka@gmail.com">Michal Matloka</a>
*/
public class MultiModuleEmbeddedGradleImporterTestCase {
class MultiModuleEmbeddedGradleImporterTestCase {

@Test
public void should() {
void should() {
final String dir = "src/it/multi-module-sample/module-two";
final WebArchive webArchive = ShrinkWrap.create(EmbeddedGradleImporter.class).forProjectDirectory(dir)
.importBuildOutput().as(WebArchive.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.gradle.archive.importer.embedded.EmbeddedGradleImporter;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.jupiter.api.Test;

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

/**
* @author <a href="mailto:mmatloka@gmail.com">Michal Matloka</a>
*/
public class WarEmbeddedGradleImporterTestCase {
class WarEmbeddedGradleImporterTestCase {

@Test
public void should() {
void should() {
final String dir = "src/it/war-sample/";
final WebArchive webArchive = ShrinkWrap.create(EmbeddedGradleImporter.class).forProjectDirectory(dir)
.importBuildOutput().as(WebArchive.class);
Expand Down
4 changes: 2 additions & 2 deletions gradle/impl-gradle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.List;

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

public class ShrinkWrapGradleTestCase {
class ShrinkWrapGradleTestCase {

@Test
public void should_return_dependencies_by_scope_in_simple_build_script() {
void should_return_dependencies_by_scope_in_simple_build_script() {
final List<? extends Archive<?>> archives = Gradle.resolver().forProjectDirectory("src/test/resources/simple")
.importCompileAndRuntime()
.resolve().asList(JavaArchive.class);
Expand All @@ -20,7 +20,7 @@ public void should_return_dependencies_by_scope_in_simple_build_script() {
}

@Test
public void should_return_dependencies_by_scope_in_dependency_management_build_script() {
void should_return_dependencies_by_scope_in_dependency_management_build_script() {
final List<? extends Archive<?>> archives = Gradle.resolver().forProjectDirectory("src/test/resources/dependencymanager")
.importRuntime()
.resolve().asList(JavaArchive.class);
Expand All @@ -29,7 +29,7 @@ public void should_return_dependencies_by_scope_in_dependency_management_build_s
}

@Test
public void should_skip_non_zip_files_in_depchain_build_script() {
void should_skip_non_zip_files_in_depchain_build_script() {
final List<? extends Archive<?>> archives = Gradle.resolver().forProjectDirectory("src/test/resources/depchain")
.importCompileAndRuntime()
.resolve().asList(JavaArchive.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencyManagement {

dependencies {
implementation 'org.slf4j:slf4j-simple:1.7.5'
testImplementation 'junit:junit:4.12'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.3'
implementation 'org.apache.deltaspike.core:deltaspike-core-api'
runtimeOnly 'org.apache.deltaspike.core:deltaspike-core-impl'
}
2 changes: 1 addition & 1 deletion gradle/impl-gradle/src/test/resources/simple/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ repositories {

dependencies {
implementation 'org.slf4j:slf4j-simple:1.7.5'
testCompileOnly 'junit:junit:4.12'
testCompileOnly 'org.junit.jupiter:junit-jupiter:5.10.3'
}
5 changes: 2 additions & 3 deletions maven/api-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
<artifactId>shrinkwrap-resolver-api</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,59 +17,59 @@
* limitations under the License.
*/

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
* Ensures that the {@link PackagingType#toString()} contracts are as expected
*
* @author <a href="mailto:alr@jboss.org">Andrew Lee Rubinger</a>
*/
public class PackagingTypeTestCase {
class PackagingTypeTestCase {

@Test
public void pom() {
Assert.assertEquals("pom", PackagingType.POM.toString());
void pom() {
Assertions.assertEquals("pom", PackagingType.POM.toString());
}

@Test
public void jar() {
Assert.assertEquals("jar", PackagingType.JAR.toString());
void jar() {
Assertions.assertEquals("jar", PackagingType.JAR.toString());
}

@Test
public void mavenPlugin() {
Assert.assertEquals("maven-plugin", PackagingType.MAVEN_PLUGIN.toString());
void mavenPlugin() {
Assertions.assertEquals("maven-plugin", PackagingType.MAVEN_PLUGIN.toString());
}

@Test
public void ejb() {
Assert.assertEquals("ejb", PackagingType.EJB.toString());
void ejb() {
Assertions.assertEquals("ejb", PackagingType.EJB.toString());
}

@Test
public void war() {
Assert.assertEquals("war", PackagingType.WAR.toString());
void war() {
Assertions.assertEquals("war", PackagingType.WAR.toString());
}

@Test
public void ear() {
Assert.assertEquals("ear", PackagingType.EAR.toString());
void ear() {
Assertions.assertEquals("ear", PackagingType.EAR.toString());
}

@Test
public void rar() {
Assert.assertEquals("rar", PackagingType.RAR.toString());
void rar() {
Assertions.assertEquals("rar", PackagingType.RAR.toString());
}

@Test
public void par() {
Assert.assertEquals("par", PackagingType.PAR.toString());
void par() {
Assertions.assertEquals("par", PackagingType.PAR.toString());
}

@Test
public void random() {
Assert.assertEquals("random", PackagingType.of("random").toString());
void random() {
Assertions.assertEquals("random", PackagingType.of("random").toString());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,44 @@
* limitations under the License.
*/

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
* Ensures that the {@link ScopeType#toString()} contracts are as expected
*
* @author <a href="mailto:alr@jboss.org">Andrew Lee Rubinger</a>
*/
public class ScopeTypeTestCase {
class ScopeTypeTestCase {

@Test
public void compile() {
Assert.assertEquals("compile", ScopeType.COMPILE.toString());
void compile() {
Assertions.assertEquals("compile", ScopeType.COMPILE.toString());
}

@Test
public void provided() {
Assert.assertEquals("provided", ScopeType.PROVIDED.toString());
void provided() {
Assertions.assertEquals("provided", ScopeType.PROVIDED.toString());
}

@Test
public void runtime() {
Assert.assertEquals("runtime", ScopeType.RUNTIME.toString());
void runtime() {
Assertions.assertEquals("runtime", ScopeType.RUNTIME.toString());
}

@Test
public void test() {
Assert.assertEquals("test", ScopeType.TEST.toString());
void test() {
Assertions.assertEquals("test", ScopeType.TEST.toString());
}

@Test
public void system() {
Assert.assertEquals("system", ScopeType.SYSTEM.toString());
void system() {
Assertions.assertEquals("system", ScopeType.SYSTEM.toString());
}

@Test
public void importTest() {
Assert.assertEquals("import", ScopeType.IMPORT.toString());
void importTest() {
Assertions.assertEquals("import", ScopeType.IMPORT.toString());
}

}
Loading