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

Migrate tests to JUnit5 #1825

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 jaxb-ri/bundles/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@

package jaxb.core.test;

import junit.framework.TestCase;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.util.jar.JarFile;
import java.util.jar.Manifest;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

/**
* Tests if MANIFEST Bundle-Version has correct version format.
*
* @author Martin Vojtek
*/
public class OSGiBundleVersionTest extends TestCase {

public OSGiBundleVersionTest(String name) {
super(name);
}
public class OSGiBundleVersionTest {

@Test
public void testJaxbOsgiBundleVersion() throws IOException {
String osgiJar = System.getProperty("osgi.dist");
assertNotNull("osgi.dist not set", osgiJar);
assertNotNull(osgiJar, "osgi.dist not set");
checkVersion(new File(osgiJar + ".jar"));
}

Expand All @@ -40,7 +41,7 @@ private void checkVersion(File f) throws IOException {
String version = mf.getMainAttributes().getValue("Bundle-Version");
assertNotNull(version);
String[] v = version.split("\\.");
assertTrue("only <X.Y.Z> or <X.Y.Z.SNAPSHOT> is allowed but was: <" + version + ">", v.length <= 4);
assertTrue(v.length <= 4, "only <X.Y.Z> or <X.Y.Z.SNAPSHOT> is allowed but was: <" + version + ">");
for (int i = 0; i < (4 == v.length ? v.length - 1 : v.length); i++) {
try {
Integer.parseInt(v[i]);
Expand Down
4 changes: 2 additions & 2 deletions jaxb-ri/bundles/jxc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@

package jaxb.jxc.test;

import junit.framework.TestCase;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.util.jar.JarFile;
import java.util.jar.Manifest;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

/**
* Tests if MANIFEST Bundle-Version has correct version format.
*
* @author Martin Vojtek
*/
public class OSGiBundleVersionTest extends TestCase {

public OSGiBundleVersionTest(String name) {
super(name);
}
public class OSGiBundleVersionTest {

@Test
public void testJaxbOsgiBundleVersion() throws IOException {
String osgiJar = System.getProperty("osgi.dist");
assertNotNull("osgi.dist not set", osgiJar);
assertNotNull(osgiJar, "osgi.dist not set");
checkVersion(new File(osgiJar + ".jar"));
}

Expand All @@ -40,7 +41,7 @@ private void checkVersion(File f) throws IOException {
String version = mf.getMainAttributes().getValue("Bundle-Version");
assertNotNull(version);
String[] v = version.split("\\.");
assertTrue("only <X.Y.Z> or <X.Y.Z.SNAPSHOT> is allowed but was: <" + version + ">", v.length <= 4);
assertTrue(v.length <= 4, "only <X.Y.Z> or <X.Y.Z.SNAPSHOT> is allowed but was: <" + version + ">");
for (int i = 0; i < (4 == v.length ? v.length - 1 : v.length); i++) {
try {
Integer.parseInt(v[i]);
Expand Down
4 changes: 2 additions & 2 deletions jaxb-ri/bundles/osgi/osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@

package jaxb.osgi.test;

import junit.framework.TestCase;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.util.jar.JarFile;
import java.util.jar.Manifest;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

/**
* Tests if MANIFEST Bundle-Version has correct version format.
*
* @author Martin Vojtek
*/
public class OSGiBundleVersionTest extends TestCase {

public OSGiBundleVersionTest(String name) {
super(name);
}
public class OSGiBundleVersionTest {

@Test
public void testJaxbOsgiBundleVersion() throws IOException {
String osgiJar = System.getProperty("osgi.dist");
assertNotNull("osgi.dist not set", osgiJar);
assertNotNull(osgiJar, "osgi.dist not set");
checkVersion(new File(osgiJar + ".jar"));
}

Expand All @@ -40,7 +41,7 @@ private void checkVersion(File f) throws IOException {
String version = mf.getMainAttributes().getValue("Bundle-Version");
assertNotNull(version);
String[] v = version.split("\\.");
assertTrue("only <X.Y.Z> or <X.Y.Z.SNAPSHOT> is allowed but was: <" + version + ">", v.length <= 4);
assertTrue(v.length <= 4, "only <X.Y.Z> or <X.Y.Z.SNAPSHOT> is allowed but was: <" + version + ">");
for (int i = 0; i < (4 == v.length ? v.length - 1 : v.length); i++) {
try {
Integer.parseInt(v[i]);
Expand Down
4 changes: 2 additions & 2 deletions jaxb-ri/bundles/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
</dependency>

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@

package jaxb.runtime.test;

import junit.framework.TestCase;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.util.jar.JarFile;
import java.util.jar.Manifest;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

/**
* Tests if MANIFEST Bundle-Version has correct version format.
*
* @author Martin Vojtek
*/
public class OSGiBundleVersionTest extends TestCase {

public OSGiBundleVersionTest(String name) {
super(name);
}
public class OSGiBundleVersionTest {

@Test
public void testJaxbOsgiBundleVersion() throws IOException {
String osgiJar = System.getProperty("osgi.dist");
assertNotNull("osgi.dist not set", osgiJar);
assertNotNull(osgiJar, "osgi.dist not set");
checkVersion(new File(osgiJar + ".jar"));
}

Expand All @@ -40,7 +41,7 @@ private void checkVersion(File f) throws IOException {
String version = mf.getMainAttributes().getValue("Bundle-Version");
assertNotNull(version);
String[] v = version.split("\\.");
assertTrue("only <X.Y.Z> or <X.Y.Z.SNAPSHOT> is allowed but was: <" + version + ">", v.length <= 4);
assertTrue(v.length <= 4, "only <X.Y.Z> or <X.Y.Z.SNAPSHOT> is allowed but was: <" + version + ">");
for (int i = 0; i < (4 == v.length ? v.length - 1 : v.length); i++) {
try {
Integer.parseInt(v[i]);
Expand Down
4 changes: 2 additions & 2 deletions jaxb-ri/bundles/xjc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,25 @@

package jaxb.xjc.test;

import junit.framework.TestCase;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.util.jar.JarFile;
import java.util.jar.Manifest;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

/**
* Tests if MANIFEST Bundle-Version has correct version format.
*
* @author Martin Vojtek
*/
public class OSGiBundleVersionTest extends TestCase {

public OSGiBundleVersionTest(String name) {
super(name);
}
public class OSGiBundleVersionTest {

@Test
public void testJaxbOsgiBundleVersion() throws IOException {
String osgiJar = System.getProperty("osgi.dist");
assertNotNull("osgi.dist not set", osgiJar);
Expand All @@ -40,7 +41,7 @@ private void checkVersion(File f) throws IOException {
String version = mf.getMainAttributes().getValue("Bundle-Version");
assertNotNull(version);
String[] v = version.split("\\.");
assertTrue("only <X.Y.Z> or <X.Y.Z.SNAPSHOT> is allowed but was: <" + version + ">", v.length <= 4);
assertTrue(v.length <= 4, "only <X.Y.Z> or <X.Y.Z.SNAPSHOT> is allowed but was: <" + version + ">");
for (int i = 0; i < (4 == v.length ? v.length - 1 : v.length); i++) {
try {
Integer.parseInt(v[i]);
Expand Down
6 changes: 3 additions & 3 deletions jaxb-ri/codemodel/codemodel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

package com.sun.codemodel;

import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import org.junit.Ignore;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class Issue1505Test {

Expand Down Expand Up @@ -75,7 +75,7 @@ public void test9() {
}

@Test
@Ignore("Not supported")
@Disabled("Not supported")
public void test10() {
checks("java.util.Map<K extends ?,V extends ?>");
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public void test16() {
}

@Test
@Ignore("Not supported")
@Disabled("Not supported")
public void test17() {
checks("M<A extends Object,B extends Object>");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,20 @@

package com.sun.codemodel;

import org.junit.Test;
import com.sun.codemodel.JModuleDirective.Type;
import org.junit.jupiter.api.Test;

import static com.sun.codemodel.JModuleTest.EOL;
import static com.sun.codemodel.JModuleTest.PKG_NAME;
import static com.sun.codemodel.JModuleTest.normalizeWhiteSpaces;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* Test Java module {@code exports} directive.
* @author kratz
*/
public class JExportsTest extends JTestModuleDirective {

/**
* Default constructor.
*/
public JExportsTest() {}

/**
* Test of getType method to make sure that it returns ExportsDirective.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

package com.sun.codemodel;

import static org.junit.Assert.assertArrayEquals;
import org.junit.jupiter.api.Test;

import java.lang.reflect.Modifier;

import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;

public class JModsTest {
static final int ALL_JMODS = JMod.PUBLIC | JMod.PROTECTED | JMod.PRIVATE
Expand Down
Loading