From 48318e2b96cb9bf1827715aa84dffabc9597db2b Mon Sep 17 00:00:00 2001 From: Laurent SCHOELENS <61973605+laurentschoelens@users.noreply.github.com> Date: Fri, 30 Aug 2024 16:33:16 +0200 Subject: [PATCH] [#385] move to junit5 --- .../util/tests/AnnotationUtilsTest.java | 9 +- .../tests/CreateXAnnotationsTest.java | 6 +- .../xsom/tests/SimpleTypesAnalyzerTest.java | 42 ++-- .../hyperjaxb3/xsom/tests/TypeUseTest.java | 6 +- hyperjaxb/ejb/roundtrip/pom.xml | 4 +- .../AbstractEntityManagerSamplesTest.java | 6 +- .../ejb/test/AbstractEntityManagerTest.java | 13 +- .../hyperjaxb3/ejb/test/RoundtripTest.java | 6 +- .../cascadedids/tests/EntityManagerTest.java | 2 + .../ejb/test/tests/EntityManagerTest.java | 7 +- .../test/tests/JavaReflectionManagerTest.java | 5 +- .../tests/hhh/EntityManagerFactoryTest.java | 8 +- .../lang/builder/tests/NumberEqualsTest.java | 13 +- .../datatype/XMLGregorianCalendarTest.java | 8 +- .../adapters/tests/ReflectionTest.java | 22 +- .../adapters/tests/XmlAdapterUtilsTest.java | 91 ++++---- .../hyperjaxb3/eg/tests/TestWrapping.java | 20 +- .../ejb/util/tests/EntityUtilsTest.java | 17 +- .../sb/tests/AtributeDefinitionTest.java | 18 +- .../hyperjaxb3/util/tests/ItemListTest.java | 16 +- .../ejb/samples/customerservice-cxf/pom.xml | 4 +- .../test/ApplicationStartsIT.java | 5 - .../test/CustomerServiceIT.java | 5 +- .../project-build.xml | 12 +- .../po-customized-eclipselink/project-pom.xml | 7 - .../ejb/samples/po-initial/project-build.xml | 13 +- .../ejb/samples/po-initial/project-pom.xml | 7 - .../ejb/samples/uniprot/project-build.xml | 13 +- hyperjaxb/ejb/samples/uniprot/project-pom.xml | 7 - .../tests/UnmarshalPersistenceTest.java | 13 +- .../ejb/templates/basic/project-build.xml | 13 +- hyperjaxb/ejb/templates/basic/project-pom.xml | 7 - .../componentjpa2/tests/TestHyperJaxb.java | 3 +- .../ejb/tests/issuesjpa2/HJIII73Test.java | 17 +- .../ejb/tests/issues/IssueHJIII100Test.java | 12 +- .../ejb/tests/issues/IssueHJIII28Test.java | 14 +- .../ejb/tests/issues/IssueHJIII32Test.java | 15 +- .../ejb/tests/issues/IssueHJIII35Test.java | 10 +- .../ejb/tests/issues/IssueHJIII41Test.java | 18 +- .../ejb/tests/issues/IssueHJIII94Test.java | 39 ++-- hyperjaxb/ejb/tests/pom.xml | 4 +- .../ejb/tests/st/HJIII11IssueTest.java | 35 ++- hyperjaxb/ejb/tutorials/po/step-one/pom.xml | 4 +- .../po/stepone/HsqlBigDecimalTest.java | 10 +- .../tutorials/po/stepone/JAXBAndJPATest.java | 16 +- .../ejb/tutorials/po/stepone/JAXBTest.java | 27 ++- .../ejb/tutorials/po/stepone/JPATest.java | 11 +- hyperjaxb/ejb/tutorials/po/step-three/pom.xml | 4 +- hyperjaxb/ejb/tutorials/po/step-two/pom.xml | 4 +- .../maven/tests/Hyperjaxb3MojoTest.java | 2 +- hyperjaxb/maven/testing/pom.xml | 4 +- hyperjaxb/misc/jdo/roundtrip/pom.xml | 5 +- hyperjaxb/misc/jdo/sample-hotel/pom.xml | 5 +- hyperjaxb/pom.xml | 4 +- jaxb-annotate-parent/samples/annotate/pom.xml | 4 +- .../samples/annotate/project-build.xml | 13 +- .../tests/annotate/IssueJAP9TypeTest.java | 11 +- .../org/jvnet/jaxb/tests/issues/Gh26Test.java | 9 +- .../org/jvnet/jaxb/tests/issues/Gh36Test.java | 9 +- ...11AnnotateEnumFromValueMethodTypeTest.java | 12 +- ...ueGH11AnnotateEnumValueMethodTypeTest.java | 12 +- .../jaxb/tests/issues/tests/Issue1Test.java | 6 +- .../jaxb/tests/issues/tests/RunPlugins.java | 7 +- .../tests/one/JavaTypeExampleTest.java | 8 +- .../tests/annotate/IssueJAP9TypeTest.java | 9 +- .../demos/guide/tests/DemoClassTest.java | 19 +- .../annox/demos/guide/tests/MyClassTest.java | 16 +- .../test/AnnotationWithIntegerFieldTest.java | 8 +- .../jaxb/annox/parser/tests/JAXBDemoTest.java | 15 +- .../parser/tests/JavaTypeParserTest.java | 11 +- .../XAnnotationParserAnnotationExprTest.java | 37 +-- .../parser/tests/XAnnotationParserTest.java | 76 +++--- .../tests/ResourcedXReaderTests.java | 87 +++---- .../org/jvnet/jaxb/annox/tests/ProxyTest.java | 37 +-- .../jaxb/annox/util/tests/ClassUtilsTest.java | 34 ++- .../annox/util/tests/ReflectionUtilsTest.java | 22 +- .../samples/po/project-build.xml | 13 +- jaxb-annox-parent/samples/po/project-pom.xml | 6 +- .../po/tests/AnnotationReaderTest.java | 22 +- .../jaxb-plugins-runtime/pom.xml | 9 +- .../xml/bind/tests/DynamicSchemaTest.java | 9 +- .../bind/tests/addelement/AddElementTest.java | 7 +- .../hisrc/xml/bind/tests/dogs/DogTest.java | 22 +- .../DynamicElementNameTest.java | 4 +- .../jaxb/lang/tests/CopyStrategyTest.java | 9 +- .../jvnet/jaxb/lang/tests/CyclicTests.java | 9 +- .../lang/tests/DefaultCopyStrategyTest.java | 10 +- .../model/util/tests/XmlTypeUtilsTest.java | 216 +++++++----------- .../namespace/util/tests/QNameUtilsTest.java | 14 +- .../jaxb-plugins-testing/pom.xml | 4 +- .../jvnet/jaxb/test/AbstractSamplesTest.java | 12 +- .../jaxb/test/tests/TrivialSamplesTest.java | 9 +- .../util/test/FieldAccessorTest.java | 10 +- .../jaxb/util/tests/JClassUtilsTest.java | 16 +- .../tests/alpha/AlphaMInfoFactoryTest.java | 38 +-- .../inheritance/tests/JavaParserTest.java | 13 +- .../inheritance/tests/JavaTypeParserTest.java | 27 +-- jaxb-plugins-parent/pom.xml | 4 +- jaxb-plugins-parent/samples/basic/pom.xml | 4 +- .../samples/basic/project-build.xml | 13 +- .../jvnet/jaxb/tests/one/CopyableTest.java | 4 +- .../org/jvnet/jaxb/tests/one/EqualsTest.java | 4 +- jaxb-plugins-parent/samples/cxf/pom.xml | 4 +- jaxb-plugins-parent/samples/po-simple/pom.xml | 4 +- .../samples/po-simple/project-build.xml | 13 +- .../samples/po-simple/project-pom.xml | 6 +- .../jvnet/jaxb/tests/posimple/EqualsTest.java | 5 +- jaxb-plugins-parent/samples/po/pom.xml | 4 +- .../samples/po/project-build.xml | 13 +- .../org/jvnet/jaxb/tests/po/CopyableTest.java | 4 +- .../org/jvnet/jaxb/tests/po/EqualsTest.java | 4 +- .../tests/JAXB_1058/ExecuteJAXB1058.java | 3 +- .../jaxb/tests/booleangetter/PersonTest.java | 7 +- .../jaxb/tests/camelcase/AddressTest.java | 11 +- .../jaxb/tests/camelcase/PersonTest.java | 7 +- .../tests/commons_lang/AddressTest.java | 12 +- .../tests/commons_lang/PersonTest.java | 8 +- .../tests/defaultvalue/AddressTest.java | 11 +- .../tests/defaultvalue/PersonTest.java | 7 +- .../jaxb/tests/enumtostring/ConsoleTest.java | 12 +- .../jvnet/jaxb/tests/fluentapi/BaseTest.java | 20 +- .../PrimitivesAndUnboxedPrimitivesTest.java | 32 +-- .../jvnet/jaxb/tests/issues/CopyableTest.java | 7 +- .../org/jvnet/jaxb/tests/issues/GH22Test.java | 8 +- .../org/jvnet/jaxb/tests/issues/GH26Test.java | 34 +-- .../org/jvnet/jaxb/tests/issues/GH31Test.java | 6 +- .../org/jvnet/jaxb/tests/issues/GH37Test.java | 16 +- .../jvnet/jaxb/tests/issues/JIIB10Test.java | 11 +- .../jvnet/jaxb/tests/issues/JIIB14Test.java | 23 +- .../jvnet/jaxb/tests/issues/JIIB20Test.java | 14 +- .../jvnet/jaxb/tests/issues/JIIB35Test.java | 14 +- .../jvnet/jaxb/tests/issues/JIIB36Test.java | 10 +- .../jvnet/jaxb/tests/issues/JIIB38Test.java | 11 +- .../jvnet/jaxb/tests/issues/JIIB8Test.java | 11 +- .../jvnet/jaxb/tests/issues/RunPlugins.java | 7 +- .../jvnet/jaxb/tests/issues/CopyableTest.java | 7 +- .../org/jvnet/jaxb/tests/issues/GH22Test.java | 8 +- .../org/jvnet/jaxb/tests/issues/GH26Test.java | 34 +-- .../org/jvnet/jaxb/tests/issues/GH31Test.java | 6 +- .../org/jvnet/jaxb/tests/issues/GH37Test.java | 16 +- .../jvnet/jaxb/tests/issues/JIIB10Test.java | 11 +- .../jvnet/jaxb/tests/issues/JIIB14Test.java | 23 +- .../jvnet/jaxb/tests/issues/JIIB20Test.java | 14 +- .../jvnet/jaxb/tests/issues/JIIB35Test.java | 14 +- .../jvnet/jaxb/tests/issues/JIIB36Test.java | 10 +- .../jvnet/jaxb/tests/issues/JIIB38Test.java | 11 +- .../jvnet/jaxb/tests/issues/JIIB8Test.java | 11 +- .../jvnet/jaxb/tests/issues/RunPlugins.java | 7 +- .../tests/mapinit/EmployeeDefinedTest.java | 20 +- .../tests/mapinit/EmployeeUndefinedTest.java | 20 +- .../org/jvnet/jaxb/tests/namespace/ATest.java | 12 +- .../org/jvnet/jaxb/tests/namespace/BTest.java | 20 +- .../org/jvnet/jaxb/tests/namespace/CTest.java | 32 +-- .../jaxb2_commons/tests/one/CopyableTest.java | 7 +- .../jaxb2_commons/tests/one/EqualsTest.java | 6 +- .../jaxb2_commons/tests/one/HashCodeTest.java | 5 +- .../jaxb/tests/parentpointer/AddressTest.java | 9 +- .../propertylistenerinjector/AddressTest.java | 3 +- .../cases/PrimitivesTest.java | 6 +- .../cases/RunPluginsForCases.java | 7 +- .../cases/UnboxedPrimitivesTest.java | 12 +- .../customer/CustomerTest.java | 15 +- .../customer/RunPluginsForCustomer.java | 7 +- .../main/RunPluginsForMain.java | 7 +- .../plugin/simplify/tests01/Gh18Test.java | 2 +- .../jaxb/plugin/simplify/tests01/Gh1Test.java | 8 +- .../jaxb/plugin/simplify/tests01/Gh2Test.java | 4 +- .../jaxb/plugin/simplify/tests01/Gh4Test.java | 13 +- .../jaxb/plugin/simplify/tests01/Gh5Test.java | 13 +- .../jaxb/plugin/simplify/tests01/Gh6Test.java | 13 +- .../simplify/tests01/RunSimplifyPlugin.java | 7 +- .../simplify/tests02/RunSimplifyPlugin.java | 7 +- .../plugin/simplify/tests03/Gh18Test.java | 2 +- .../jaxb/plugin/simplify/tests03/Gh1Test.java | 8 +- .../jaxb/plugin/simplify/tests03/Gh2Test.java | 4 +- .../jaxb/plugin/simplify/tests03/Gh4Test.java | 13 +- .../jaxb/plugin/simplify/tests03/Gh5Test.java | 13 +- .../jaxb/plugin/simplify/tests03/Gh6Test.java | 13 +- .../simplify/tests03/RunSimplifyPlugin.java | 7 +- .../test/superclass/b/tests/CopyToTest.java | 12 +- .../test/superclass/b/tests/RunPlugins.java | 7 +- .../jaxb2_commons/tests/zj/EqualsTest.java | 5 +- .../org/jvnet/jaxb/maven/RawXJCMojoTest.java | 38 ++- .../tests/URILastModifiedResolverTest.java | 14 +- .../tools/tests/MavenCatalogResolverTest.java | 8 +- ...ddIfExistsToEpisodeSchemaBindingsTest.java | 6 +- .../maven/tests/DependencyResourceTest.java | 2 +- .../jvnet/jaxb/maven/util/IOUtilsTests.java | 120 +++++----- .../util/tests/CollectionsUtilsTests.java | 12 +- maven-plugin/pom.xml | 4 +- maven-plugin/testing/pom.xml | 4 +- .../org/jvnet/jaxb/maven/test/RunXJCMojo.java | 6 +- .../org/jvnet/jaxb/maven/java9/Java9Test.java | 9 +- .../java/org/jvnet/jaxb/test/JT194Test.java | 8 +- .../java/org/jvnet/jaxb/test/JT40Test.java | 14 +- .../java/org/jvnet/jaxb/test/JT40Test.java | 12 +- .../jaxb/maven/tests/resstar/ChecksTest.java | 10 +- maven-plugin/tests/two/pom.xml | 4 +- maven-plugin/tests/wsdl-file/pom.xml | 4 +- maven-plugin/tests/wsdl/pom.xml | 4 +- pom.xml | 43 ++-- 201 files changed, 1389 insertions(+), 1461 deletions(-) diff --git a/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/annotation/util/tests/AnnotationUtilsTest.java b/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/annotation/util/tests/AnnotationUtilsTest.java index 9b4fa783a..ff333cf17 100644 --- a/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/annotation/util/tests/AnnotationUtilsTest.java +++ b/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/annotation/util/tests/AnnotationUtilsTest.java @@ -4,14 +4,14 @@ import java.util.Collection; import java.util.LinkedList; -import junit.framework.TestCase; - +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.model.XAnnotation; import org.jvnet.jaxb.annox.model.annotation.field.XAnnotationField; import org.jvnet.hyperjaxb3.annotation.util.AnnotationUtils; -public class AnnotationUtilsTest extends TestCase { +public class AnnotationUtilsTest { + @Test public void testA() throws Exception { final Collection> a = new LinkedList>(); @@ -21,6 +21,7 @@ public void testA() throws Exception { a.toArray(new XAnnotation[a.size()]), Override.class); } + @Test public void testB() throws Exception { final Collection> a = new LinkedList>(); @@ -28,4 +29,4 @@ public void testB() throws Exception { a.toArray(new XAnnotation[a.size()]), Override.class); } -} \ No newline at end of file +} diff --git a/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/ejb/strategy/annotate/tests/CreateXAnnotationsTest.java b/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/ejb/strategy/annotate/tests/CreateXAnnotationsTest.java index 5aa7870d0..498afb63f 100644 --- a/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/ejb/strategy/annotate/tests/CreateXAnnotationsTest.java +++ b/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/ejb/strategy/annotate/tests/CreateXAnnotationsTest.java @@ -3,8 +3,8 @@ import java.util.Arrays; import java.util.List; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.ejb.strategy.annotate.CreateXAnnotations; import jakarta.xml.ns.persistence.orm.AttributeOverride; @@ -26,6 +26,6 @@ public void createsAttributeOverrides() ao1.setColumn(new Column()); ao1.getColumn().setName("column_b"); List aos = Arrays.asList(ao0, ao1); - Assert.assertNotNull(createXAnnotations.createAttributeOverrides(aos)); + Assertions.assertNotNull(createXAnnotations.createAttributeOverrides(aos)); } } diff --git a/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/xsom/tests/SimpleTypesAnalyzerTest.java b/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/xsom/tests/SimpleTypesAnalyzerTest.java index 9a6e37684..aa405c453 100644 --- a/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/xsom/tests/SimpleTypesAnalyzerTest.java +++ b/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/xsom/tests/SimpleTypesAnalyzerTest.java @@ -2,9 +2,9 @@ import java.net.URL; -import junit.framework.Assert; -import junit.framework.TestCase; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.xsom.SimpleTypeAnalyzer; import com.sun.xml.xsom.XSSchemaSet; @@ -13,7 +13,7 @@ import javax.xml.parsers.SAXParserFactory; -public class SimpleTypesAnalyzerTest extends TestCase { +public class SimpleTypesAnalyzerTest { public static final String NS = "urn:org.jvnet.hyperjaxb3.xsom.tests"; @@ -43,12 +43,12 @@ public XSSchemaSet getSchemaSet() { return schemaSet; } - @Override + @BeforeEach protected void setUp() throws Exception { - super.setUp(); schemaSet = parse(SCHEMA_RESOURCE); } + @Test public void testLength() throws Exception { // XSSimpleType simpleType = schema.getSimpleType("length"); @@ -67,37 +67,37 @@ public void testLength() throws Exception { final XSSimpleType totalDigits = schemaSet.getSimpleType(NS, "totalDigits"); final XSSimpleType fractionDigits = schemaSet.getSimpleType(NS, "fractionDigits"); - Assert.assertEquals(Long.valueOf(5), SimpleTypeAnalyzer + Assertions.assertEquals(Long.valueOf(5), SimpleTypeAnalyzer .getMinLength(minLength)); - Assert.assertEquals(null, SimpleTypeAnalyzer.getMaxLength(minLength)); - Assert.assertEquals(null, SimpleTypeAnalyzer.getLength(minLength)); + Assertions.assertEquals(null, SimpleTypeAnalyzer.getMaxLength(minLength)); + Assertions.assertEquals(null, SimpleTypeAnalyzer.getLength(minLength)); - Assert.assertEquals(Long.valueOf(5), SimpleTypeAnalyzer + Assertions.assertEquals(Long.valueOf(5), SimpleTypeAnalyzer .getMinLength(maxLength)); - Assert.assertEquals(Long.valueOf(10), SimpleTypeAnalyzer + Assertions.assertEquals(Long.valueOf(10), SimpleTypeAnalyzer .getMaxLength(maxLength)); - Assert.assertEquals(null, SimpleTypeAnalyzer.getLength(maxLength)); + Assertions.assertEquals(null, SimpleTypeAnalyzer.getLength(maxLength)); - Assert.assertEquals(Long.valueOf(5), SimpleTypeAnalyzer + Assertions.assertEquals(Long.valueOf(5), SimpleTypeAnalyzer .getMinLength(length)); - Assert.assertEquals(Long.valueOf(10), SimpleTypeAnalyzer + Assertions.assertEquals(Long.valueOf(10), SimpleTypeAnalyzer .getMaxLength(length)); - Assert.assertEquals(Long.valueOf(8), SimpleTypeAnalyzer + Assertions.assertEquals(Long.valueOf(8), SimpleTypeAnalyzer .getLength(length)); - Assert.assertEquals(Long.valueOf(5), SimpleTypeAnalyzer + Assertions.assertEquals(Long.valueOf(5), SimpleTypeAnalyzer .getTotalDigits(digits)); - Assert.assertEquals(Long.valueOf(2), SimpleTypeAnalyzer + Assertions.assertEquals(Long.valueOf(2), SimpleTypeAnalyzer .getFractionDigits(digits)); - Assert.assertEquals(Long.valueOf(3), SimpleTypeAnalyzer + Assertions.assertEquals(Long.valueOf(3), SimpleTypeAnalyzer .getTotalDigits(totalDigits)); - Assert.assertEquals(null, SimpleTypeAnalyzer + Assertions.assertEquals(null, SimpleTypeAnalyzer .getFractionDigits(totalDigits)); - Assert.assertEquals(null, SimpleTypeAnalyzer + Assertions.assertEquals(null, SimpleTypeAnalyzer .getTotalDigits(fractionDigits)); - Assert.assertEquals(Long.valueOf(2), SimpleTypeAnalyzer + Assertions.assertEquals(Long.valueOf(2), SimpleTypeAnalyzer .getFractionDigits(fractionDigits)); } } diff --git a/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/xsom/tests/TypeUseTest.java b/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/xsom/tests/TypeUseTest.java index 852649f59..41876fe27 100644 --- a/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/xsom/tests/TypeUseTest.java +++ b/hyperjaxb/ejb/plugin/src/test/java/org/jvnet/hyperjaxb3/xsom/tests/TypeUseTest.java @@ -2,15 +2,15 @@ import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter; -import junit.framework.TestCase; - import com.sun.tools.xjc.model.CAdapter; import com.sun.tools.xjc.model.CBuiltinLeafInfo; import com.sun.tools.xjc.model.TypeUse; import com.sun.tools.xjc.model.TypeUseFactory; +import org.junit.jupiter.api.Test; -public class TypeUseTest extends TestCase { +public class TypeUseTest { + @Test public void testEquals() throws Exception { final CAdapter adapter = new CAdapter(NormalizedStringAdapter.class, diff --git a/hyperjaxb/ejb/roundtrip/pom.xml b/hyperjaxb/ejb/roundtrip/pom.xml index 85aee7ee7..0d7f316e0 100644 --- a/hyperjaxb/ejb/roundtrip/pom.xml +++ b/hyperjaxb/ejb/roundtrip/pom.xml @@ -22,8 +22,8 @@ provided - junit - junit + org.junit.jupiter + junit-jupiter-engine compile diff --git a/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/AbstractEntityManagerSamplesTest.java b/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/AbstractEntityManagerSamplesTest.java index f4c7e3e98..8d04a205d 100644 --- a/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/AbstractEntityManagerSamplesTest.java +++ b/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/AbstractEntityManagerSamplesTest.java @@ -11,6 +11,7 @@ import org.apache.commons.io.filefilter.IOFileFilter; import org.apache.commons.io.filefilter.TrueFileFilter; import org.apache.commons.lang3.SystemUtils; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.test.AbstractSamplesTest; import org.jvnet.jaxb.xml.bind.ContextPathAware; @@ -84,8 +85,11 @@ protected ClassLoader getContextClassLoader() { }; } + @Test public void testSamples() throws Exception { - samplesTest.testSamples(); + if (samplesTest != null) { + samplesTest.testSamples(); + } } protected JAXBContext createContext() throws JAXBException { diff --git a/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/AbstractEntityManagerTest.java b/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/AbstractEntityManagerTest.java index 70d60473d..13036f290 100644 --- a/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/AbstractEntityManagerTest.java +++ b/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/AbstractEntityManagerTest.java @@ -11,17 +11,17 @@ import jakarta.persistence.EntityManagerFactory; import jakarta.persistence.Persistence; -import junit.framework.TestCase; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; /** * Roundtrip test case. * * @author Aleksei Valikov */ -public abstract class AbstractEntityManagerTest extends TestCase { +public abstract class AbstractEntityManagerTest { protected Log logger = LogFactory.getLog(getClass()); @@ -37,8 +37,8 @@ public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) { this.entityManagerFactory = entityManagerFactory; } + @BeforeEach public void setUp() throws Exception { - super.setUp(); final EntityManagerFactory emf = getEntityManagerFactory(); if (emf == null || !emf.isOpen() || lastTestClass != getClass()) { setEntityManagerFactory(createEntityManagerFactory()); @@ -46,6 +46,11 @@ public void setUp() throws Exception { } } + + @AfterEach + public void tearDown() throws Exception { + } + public String getPersistenceUnitName() { final Package _package = getClass().getPackage(); final String name = _package.getName(); diff --git a/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/RoundtripTest.java b/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/RoundtripTest.java index 4a144554a..650d666b2 100644 --- a/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/RoundtripTest.java +++ b/hyperjaxb/ejb/roundtrip/src/main/java/org/jvnet/hyperjaxb3/ejb/test/RoundtripTest.java @@ -7,6 +7,7 @@ import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.Unmarshaller; +import org.junit.jupiter.api.Assertions; import org.jvnet.hyperjaxb3.ejb.util.EntityUtils; import org.jvnet.jaxb.lang.ContextUtils; import org.jvnet.jaxb.lang.EqualsStrategy; @@ -131,9 +132,10 @@ public boolean equals(ObjectLocator leftLocator, }; ; - assertTrue("Objects must be equal.", strategy.equals( + Assertions.assertTrue(strategy.equals( new DefaultRootObjectLocator(object), new DefaultRootObjectLocator(loadedObject), object, - loadedObject, true, true)); + loadedObject, true, true), + "Objects must be equal."); } } diff --git a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/cascadedids/tests/EntityManagerTest.java b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/cascadedids/tests/EntityManagerTest.java index 28f46d901..e3ef9df84 100644 --- a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/cascadedids/tests/EntityManagerTest.java +++ b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/cascadedids/tests/EntityManagerTest.java @@ -4,11 +4,13 @@ import jakarta.persistence.EntityManager; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.ejb.cascadedids.tests.Department.DepartmentId; import org.jvnet.hyperjaxb3.ejb.test.AbstractEntityManagerTest; public class EntityManagerTest extends AbstractEntityManagerTest { + @Test public void testIt() throws Exception { final Company company = new Company(); diff --git a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/test/tests/EntityManagerTest.java b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/test/tests/EntityManagerTest.java index 9d26b0cf9..b58624f8b 100644 --- a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/test/tests/EntityManagerTest.java +++ b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/test/tests/EntityManagerTest.java @@ -2,10 +2,13 @@ import jakarta.persistence.EntityManager; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.ejb.test.AbstractEntityManagerTest; public class EntityManagerTest extends AbstractEntityManagerTest { + @Test public void testIt() throws Exception { final A a1 = new A(); final B b1 = new B(); @@ -27,8 +30,8 @@ public void testIt() throws Exception { final A a3 = load("A"); - assertEquals(a3.getD(), a2.getD()); - assertEquals(a3.getB().getC(), a2.getB().getC()); + Assertions.assertEquals(a3.getD(), a2.getD()); + Assertions.assertEquals(a3.getB().getC(), a2.getB().getC()); } public void save(A a) { diff --git a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/test/tests/JavaReflectionManagerTest.java b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/test/tests/JavaReflectionManagerTest.java index 12ce061f0..ed7bf619e 100644 --- a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/test/tests/JavaReflectionManagerTest.java +++ b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/ejb/test/tests/JavaReflectionManagerTest.java @@ -1,12 +1,11 @@ package org.jvnet.hyperjaxb3.ejb.test.tests; -import junit.framework.TestCase; - import org.hibernate.annotations.common.reflection.XClass; import org.hibernate.annotations.common.reflection.java.JavaReflectionManager; -public class JavaReflectionManagerTest extends TestCase { +public class JavaReflectionManagerTest { + @org.junit.jupiter.api.Test public void testXClass() throws Exception { final JavaReflectionManager manager = new JavaReflectionManager(); diff --git a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/hibernate/tests/hhh/EntityManagerFactoryTest.java b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/hibernate/tests/hhh/EntityManagerFactoryTest.java index 03cd2acaa..62b9e7b3d 100644 --- a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/hibernate/tests/hhh/EntityManagerFactoryTest.java +++ b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/hibernate/tests/hhh/EntityManagerFactoryTest.java @@ -1,14 +1,12 @@ package org.jvnet.hyperjaxb3.hibernate.tests.hhh; -import static org.junit.Assert.assertNotNull; - import java.io.IOException; import java.util.Properties; import jakarta.persistence.EntityManagerFactory; import jakarta.persistence.Persistence; - -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class EntityManagerFactoryTest { @@ -20,7 +18,7 @@ public void entityManagerFactoryCreated() throws IOException { final String persistenceUnitName = getClass().getPackage().getName(); final EntityManagerFactory entityManagerFactory = Persistence .createEntityManagerFactory(persistenceUnitName, properties); - assertNotNull(entityManagerFactory); + Assertions.assertNotNull(entityManagerFactory); } diff --git a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/lang/builder/tests/NumberEqualsTest.java b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/lang/builder/tests/NumberEqualsTest.java index 6f0714825..7e6a216ab 100644 --- a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/lang/builder/tests/NumberEqualsTest.java +++ b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/lang/builder/tests/NumberEqualsTest.java @@ -2,16 +2,17 @@ import java.math.BigDecimal; -import junit.framework.TestCase; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -public class NumberEqualsTest extends TestCase { - +public class NumberEqualsTest { + @Test public void testBigDecimal() throws Exception { - + final BigDecimal a = new BigDecimal("2.001"); final BigDecimal b = new BigDecimal("2.0010"); - - assertTrue(a.compareTo(b) == 0); + + Assertions.assertTrue(a.compareTo(b) == 0); } } diff --git a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/xml/datatype/XMLGregorianCalendarTest.java b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/xml/datatype/XMLGregorianCalendarTest.java index 3d78e0c66..71debb10b 100644 --- a/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/xml/datatype/XMLGregorianCalendarTest.java +++ b/hyperjaxb/ejb/roundtrip/src/test/java/org/jvnet/hyperjaxb3/xml/datatype/XMLGregorianCalendarTest.java @@ -3,13 +3,12 @@ import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; -import junit.framework.TestCase; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.jupiter.api.Test; + +public class XMLGregorianCalendarTest { -public class XMLGregorianCalendarTest extends TestCase { - protected Log logger = LogFactory.getLog(getClass()); private DatatypeFactory datatypeFactory; @@ -25,6 +24,7 @@ public DatatypeFactory getDatatypeFactory() { return datatypeFactory; } + @Test public void testIt() { final XMLGregorianCalendar calendar = getDatatypeFactory() diff --git a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/adapters/tests/ReflectionTest.java b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/adapters/tests/ReflectionTest.java index 87a62b96f..226bae322 100644 --- a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/adapters/tests/ReflectionTest.java +++ b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/adapters/tests/ReflectionTest.java @@ -1,34 +1,34 @@ package org.jvnet.hyperjaxb3.adapters.tests; -import junit.framework.TestCase; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.jupiter.api.Test; -public class ReflectionTest extends TestCase { +public class ReflectionTest { protected Log logger = LogFactory.getLog(getClass()); + @Test public void testType() throws Exception { // // final Class x = XMLGregorianCalendarAsGDayAdapter.class; -// +// // assert XmlAdapter.class.isAssignableFrom(x); // -// +// // Method method = x.getMethod("marshal", new Class[]{Object.class}); -// +// // // Type t = method.getGenericReturnType(); -// +// // Class xc = (Class) x.getGenericSuperclass(); -// +// // TypeVariable[] typeParameters = xc.getTypeParameters(); -// +// // Method xmethod = xc.getMethod("marshal", new Class[]{Object.class}); -// +// // Type genericReturnType = xmethod.getGenericReturnType(); -// +// // logger.debug(t); } } diff --git a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/adapters/tests/XmlAdapterUtilsTest.java b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/adapters/tests/XmlAdapterUtilsTest.java index 134e97a54..a585d25a4 100644 --- a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/adapters/tests/XmlAdapterUtilsTest.java +++ b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/adapters/tests/XmlAdapterUtilsTest.java @@ -10,9 +10,8 @@ import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; -import junit.framework.Assert; -import junit.framework.TestCase; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.xml.bind.annotation.adapters.DurationAsString; import org.jvnet.hyperjaxb3.xml.bind.annotation.adapters.QNameAsString; import org.jvnet.hyperjaxb3.xml.bind.annotation.adapters.TimeStringAsCalendar; @@ -22,30 +21,33 @@ import org.jvnet.hyperjaxb3.xml.bind.annotation.adapters.XmlAdapterUtils; import org.jvnet.hyperjaxb3.xml.datatype.util.XMLGregorianCalendarUtils; -public class XmlAdapterUtilsTest extends TestCase { +public class XmlAdapterUtilsTest { + @Test public void testQNameXmlAdapter() throws Exception { - + final String alpha = "{urn:test}test"; final QName omega = new QName("urn:test", "test"); - Assert.assertEquals("Conversion failed.", alpha, XmlAdapterUtils - .unmarshall(QNameAsString.class, omega)); - Assert.assertEquals("Conversion failed.", omega, XmlAdapterUtils - .marshall(QNameAsString.class, alpha)); + Assertions.assertEquals(alpha, XmlAdapterUtils + .unmarshall(QNameAsString.class, omega), "Conversion failed."); + Assertions.assertEquals(omega, XmlAdapterUtils + .marshall(QNameAsString.class, alpha), "Conversion failed."); } + @Test public void testDuration() throws Exception { final String alpha = "P1Y2M3DT10H30M12.3S"; final Duration omega = DatatypeFactory.newInstance().newDuration(alpha); - Assert.assertEquals("Conversion failed.", alpha, XmlAdapterUtils - .unmarshall(DurationAsString.class, omega)); - Assert.assertEquals("Conversion failed.", omega, XmlAdapterUtils - .marshall(DurationAsString.class, alpha)); + Assertions.assertEquals(alpha, XmlAdapterUtils + .unmarshall(DurationAsString.class, omega), "Conversion failed."); + Assertions.assertEquals(omega, XmlAdapterUtils + .marshall(DurationAsString.class, alpha), "Conversion failed."); } + @Test public void testXMLGregorianCalendarXmlAdapter() throws Exception { final XMLGregorianCalendar alpha = DatatypeFactory.newInstance() @@ -58,23 +60,24 @@ public void testXMLGregorianCalendarXmlAdapter() throws Exception { XMLGregorianCalendarAsDateTime.class, XmlAdapterUtils.unmarshall( XMLGregorianCalendarAsDateTime.class, alpha)); - // Assert.assertEquals("Conversion failed.", alpha.normalize(), + // Assertions.assertEquals("Conversion failed.", alpha.normalize(), // omega.normalize()); - // Assert.assertEquals("Conversion failed.", alpha.normalize(), + // Assertions.assertEquals("Conversion failed.", alpha.normalize(), // beta.normalize()); - // Assert.assertEquals("Conversion failed.", beta.normalize(), + // Assertions.assertEquals("Conversion failed.", beta.normalize(), // omega.normalize()); - Assert.assertEquals("Conversion failed.", XMLGregorianCalendarUtils + Assertions.assertEquals(XMLGregorianCalendarUtils .getTimeInMillis(alpha), XMLGregorianCalendarUtils - .getTimeInMillis(beta)); - Assert.assertEquals("Conversion failed.", XMLGregorianCalendarUtils + .getTimeInMillis(beta), "Conversion failed."); + Assertions.assertEquals(XMLGregorianCalendarUtils .getTimeInMillis(alpha), XMLGregorianCalendarUtils - .getTimeInMillis(omega)); - Assert.assertEquals("Conversion failed.", XMLGregorianCalendarUtils + .getTimeInMillis(omega), "Conversion failed."); + Assertions.assertEquals(XMLGregorianCalendarUtils .getTimeInMillis(beta), XMLGregorianCalendarUtils - .getTimeInMillis(omega)); + .getTimeInMillis(omega), "Conversion failed."); } + @Test public void testXMLGregorianCalendarAsDate() throws Exception { final java.sql.Date alpha = java.sql.Date.valueOf("2005-01-01"); @@ -95,9 +98,10 @@ public void testXMLGregorianCalendarAsDate() throws Exception { System.out.println("4)" + delta.toGregorianCalendar().getTime().getTime()); System.out.println("4>" + delta); - Assert.assertEquals("Conversion failed.", beta, delta); + Assertions.assertEquals(beta, delta, "Conversion failed."); } + @Test public void testXMLGregorianCalendarAsDateInNegativeTimezone() throws Exception { @@ -121,11 +125,12 @@ public void testXMLGregorianCalendarAsDateInNegativeTimezone() XMLGregorianCalendarAsDate.class, gamma); System.out.println("4)" + delta.toGregorianCalendar().getTime().getTime()); - Assert.assertEquals("Conversion failed.", beta, delta); + Assertions.assertEquals(beta, delta, "Conversion failed."); TimeZone.setDefault(_default); } + @Test public void testXMLGregorianCalendarAsTime() throws Exception { final java.sql.Time alpha = java.sql.Time.valueOf("10:12:14"); @@ -137,9 +142,10 @@ public void testXMLGregorianCalendarAsTime() throws Exception { XMLGregorianCalendarAsTime.class, beta); final XMLGregorianCalendar delta = XmlAdapterUtils.marshall( XMLGregorianCalendarAsTime.class, gamma); - Assert.assertEquals("Conversion failed.", beta, delta); + Assertions.assertEquals(beta, delta, "Conversion failed."); } + @Test public void testTimeStringAsCalendarXmlAdapter() throws Exception { checkTimeStringAsCalendarXmlAdapter("10:20:30"); @@ -158,11 +164,12 @@ private void checkTimeStringAsCalendarXmlAdapter(final String alpha) { TimeStringAsCalendar.class, gamma); final String epsilon = XmlAdapterUtils.marshall( TimeStringAsCalendar.class, delta); - // Assert.assertEquals("Conversion failed.", alpha, gamma); - Assert.assertEquals("Conversion failed.", beta, delta); - Assert.assertEquals("Conversion failed.", gamma, epsilon); + // Assertions.assertEquals("Conversion failed.", alpha, gamma); + Assertions.assertEquals(beta, delta, "Conversion failed."); + Assertions.assertEquals(gamma, epsilon, "Conversion failed."); } + @Test public void testXMLGregorianCalendarAsDateTimeXmlAdapter() throws Exception { checkXMLGregorianCalendarAsDateTimeXmlAdapter("2005-01-01T00:00:00.000+00:00"); @@ -196,13 +203,13 @@ private void checkXMLGregorianCalendarAsDateTimeXmlAdapter(final String text) XMLGregorianCalendarAsDateTime.class, delta); long e = epsilon.toGregorianCalendar().getTimeInMillis(); System.out.println("5]" + e); - // Assert.assertEquals("Conversion failed.", alpha, gamma); - Assert.assertEquals("Conversion failed.", beta, delta); - Assert.assertEquals("Conversion failed.", gamma, epsilon); - Assert.assertEquals("Conversion failed.", a, b); - Assert.assertEquals("Conversion failed.", b, c); - Assert.assertEquals("Conversion failed.", c, d); - Assert.assertEquals("Conversion failed.", d, e); + // Assertions.assertEquals("Conversion failed.", alpha, gamma); + Assertions.assertEquals(beta, delta, "Conversion failed."); + Assertions.assertEquals(gamma, epsilon, "Conversion failed."); + Assertions.assertEquals(a, b, "Conversion failed."); + Assertions.assertEquals(b, c, "Conversion failed."); + Assertions.assertEquals(c, d, "Conversion failed."); + Assertions.assertEquals(d, e, "Conversion failed."); } // public void testXMLGregorianCalendarAsDateXmlAdapter() throws Exception { @@ -239,12 +246,12 @@ private void checkXMLGregorianCalendarAsDateTimeXmlAdapter(final String text) // XMLGregorianCalendarAsDate.class, delta); // long e = epsilon.toGregorianCalendar().getTimeInMillis(); // System.out.println("5>" + e); -// // Assert.assertEquals("Conversion failed.", alpha, gamma); -// // Assert.assertEquals("Conversion failed.", beta, delta); -// // Assert.assertEquals("Conversion failed.", gamma, epsilon); -// Assert.assertEquals("Conversion failed.", a, b); -// Assert.assertEquals("Conversion failed.", b, c); -// Assert.assertEquals("Conversion failed.", c, d); -// Assert.assertEquals("Conversion failed.", d, e); +// // Assertions.assertEquals("Conversion failed.", alpha, gamma); +// // Assertions.assertEquals("Conversion failed.", beta, delta); +// // Assertions.assertEquals("Conversion failed.", gamma, epsilon); +// Assertions.assertEquals("Conversion failed.", a, b); +// Assertions.assertEquals("Conversion failed.", b, c); +// Assertions.assertEquals("Conversion failed.", c, d); +// Assertions.assertEquals("Conversion failed.", d, e); // } } diff --git a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/eg/tests/TestWrapping.java b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/eg/tests/TestWrapping.java index d74ca4a75..e5e1cac37 100644 --- a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/eg/tests/TestWrapping.java +++ b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/eg/tests/TestWrapping.java @@ -1,5 +1,5 @@ /** - * + * */ package org.jvnet.hyperjaxb3.eg.tests; @@ -8,29 +8,25 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.Unmarshaller; - -import junit.framework.TestCase; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; /** * @author bspies * Test using XmlElementWrapper with XmlAnyElement. */ -public class TestWrapping extends TestCase -{ +public class TestWrapping { + @Test public void testWrapping() throws Exception { JAXBContext ctx = JAXBContext.newInstance(Job.class, Node.class, UserTask.class, AutoTask.class); InputStream is = TestWrapping.class.getResourceAsStream("test.xml"); Unmarshaller unmarshaller = ctx.createUnmarshaller(); Job job = (Job)unmarshaller.unmarshal(is); Collection nodes = job.getNodes(); - assertNotNull("Nodes are null!", nodes); - assertTrue("There are no nodes!", nodes.size()>0); - for(Node n : nodes) { + Assertions.assertNotNull(nodes, "Nodes are null!"); + Assertions.assertTrue(nodes.size() > 0, "There are no nodes!"); + for (Node n : nodes) { System.out.println("Name: " + n.getName()); } } - - public static void main(String[] args) { - junit.textui.TestRunner.run(TestWrapping.class); - } } diff --git a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/ejb/util/tests/EntityUtilsTest.java b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/ejb/util/tests/EntityUtilsTest.java index 17159a99d..9ad461983 100644 --- a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/ejb/util/tests/EntityUtilsTest.java +++ b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/ejb/util/tests/EntityUtilsTest.java @@ -4,33 +4,36 @@ import jakarta.persistence.EmbeddedId; import jakarta.persistence.Id; -import junit.framework.TestCase; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.ejb.util.EntityUtils; -public class EntityUtilsTest extends TestCase { +public class EntityUtilsTest { + @Test public void testGetIdOne() throws Exception { final One one = new One(10); - assertEquals("Wrong id.", (long) 10, EntityUtils.getId(one)); + Assertions.assertEquals((long) 10, EntityUtils.getId(one), "Wrong id."); } + @Test public void testGetIdTwo() throws Exception { final Two two = new Two(); two.setId(20); - assertEquals("Wrong id.", (long) 20, EntityUtils.getId(two)); + Assertions.assertEquals((long) 20, EntityUtils.getId(two), "Wrong id."); } + @Test public void testGetIdThree() throws Exception { final Alpha threeAlpha = new Alpha(); threeAlpha.p = 30; threeAlpha.q = "forty"; final Three three = new Three(threeAlpha); - assertEquals("Wrong id.", threeAlpha, EntityUtils.getId(three)); + Assertions.assertEquals(threeAlpha, EntityUtils.getId(three), "Wrong id."); } public void testGetIdFour() throws Exception { @@ -39,7 +42,7 @@ public void testGetIdFour() throws Exception { fourAlpha.q = "sixty"; final Four four = new Four(); four.setId(fourAlpha); - assertEquals("Wrong id.", fourAlpha, EntityUtils.getId(four)); + Assertions.assertEquals(fourAlpha, EntityUtils.getId(four), "Wrong id."); } public static class One { diff --git a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/sb/tests/AtributeDefinitionTest.java b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/sb/tests/AtributeDefinitionTest.java index 6b5ecb381..8bf08b571 100644 --- a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/sb/tests/AtributeDefinitionTest.java +++ b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/sb/tests/AtributeDefinitionTest.java @@ -1,13 +1,12 @@ package org.jvnet.hyperjaxb3.sb.tests; import jakarta.xml.bind.JAXBContext; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import junit.framework.Assert; -import junit.framework.TestCase; +public class AtributeDefinitionTest { -public class AtributeDefinitionTest extends TestCase { - - @SuppressWarnings("unchecked") + @Test public void testUnmarshall() throws Exception { JAXBContext context = JAXBContext .newInstance(AttributeDefinition.class); @@ -16,10 +15,11 @@ public void testUnmarshall() throws Exception { .createUnmarshaller().unmarshal( getClass().getResourceAsStream("attribute.xml")); - Assert.assertEquals(Integer.valueOf(5), attributeDefinition.getValue()); + Assertions.assertEquals(Integer.valueOf(5), attributeDefinition.getValue()); } - + + @Test public void testSimpleUnmarshall() throws Exception { JAXBContext context = JAXBContext .newInstance(SimpleAttributeDefinition.class); @@ -28,8 +28,8 @@ public void testSimpleUnmarshall() throws Exception { .createUnmarshaller().unmarshal( getClass().getResourceAsStream("simpleAttribute.xml")); - Assert.assertEquals(Integer.valueOf(5), attributeDefinition.getValue()); + Assertions.assertEquals(Integer.valueOf(5), attributeDefinition.getValue()); } - + } diff --git a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/util/tests/ItemListTest.java b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/util/tests/ItemListTest.java index df0e603fa..6d99e665b 100644 --- a/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/util/tests/ItemListTest.java +++ b/hyperjaxb/ejb/runtime/src/test/java/org/jvnet/hyperjaxb3/util/tests/ItemListTest.java @@ -8,13 +8,13 @@ import java.util.Iterator; import java.util.List; -import junit.framework.Assert; -import junit.framework.TestCase; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.item.DefaultItemList; -public class ItemListTest extends TestCase { +public class ItemListTest { + @Test public void testItemList() throws Exception { final List items = new ArrayList(); @@ -25,10 +25,10 @@ public void testItemList() throws Exception { strings.add("a"); strings.add("b"); - Assert.assertEquals("Wrong number of items.", 2, items.size()); + Assertions.assertEquals(2, items.size(), "Wrong number of items."); final Iterator iterator = items.iterator(); - Assert.assertEquals("Wrong value.", "a", iterator.next().getItem()); - Assert.assertEquals("Wrong value.", "b", iterator.next().getItem()); + Assertions.assertEquals("a", iterator.next().getItem(), "Wrong value."); + Assertions.assertEquals("b", iterator.next().getItem(), "Wrong value."); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); @@ -46,7 +46,7 @@ public void testItemList() throws Exception { final List sgnirts = (List) objectInputStream .readObject(); - Assert.assertEquals(strings, sgnirts); + Assertions.assertEquals(strings, sgnirts); } diff --git a/hyperjaxb/ejb/samples/customerservice-cxf/pom.xml b/hyperjaxb/ejb/samples/customerservice-cxf/pom.xml index b99564cbd..303edd425 100644 --- a/hyperjaxb/ejb/samples/customerservice-cxf/pom.xml +++ b/hyperjaxb/ejb/samples/customerservice-cxf/pom.xml @@ -93,8 +93,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine test diff --git a/hyperjaxb/ejb/samples/customerservice-cxf/src/test/java/com/example/customerservice/test/ApplicationStartsIT.java b/hyperjaxb/ejb/samples/customerservice-cxf/src/test/java/com/example/customerservice/test/ApplicationStartsIT.java index 6907c70b8..d8c2be140 100644 --- a/hyperjaxb/ejb/samples/customerservice-cxf/src/test/java/com/example/customerservice/test/ApplicationStartsIT.java +++ b/hyperjaxb/ejb/samples/customerservice-cxf/src/test/java/com/example/customerservice/test/ApplicationStartsIT.java @@ -3,15 +3,10 @@ /*import java.io.IOException; import java.net.URL; -import junit.framework.Assert; - import org.hisrc.hifaces20.testing.net.URLUtils; import org.hisrc.hifaces20.testing.webappenvironment.WebAppEnvironment; import org.hisrc.hifaces20.testing.webappenvironment.annotations.PropertiesWebAppEnvironmentConfig; import org.hisrc.hifaces20.testing.webappenvironment.testing.junit4.WebAppEnvironmentRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.MethodRule; public class ApplicationStartsIT { diff --git a/hyperjaxb/ejb/samples/customerservice-cxf/src/test/java/com/example/customerservice/test/CustomerServiceIT.java b/hyperjaxb/ejb/samples/customerservice-cxf/src/test/java/com/example/customerservice/test/CustomerServiceIT.java index ba6108fa1..967ddfe2a 100644 --- a/hyperjaxb/ejb/samples/customerservice-cxf/src/test/java/com/example/customerservice/test/CustomerServiceIT.java +++ b/hyperjaxb/ejb/samples/customerservice-cxf/src/test/java/com/example/customerservice/test/CustomerServiceIT.java @@ -11,9 +11,6 @@ import org.hisrc.hifaces20.testing.webappenvironment.WebAppEnvironment; import org.hisrc.hifaces20.testing.webappenvironment.annotations.PropertiesWebAppEnvironmentConfig; import org.hisrc.hifaces20.testing.webappenvironment.testing.junit4.WebAppEnvironmentRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.MethodRule; import com.example.customerservice.model.Customer; import com.example.customerservice.model.CustomerType; @@ -70,4 +67,4 @@ public void checkCustomerService() throws Exception { */ public class CustomerServiceIT { // FIXME -} \ No newline at end of file +} diff --git a/hyperjaxb/ejb/samples/po-customized-eclipselink/project-build.xml b/hyperjaxb/ejb/samples/po-customized-eclipselink/project-build.xml index c169dc43f..53ea36177 100644 --- a/hyperjaxb/ejb/samples/po-customized-eclipselink/project-build.xml +++ b/hyperjaxb/ejb/samples/po-customized-eclipselink/project-build.xml @@ -160,17 +160,17 @@ - + - - + + + - @@ -179,8 +179,8 @@ - - + + diff --git a/hyperjaxb/ejb/samples/po-customized-eclipselink/project-pom.xml b/hyperjaxb/ejb/samples/po-customized-eclipselink/project-pom.xml index d9d35f41e..03e2cedae 100644 --- a/hyperjaxb/ejb/samples/po-customized-eclipselink/project-pom.xml +++ b/hyperjaxb/ejb/samples/po-customized-eclipselink/project-pom.xml @@ -24,13 +24,6 @@ ${project.version} - - - org.jvnet.jaxb diff --git a/hyperjaxb/ejb/samples/po-initial/project-build.xml b/hyperjaxb/ejb/samples/po-initial/project-build.xml index 5555d4d89..0f8e99c31 100644 --- a/hyperjaxb/ejb/samples/po-initial/project-build.xml +++ b/hyperjaxb/ejb/samples/po-initial/project-build.xml @@ -168,17 +168,16 @@ - + - - - - + + + @@ -187,8 +186,8 @@ - - + + diff --git a/hyperjaxb/ejb/samples/po-initial/project-pom.xml b/hyperjaxb/ejb/samples/po-initial/project-pom.xml index ad263f8a2..f64282a27 100644 --- a/hyperjaxb/ejb/samples/po-initial/project-pom.xml +++ b/hyperjaxb/ejb/samples/po-initial/project-pom.xml @@ -24,13 +24,6 @@ ${project.version} - - - org.jvnet.jaxb diff --git a/hyperjaxb/ejb/samples/uniprot/project-build.xml b/hyperjaxb/ejb/samples/uniprot/project-build.xml index 3486722d3..1c46af1fd 100644 --- a/hyperjaxb/ejb/samples/uniprot/project-build.xml +++ b/hyperjaxb/ejb/samples/uniprot/project-build.xml @@ -165,17 +165,16 @@ - + - - - - + + + @@ -184,8 +183,8 @@ - - + + diff --git a/hyperjaxb/ejb/samples/uniprot/project-pom.xml b/hyperjaxb/ejb/samples/uniprot/project-pom.xml index 0d6e0ba4d..7067fbaff 100644 --- a/hyperjaxb/ejb/samples/uniprot/project-pom.xml +++ b/hyperjaxb/ejb/samples/uniprot/project-pom.xml @@ -24,13 +24,6 @@ ${project.version} - - - org.jvnet.jaxb diff --git a/hyperjaxb/ejb/schemas/customizations/src/test/java/org/jvnet/hyperjaxb3/ejb/schemas/customizations/tests/UnmarshalPersistenceTest.java b/hyperjaxb/ejb/schemas/customizations/src/test/java/org/jvnet/hyperjaxb3/ejb/schemas/customizations/tests/UnmarshalPersistenceTest.java index 0bf43c238..ebb9a40c9 100644 --- a/hyperjaxb/ejb/schemas/customizations/src/test/java/org/jvnet/hyperjaxb3/ejb/schemas/customizations/tests/UnmarshalPersistenceTest.java +++ b/hyperjaxb/ejb/schemas/customizations/src/test/java/org/jvnet/hyperjaxb3/ejb/schemas/customizations/tests/UnmarshalPersistenceTest.java @@ -8,15 +8,15 @@ import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; -import junit.framework.TestCase; - import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.Validate; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.ejb.schemas.customizations.Customizations; import org.jvnet.hyperjaxb3.ejb.schemas.customizations.Persistence; import org.jvnet.hyperjaxb3.ejb.schemas.customizations.SingleProperty; -public class UnmarshalPersistenceTest extends TestCase { +public class UnmarshalPersistenceTest { protected JAXBContext getContext() { return Customizations.getContext(); @@ -32,7 +32,7 @@ protected Persistence unmarshal(String resourceName) throws IOException, } else { is = getClass().getResourceAsStream(resourceName); } - assertNotNull(is); + Assertions.assertNotNull(is); try { @SuppressWarnings("unchecked") final JAXBElement persistenceElement = (JAXBElement) getContext() @@ -43,17 +43,18 @@ protected Persistence unmarshal(String resourceName) throws IOException, } } + @Test public void testPersistence0() throws Exception { final Persistence persistence = unmarshal("persistence[0].xml"); final List defaultSingleProperties = persistence .getDefaultSingleProperty(); - assertFalse(defaultSingleProperties.isEmpty()); + Assertions.assertFalse(defaultSingleProperties.isEmpty()); final SingleProperty singleProperty = defaultSingleProperties.get(0); - assertEquals(255, singleProperty.getBasic().getColumn().getLength() + Assertions.assertEquals(255, singleProperty.getBasic().getColumn().getLength() .intValue()); } diff --git a/hyperjaxb/ejb/templates/basic/project-build.xml b/hyperjaxb/ejb/templates/basic/project-build.xml index c77abe62e..090ec4cb9 100644 --- a/hyperjaxb/ejb/templates/basic/project-build.xml +++ b/hyperjaxb/ejb/templates/basic/project-build.xml @@ -166,17 +166,16 @@ - + - - - - + + + @@ -185,8 +184,8 @@ - - + + diff --git a/hyperjaxb/ejb/templates/basic/project-pom.xml b/hyperjaxb/ejb/templates/basic/project-pom.xml index 6156ad9ea..ae43260b1 100644 --- a/hyperjaxb/ejb/templates/basic/project-pom.xml +++ b/hyperjaxb/ejb/templates/basic/project-pom.xml @@ -24,13 +24,6 @@ ${project.version} - - - org.jvnet.jaxb diff --git a/hyperjaxb/ejb/tests/component-jpa2/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/componentjpa2/tests/TestHyperJaxb.java b/hyperjaxb/ejb/tests/component-jpa2/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/componentjpa2/tests/TestHyperJaxb.java index bfb2cbe81..8ae541325 100644 --- a/hyperjaxb/ejb/tests/component-jpa2/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/componentjpa2/tests/TestHyperJaxb.java +++ b/hyperjaxb/ejb/tests/component-jpa2/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/componentjpa2/tests/TestHyperJaxb.java @@ -1,7 +1,6 @@ package org.jvnet.hyperjaxb3.ejb.tests.componentjpa2.tests; - -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.xml.bind.JAXBContextUtils; import jakarta.persistence.EntityManager; diff --git a/hyperjaxb/ejb/tests/issues-jpa2/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issuesjpa2/HJIII73Test.java b/hyperjaxb/ejb/tests/issues-jpa2/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issuesjpa2/HJIII73Test.java index bb37821ac..ee6fab882 100644 --- a/hyperjaxb/ejb/tests/issues-jpa2/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issuesjpa2/HJIII73Test.java +++ b/hyperjaxb/ejb/tests/issues-jpa2/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issuesjpa2/HJIII73Test.java @@ -2,15 +2,15 @@ import jakarta.persistence.OrderColumn; -import junit.framework.Assert; -import junit.framework.TestCase; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.reflect.AnnotatedElementFactory; import org.jvnet.jaxb.annox.reflect.DualAnnotatedElementFactory; import org.jvnet.jaxb.annox.reflect.ParameterizedAnnotatedElement; -public class HJIII73Test extends TestCase { +public class HJIII73Test { + @Test public void testLengthAnnotation() throws Exception { final AnnotatedElementFactory aef = new DualAnnotatedElementFactory(); @@ -22,11 +22,10 @@ public void testLengthAnnotation() throws Exception { .getAnnotatedElement(HJIII73Parent.class .getMethod("getHJIII73ChildManyToMany")); - Assert.assertNotNull(o2m.getAnnotation(OrderColumn.class)); - Assert.assertTrue(o2m.getAnnotation(OrderColumn.class).name().length() > 0); - Assert.assertNotNull(m2m.getAnnotation(OrderColumn.class)); - Assert.assertEquals("ORDNUNG", m2m.getAnnotation(OrderColumn.class) - .name()); + Assertions.assertNotNull(o2m.getAnnotation(OrderColumn.class)); + Assertions.assertTrue(o2m.getAnnotation(OrderColumn.class).name().length() > 0); + Assertions.assertNotNull(m2m.getAnnotation(OrderColumn.class)); + Assertions.assertEquals("ORDNUNG", m2m.getAnnotation(OrderColumn.class).name()); } } diff --git a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII100Test.java b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII100Test.java index c98830423..d92401a79 100644 --- a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII100Test.java +++ b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII100Test.java @@ -1,18 +1,18 @@ package org.jvnet.hyperjaxb3.ejb.tests.issues; import jakarta.persistence.NamedQuery; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import junit.framework.Assert; -import junit.framework.TestCase; - -public class IssueHJIII100Test extends TestCase { +public class IssueHJIII100Test { + @Test public void testEntityAnnotation() throws Exception { - Assert.assertNotNull(IssueHJIII100Type.class + Assertions.assertNotNull(IssueHJIII100Type.class .getAnnotation(NamedQuery.class)); - Assert.assertEquals( + Assertions.assertEquals( 1, IssueHJIII100Type.class.getAnnotation(NamedQuery.class).hints().length); } diff --git a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII28Test.java b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII28Test.java index 7ba4760f0..820b726e0 100644 --- a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII28Test.java +++ b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII28Test.java @@ -2,15 +2,15 @@ import jakarta.persistence.Column; -import junit.framework.Assert; -import junit.framework.TestCase; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.reflect.AnnotatedElementFactory; import org.jvnet.jaxb.annox.reflect.DualAnnotatedElementFactory; import org.jvnet.jaxb.annox.reflect.ParameterizedAnnotatedElement; -public class IssueHJIII28Test extends TestCase { +public class IssueHJIII28Test { + @Test public void testLengthAnnotation() throws Exception { final AnnotatedElementFactory aef = new DualAnnotatedElementFactory(); @@ -19,11 +19,7 @@ public void testLengthAnnotation() throws Exception { final Column annotation = annotatedElement.getAnnotation(Column.class); - Assert.assertEquals(1024, annotation.length()); - - - - + Assertions.assertEquals(1024, annotation.length()); } } diff --git a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII32Test.java b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII32Test.java index 506ca9829..bb5fdc54b 100644 --- a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII32Test.java +++ b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII32Test.java @@ -2,20 +2,15 @@ import jakarta.persistence.Entity; -import junit.framework.Assert; -import junit.framework.TestCase; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.ejb.tests.issuesignored.IssueHJIII32ComplexType; -public class IssueHJIII32Test extends TestCase { +public class IssueHJIII32Test { + @Test public void testEntityAnnotation() throws Exception { - - Assert.assertNull(IssueHJIII32ComplexType.class.getAnnotation(Entity.class)); - - - - + Assertions.assertNull(IssueHJIII32ComplexType.class.getAnnotation(Entity.class)); } } diff --git a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII35Test.java b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII35Test.java index c5ca6293b..c13dda5bc 100644 --- a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII35Test.java +++ b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII35Test.java @@ -1,15 +1,15 @@ package org.jvnet.hyperjaxb3.ejb.tests.issues; import jakarta.persistence.Version; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import junit.framework.Assert; -import junit.framework.TestCase; - -public class IssueHJIII35Test extends TestCase { +public class IssueHJIII35Test { + @Test public void testEntityAnnotation() throws Exception { - Assert.assertNotNull(IssueHJIII35Type.class.getMethod("getHjversion", + Assertions.assertNotNull(IssueHJIII35Type.class.getMethod("getHjversion", new Class[0]).getAnnotation(Version.class)); } diff --git a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII41Test.java b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII41Test.java index 1bc8202d9..c1574bde8 100644 --- a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII41Test.java +++ b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII41Test.java @@ -1,23 +1,19 @@ package org.jvnet.hyperjaxb3.ejb.tests.issues; import jakarta.persistence.Id; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import junit.framework.Assert; -import junit.framework.TestCase; - -public class IssueHJIII41Test extends TestCase { +public class IssueHJIII41Test { + @Test public void testEntityAnnotation() throws Exception { - Assert.assertNotNull(IssueHJIII41ParentType.class.getMethod("getId", + Assertions.assertNotNull(IssueHJIII41ParentType.class.getMethod("getId", new Class[0]).getAnnotation(Id.class)); - try { - IssueHJIII41ChildType.class.getMethod("getHjid", new Class[0]); - Assert.fail("Expected exception."); - } catch (NoSuchMethodException nsmex) { - Assert.assertTrue(true); - } + Assertions.assertThrows(NoSuchMethodException.class, () -> + IssueHJIII41ChildType.class.getMethod("getHjid", new Class[0])); } } diff --git a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII94Test.java b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII94Test.java index c8effd470..e935cf455 100644 --- a/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII94Test.java +++ b/hyperjaxb/ejb/tests/issues/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/issues/IssueHJIII94Test.java @@ -2,32 +2,29 @@ import jakarta.persistence.Id; import jakarta.persistence.Version; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import junit.framework.Assert; -import junit.framework.TestCase; +public class IssueHJIII94Test { -public class IssueHJIII94Test extends TestCase { + @Test + public void testEntityAnnotationId() throws Exception { - public void testEntityAnnotation() throws Exception { + Assertions.assertNotNull(IssueHJIII94Type.class.getMethod("getHjid", + new Class[0]).getAnnotation(Id.class)); - Assert.assertNotNull(IssueHJIII94Type.class.getMethod("getHjid", - new Class[0]).getAnnotation(Id.class)); + Assertions.assertThrows(NoSuchMethodException.class, () -> + IssueHJIII94SubType.class.getDeclaredMethod("getHjid", new Class[0])); + } - Assert.assertNotNull(IssueHJIII94Type.class.getMethod("getHjversion", - new Class[0]).getAnnotation(Version.class)); + @Test + public void testEntityAnnotationVersion() throws Exception { - try { - IssueHJIII94SubType.class.getDeclaredMethod("getHjid", new Class[0]); - Assert.fail("Expected exception."); - } catch (NoSuchMethodException nsmex) { - Assert.assertTrue(true); - } - try { - IssueHJIII94SubType.class.getDeclaredMethod("getHjversion", new Class[0]); - Assert.fail("Expected exception."); - } catch (NoSuchMethodException nsmex) { - Assert.assertTrue(true); - } - } + Assertions.assertNotNull(IssueHJIII94Type.class.getMethod("getHjversion", + new Class[0]).getAnnotation(Version.class)); + + Assertions.assertThrows(NoSuchMethodException.class, () -> + IssueHJIII94SubType.class.getDeclaredMethod("getHjversion", new Class[0])); + } } diff --git a/hyperjaxb/ejb/tests/pom.xml b/hyperjaxb/ejb/tests/pom.xml index a7dbec110..90e99f5b1 100644 --- a/hyperjaxb/ejb/tests/pom.xml +++ b/hyperjaxb/ejb/tests/pom.xml @@ -228,8 +228,8 @@ ${slf4j.version} - junit - junit + org.junit.jupiter + junit-jupiter-engine compile diff --git a/hyperjaxb/ejb/tests/st/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/st/HJIII11IssueTest.java b/hyperjaxb/ejb/tests/st/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/st/HJIII11IssueTest.java index cc35526aa..2cb328f63 100644 --- a/hyperjaxb/ejb/tests/st/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/st/HJIII11IssueTest.java +++ b/hyperjaxb/ejb/tests/st/src/test/java/org/jvnet/hyperjaxb3/ejb/tests/st/HJIII11IssueTest.java @@ -1,34 +1,33 @@ package org.jvnet.hyperjaxb3.ejb.tests.st; import jakarta.persistence.Column; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import junit.framework.AssertionFailedError; -import junit.framework.TestCase; - -public class HJIII11IssueTest extends TestCase { +public class HJIII11IssueTest { + @Test public void testSimpleTypes() { final Class theClass = Root123456789012345678901234567890Type.class; - assertEquals(400, getColumn(theClass, "getLargeMinLength").length()); - assertEquals(4000, getColumn(theClass, "getLargeMaxLength").length()); - assertEquals(255, getColumn(theClass, "getMinLength").length()); - assertEquals(10, getColumn(theClass, "getMaxLength").length()); - assertEquals(8, getColumn(theClass, "getLength").length()); - assertEquals(5, getColumn(theClass, "getDigits").precision()); - assertEquals(2, getColumn(theClass, "getDigits").scale()); - assertEquals(20, getColumn(theClass, "getTotalDigits").precision()); - assertEquals(10, getColumn(theClass, "getTotalDigits").scale()); - assertEquals(20, getColumn(theClass, "getFractionDigits").precision()); - assertEquals(2, getColumn(theClass, "getFractionDigits").scale()); + Assertions.assertEquals(400, getColumn(theClass, "getLargeMinLength").length()); + Assertions.assertEquals(4000, getColumn(theClass, "getLargeMaxLength").length()); + Assertions.assertEquals(255, getColumn(theClass, "getMinLength").length()); + Assertions.assertEquals(10, getColumn(theClass, "getMaxLength").length()); + Assertions.assertEquals(8, getColumn(theClass, "getLength").length()); + Assertions.assertEquals(5, getColumn(theClass, "getDigits").precision()); + Assertions.assertEquals(2, getColumn(theClass, "getDigits").scale()); + Assertions.assertEquals(20, getColumn(theClass, "getTotalDigits").precision()); + Assertions.assertEquals(10, getColumn(theClass, "getTotalDigits").scale()); + Assertions.assertEquals(20, getColumn(theClass, "getFractionDigits").precision()); + Assertions.assertEquals(2, getColumn(theClass, "getFractionDigits").scale()); } private Column getColumn(final Class theClass, final String name) { try { - return theClass.getMethod(name, new Class[0]).getAnnotation( - Column.class); + return theClass.getMethod(name, new Class[0]).getAnnotation(Column.class); } catch (NoSuchMethodException nsmex) { - throw new AssertionFailedError(nsmex.getMessage()); + return Assertions.fail(nsmex.getMessage()); } } diff --git a/hyperjaxb/ejb/tutorials/po/step-one/pom.xml b/hyperjaxb/ejb/tutorials/po/step-one/pom.xml index a14dea0c3..f0659b4c5 100644 --- a/hyperjaxb/ejb/tutorials/po/step-one/pom.xml +++ b/hyperjaxb/ejb/tutorials/po/step-one/pom.xml @@ -29,8 +29,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine diff --git a/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/HsqlBigDecimalTest.java b/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/HsqlBigDecimalTest.java index 159f666a4..da62fc0ef 100644 --- a/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/HsqlBigDecimalTest.java +++ b/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/HsqlBigDecimalTest.java @@ -1,5 +1,8 @@ package org.jvnet.hyperjaxb3.ejb.tutorials.po.stepone; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + import java.math.BigDecimal; import java.sql.Connection; import java.sql.DriverManager; @@ -7,9 +10,6 @@ import java.sql.ResultSet; import java.sql.Statement; -import org.junit.Assert; -import org.junit.Test; - public class HsqlBigDecimalTest { @Test @@ -32,8 +32,8 @@ public void test() throws Exception { ResultSet rs = stmt.executeQuery("SELECT * FROM test"); while (rs.next()) { BigDecimal result = rs.getBigDecimal(1); - Assert.assertTrue(BigDecimal.ONE.compareTo(result) == 0); - Assert.assertEquals(BigDecimal.ONE, result.setScale(0)); + Assertions.assertTrue(BigDecimal.ONE.compareTo(result) == 0); + Assertions.assertEquals(BigDecimal.ONE, result.setScale(0)); } rs.close(); diff --git a/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JAXBAndJPATest.java b/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JAXBAndJPATest.java index c303a3edf..fb91e43aa 100644 --- a/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JAXBAndJPATest.java +++ b/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JAXBAndJPATest.java @@ -16,13 +16,12 @@ import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Marshaller; import jakarta.xml.bind.Unmarshaller; -import javax.xml.transform.dom.DOMResult; - -import junit.framework.TestCase; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.ExtendedJAXBEqualsStrategy; -public class JAXBAndJPATest extends TestCase { +public class JAXBAndJPATest { private ObjectFactory objectFactory; @@ -30,6 +29,7 @@ public class JAXBAndJPATest extends TestCase { private JAXBContext context; + @BeforeEach public void setUp() throws Exception { objectFactory = new ObjectFactory(); @@ -56,7 +56,7 @@ public void setUp() throws Exception { context = JAXBContext.newInstance("generated"); } - @SuppressWarnings("unchecked") + @Test public void testRoundtrip() throws JAXBException { final Unmarshaller unmarshaller = context.createUnmarshaller(); @@ -79,7 +79,9 @@ public void testRoundtrip() throws JAXBException { final PurchaseOrderType beta = loadManager.find( PurchaseOrderType.class, id); // Using not default equals strategy since BigDecimal has errors in equals strict equality - Assert.assertTrue("Objects are not equal.", alpha.equals(null, null, beta, ExtendedJAXBEqualsStrategy.INSTANCE)); + Assertions.assertTrue( + alpha.equals(null, null, beta, ExtendedJAXBEqualsStrategy.INSTANCE), + "Objects are not equal."); final Marshaller marshaller = context.createMarshaller(); marshaller.marshal(objectFactory.createPurchaseOrder(beta), System.out); diff --git a/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JAXBTest.java b/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JAXBTest.java index 79fa43c40..b8157b1dc 100644 --- a/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JAXBTest.java +++ b/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JAXBTest.java @@ -7,6 +7,9 @@ import java.util.LinkedList; import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.jvnet.hyperjaxb3.xml.XMLConstants; import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; @@ -22,32 +25,31 @@ import javax.xml.xpath.XPathException; import javax.xml.xpath.XPathFactory; -import junit.framework.TestCase; - import org.xml.sax.SAXException; -public class JAXBTest extends TestCase { +public class JAXBTest { private JAXBContext context; private ObjectFactory objectFactory; + @BeforeEach protected void setUp() throws Exception { context = JAXBContext.newInstance("generated"); objectFactory = new ObjectFactory(); } + @Test public void testUnmarshall() throws JAXBException { final Unmarshaller unmarshaller = context.createUnmarshaller(); final Object object = unmarshaller.unmarshal(new File( "src/test/samples/po.xml")); @SuppressWarnings("unchecked") - final PurchaseOrderType purchaseOrder = ((JAXBElement) object) - .getValue(); - assertEquals("Wrong city", "Mill Valley", purchaseOrder.getShipTo() - .getCity()); + final PurchaseOrderType purchaseOrder = ((JAXBElement) object).getValue(); + Assertions.assertEquals("Mill Valley", purchaseOrder.getShipTo().getCity(), "Wrong city"); } + @Test public void testMarshal() throws JAXBException, XPathException { final PurchaseOrderType purchaseOrder = objectFactory .createPurchaseOrderType(); @@ -63,10 +65,12 @@ public void testMarshal() throws JAXBException, XPathException { final XPathFactory xPathFactory = XPathFactory.newInstance(); - assertEquals("Wrong city", "New Orleans", xPathFactory.newXPath() - .evaluate("/purchaseOrder/shipTo/city", result.getNode())); + Assertions.assertEquals("New Orleans", xPathFactory.newXPath() + .evaluate("/purchaseOrder/shipTo/city", result.getNode()), + "Wrong city"); } + @Test public void testValidate() throws SAXException, JAXBException { final PurchaseOrderType purchaseOrder = objectFactory @@ -95,9 +99,8 @@ public boolean handleEvent(ValidationEvent event) { }); marshaller.marshal(purchaseOrderElement, new DOMResult()); - assertFalse("List of validation events must not be empty.", events - .isEmpty()); - + Assertions.assertFalse(events.isEmpty(), "List of validation events must not be empty."); + System.out.println(events.get(0)); } } diff --git a/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JPATest.java b/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JPATest.java index 71d2320bc..2a01dc5eb 100644 --- a/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JPATest.java +++ b/hyperjaxb/ejb/tutorials/po/step-one/src/test/java/org/jvnet/hyperjaxb3/ejb/tutorials/po/stepone/JPATest.java @@ -10,15 +10,17 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManagerFactory; import jakarta.persistence.Persistence; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import junit.framework.TestCase; - -public class JPATest extends TestCase { +public class JPATest { private ObjectFactory objectFactory; private EntityManagerFactory entityManagerFactory; + @BeforeEach public void setUp() throws Exception { objectFactory = new ObjectFactory(); @@ -43,6 +45,7 @@ public void setUp() throws Exception { "generated", persistenceProperties); } + @Test public void testSaveAndLoad() { final PurchaseOrderType alpha = objectFactory.createPurchaseOrderType(); alpha.setShipTo(objectFactory.createUSAddress()); @@ -63,7 +66,7 @@ public void testSaveAndLoad() { PurchaseOrderType.class, id); loadManager.close(); // Check that we're still shipping to Sacramento - assertEquals("Sacramento", beta.getShipTo().getCity()); + Assertions.assertEquals("Sacramento", beta.getShipTo().getCity()); } diff --git a/hyperjaxb/ejb/tutorials/po/step-three/pom.xml b/hyperjaxb/ejb/tutorials/po/step-three/pom.xml index 24d0c6042..84882dbbb 100644 --- a/hyperjaxb/ejb/tutorials/po/step-three/pom.xml +++ b/hyperjaxb/ejb/tutorials/po/step-three/pom.xml @@ -28,8 +28,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine diff --git a/hyperjaxb/ejb/tutorials/po/step-two/pom.xml b/hyperjaxb/ejb/tutorials/po/step-two/pom.xml index 4c619544e..bccc5cead 100644 --- a/hyperjaxb/ejb/tutorials/po/step-two/pom.xml +++ b/hyperjaxb/ejb/tutorials/po/step-two/pom.xml @@ -28,8 +28,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine diff --git a/hyperjaxb/maven/plugin/src/test/java/org/jvnet/hyperjaxb3/maven/tests/Hyperjaxb3MojoTest.java b/hyperjaxb/maven/plugin/src/test/java/org/jvnet/hyperjaxb3/maven/tests/Hyperjaxb3MojoTest.java index b898426a8..47877479e 100644 --- a/hyperjaxb/maven/plugin/src/test/java/org/jvnet/hyperjaxb3/maven/tests/Hyperjaxb3MojoTest.java +++ b/hyperjaxb/maven/plugin/src/test/java/org/jvnet/hyperjaxb3/maven/tests/Hyperjaxb3MojoTest.java @@ -1,4 +1,4 @@ -package org.jvnet.hyperjaxb3.maven2.tests; +package org.jvnet.hyperjaxb3.maven.tests; import java.io.File; diff --git a/hyperjaxb/maven/testing/pom.xml b/hyperjaxb/maven/testing/pom.xml index 1c1344eff..d9cb40f19 100644 --- a/hyperjaxb/maven/testing/pom.xml +++ b/hyperjaxb/maven/testing/pom.xml @@ -12,8 +12,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine compile diff --git a/hyperjaxb/misc/jdo/roundtrip/pom.xml b/hyperjaxb/misc/jdo/roundtrip/pom.xml index b9dc495a4..7cbb753c5 100644 --- a/hyperjaxb/misc/jdo/roundtrip/pom.xml +++ b/hyperjaxb/misc/jdo/roundtrip/pom.xml @@ -12,9 +12,8 @@ - junit - junit - 3.8.1 + org.junit.jupiter + junit-jupiter-engine javax.jdo diff --git a/hyperjaxb/misc/jdo/sample-hotel/pom.xml b/hyperjaxb/misc/jdo/sample-hotel/pom.xml index 51e6a4226..31c859f78 100644 --- a/hyperjaxb/misc/jdo/sample-hotel/pom.xml +++ b/hyperjaxb/misc/jdo/sample-hotel/pom.xml @@ -9,9 +9,8 @@ Hyperjaxb3 JDO Sample Hotel - junit - junit - 3.8.1 + org.junit.jupiter + junit-jupiter-engine javax.jdo diff --git a/hyperjaxb/pom.xml b/hyperjaxb/pom.xml index 0df6359e7..b6c4b5ed2 100644 --- a/hyperjaxb/pom.xml +++ b/hyperjaxb/pom.xml @@ -31,8 +31,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine test diff --git a/jaxb-annotate-parent/samples/annotate/pom.xml b/jaxb-annotate-parent/samples/annotate/pom.xml index 39254e72a..fd0584553 100644 --- a/jaxb-annotate-parent/samples/annotate/pom.xml +++ b/jaxb-annotate-parent/samples/annotate/pom.xml @@ -67,8 +67,8 @@ hibernate-search - junit - junit + org.junit.jupiter + junit-jupiter-engine diff --git a/jaxb-annotate-parent/samples/annotate/project-build.xml b/jaxb-annotate-parent/samples/annotate/project-build.xml index 027612ae2..938d113b0 100644 --- a/jaxb-annotate-parent/samples/annotate/project-build.xml +++ b/jaxb-annotate-parent/samples/annotate/project-build.xml @@ -164,17 +164,16 @@ - + - - - - + + + @@ -183,8 +182,8 @@ - - + + diff --git a/jaxb-annotate-parent/tests/annotate/src/test/java/org/jvnet/jaxb/tests/annotate/IssueJAP9TypeTest.java b/jaxb-annotate-parent/tests/annotate/src/test/java/org/jvnet/jaxb/tests/annotate/IssueJAP9TypeTest.java index 0e14212f1..5e580b817 100644 --- a/jaxb-annotate-parent/tests/annotate/src/test/java/org/jvnet/jaxb/tests/annotate/IssueJAP9TypeTest.java +++ b/jaxb-annotate-parent/tests/annotate/src/test/java/org/jvnet/jaxb/tests/annotate/IssueJAP9TypeTest.java @@ -1,10 +1,11 @@ package org.jvnet.jaxb.tests.annotate; import generated.IssueJAP9Type; -import org.junit.Assert; -import org.junit.Test; import jakarta.xml.bind.annotation.XmlMimeType; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + import java.lang.reflect.Field; public class IssueJAP9TypeTest { @@ -15,7 +16,7 @@ public void testIssueJAP9TypeAField() throws NoSuchFieldException { IssueJAP9Type type = new IssueJAP9Type(); Field[] fields = type.getClass().getDeclaredFields(); XmlMimeType ann = type.getClass().getDeclaredField("a").getAnnotation(XmlMimeType.class); - Assert.assertEquals(valueInXsd, ann.value()); + Assertions.assertEquals(valueInXsd, ann.value()); } @Test @@ -23,7 +24,7 @@ public void testIssueJAP9TypeBField() throws NoSuchFieldException { String valueInXsd = "[0-9]+\\\\.[0-9]{1,2}\\\\.[0-9]{4}\\\\.[0-9]+"; IssueJAP9Type type = new IssueJAP9Type(); XmlMimeType ann = type.getClass().getDeclaredField("b").getAnnotation(XmlMimeType.class); - Assert.assertEquals(valueInXsd, ann.value()); + Assertions.assertEquals(valueInXsd, ann.value()); } @Test @@ -31,6 +32,6 @@ public void testIssueJAP9TypeCField() throws NoSuchFieldException { String valueInXsd = "NoEscapedBackSlashes\"/Here"; IssueJAP9Type type = new IssueJAP9Type(); XmlMimeType ann = type.getClass().getDeclaredField("c").getAnnotation(XmlMimeType.class); - Assert.assertEquals(valueInXsd, ann.value()); + Assertions.assertEquals(valueInXsd, ann.value()); } } diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/Gh26Test.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/Gh26Test.java index 1a1559be4..dc1ba4ad2 100644 --- a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/Gh26Test.java +++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/Gh26Test.java @@ -28,15 +28,12 @@ */ package org.jvnet.jaxb.tests.issues; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; - import java.lang.reflect.Field; import jakarta.xml.bind.annotation.XmlElement; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class Gh26Test { @@ -44,6 +41,6 @@ public class Gh26Test { public void fiedlYIsNotAnnotated() throws Exception { Field yField = Gh26Type.class.getDeclaredField("y"); - assertThat(yField.getAnnotation(XmlElement.class), is(nullValue())); + Assertions.assertNull(yField.getAnnotation(XmlElement.class)); } } diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/Gh36Test.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/Gh36Test.java index 9af5560b0..7f903f59f 100644 --- a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/Gh36Test.java +++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/Gh36Test.java @@ -31,13 +31,12 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; import java.lang.reflect.Method; -import org.junit.Test; - import com.fasterxml.jackson.annotation.JsonView; +import org.hamcrest.MatcherAssert; +import org.junit.jupiter.api.Test; public class Gh36Test { @@ -47,7 +46,7 @@ public void getAttrMethodIsCorrectlyAnnotated() throws Exception { Method getAttrMethod = Gh36Type.class.getDeclaredMethod("getAttr"); JsonView actualAnnotation = getAttrMethod.getAnnotation(JsonView.class); - assertThat(actualAnnotation, is(notNullValue())); - assertThat(actualAnnotation.value(), is(equalTo(new Class[]{Object.class}))); + MatcherAssert.assertThat(actualAnnotation, is(notNullValue())); + MatcherAssert.assertThat(actualAnnotation.value(), is(equalTo(new Class[]{Object.class}))); } } diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/_enum/annotateEnumFromValueMethod/IssueGH11AnnotateEnumFromValueMethodTypeTest.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/_enum/annotateEnumFromValueMethod/IssueGH11AnnotateEnumFromValueMethodTypeTest.java index 1477a9bee..d607804b6 100644 --- a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/_enum/annotateEnumFromValueMethod/IssueGH11AnnotateEnumFromValueMethodTypeTest.java +++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/_enum/annotateEnumFromValueMethod/IssueGH11AnnotateEnumFromValueMethodTypeTest.java @@ -28,14 +28,10 @@ */ package org.jvnet.jaxb.tests.issues._enum.annotateEnumFromValueMethod; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; - import java.lang.reflect.Method; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.plugin.annotate.tests.annotations.Marked; public class IssueGH11AnnotateEnumFromValueMethodTypeTest { @@ -47,7 +43,7 @@ public void fromValueMethodShouldBeAnnotated() throws Exception { Method fromValueMethod = IssueGH11AnnotateEnumFromValueMethodType.class.getDeclaredMethod("fromValue", String.class); Marked actualAnnotation = fromValueMethod.getAnnotation(Marked.class); - assertThat(actualAnnotation, is(notNullValue())); - assertThat(actualAnnotation.value(), is(equalTo(expectedValue))); + Assertions.assertNotNull(actualAnnotation); + Assertions.assertEquals(expectedValue, actualAnnotation.value()); } } diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/_enum/annotateEnumValueMethod/IssueGH11AnnotateEnumValueMethodTypeTest.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/_enum/annotateEnumValueMethod/IssueGH11AnnotateEnumValueMethodTypeTest.java index fe3919ae8..91c45a225 100644 --- a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/_enum/annotateEnumValueMethod/IssueGH11AnnotateEnumValueMethodTypeTest.java +++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/_enum/annotateEnumValueMethod/IssueGH11AnnotateEnumValueMethodTypeTest.java @@ -28,14 +28,10 @@ */ package org.jvnet.jaxb.tests.issues._enum.annotateEnumValueMethod; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; - import java.lang.reflect.Method; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.plugin.annotate.tests.annotations.Marked; public class IssueGH11AnnotateEnumValueMethodTypeTest { @@ -47,7 +43,7 @@ public void valueMethodShouldBeAnnotated() throws Exception { Method valueMethod = IssueGH11AnnotateEnumValueMethodType.class.getDeclaredMethod("value"); Marked actualAnnotation = valueMethod.getAnnotation(Marked.class); - assertThat(actualAnnotation, is(notNullValue())); - assertThat(actualAnnotation.value(), is(equalTo(expectedValue))); + Assertions.assertNotNull(actualAnnotation); + Assertions.assertEquals(expectedValue, actualAnnotation.value()); } } diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/tests/Issue1Test.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/tests/Issue1Test.java index 930962541..e099ea910 100644 --- a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/tests/Issue1Test.java +++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/tests/Issue1Test.java @@ -31,8 +31,8 @@ import jakarta.xml.bind.annotation.XmlNsForm; import jakarta.xml.bind.annotation.XmlSchema; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.tests.issues.ObjectFactory; public class Issue1Test { @@ -41,7 +41,7 @@ public class Issue1Test { public void testPackageInfoIsAnnotated() { final XmlSchema xmlSchema = ObjectFactory.class.getPackage() .getAnnotation(XmlSchema.class); - Assert.assertEquals(XmlNsForm.QUALIFIED, xmlSchema.elementFormDefault()); + Assertions.assertEquals(XmlNsForm.QUALIFIED, xmlSchema.elementFormDefault()); } } diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/tests/RunPlugins.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/tests/RunPlugins.java index aebac070f..df0656e2b 100644 --- a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/tests/RunPlugins.java +++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/tests/RunPlugins.java @@ -30,18 +30,17 @@ import java.io.File; -import org.junit.Before; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RunPlugins { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } diff --git a/jaxb-annotate-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/JavaTypeExampleTest.java b/jaxb-annotate-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/JavaTypeExampleTest.java index d8d0c48ca..c5cf05322 100644 --- a/jaxb-annotate-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/JavaTypeExampleTest.java +++ b/jaxb-annotate-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/JavaTypeExampleTest.java @@ -33,10 +33,10 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; -import javax.xml.namespace.QName; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import org.junit.Assert; -import org.junit.Test; +import javax.xml.namespace.QName; public class JavaTypeExampleTest { @@ -51,7 +51,7 @@ public void rountripsBoolean() throws JAXBException { context.createMarshaller().marshal( new JAXBElement(new QName("test"), JavaTypeExample.class, value), sw); - Assert.assertTrue(sw.toString().contains(">true<")); + Assertions.assertTrue(sw.toString().contains(">true<")); // System.out.println(sw.toString()); } } diff --git a/jaxb-annotate-parent/tests/removexmlannotate/src/test/java/org/jvnet/jaxb/tests/annotate/IssueJAP9TypeTest.java b/jaxb-annotate-parent/tests/removexmlannotate/src/test/java/org/jvnet/jaxb/tests/annotate/IssueJAP9TypeTest.java index 683f1330c..dd766c326 100644 --- a/jaxb-annotate-parent/tests/removexmlannotate/src/test/java/org/jvnet/jaxb/tests/annotate/IssueJAP9TypeTest.java +++ b/jaxb-annotate-parent/tests/removexmlannotate/src/test/java/org/jvnet/jaxb/tests/annotate/IssueJAP9TypeTest.java @@ -2,11 +2,8 @@ import generated.IssueJAP9Type; import jakarta.xml.bind.annotation.XmlElement; -import org.junit.Assert; -import org.junit.Test; - -import jakarta.xml.bind.annotation.XmlMimeType; -import java.lang.reflect.Field; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class IssueJAP9TypeTest { @@ -14,6 +11,6 @@ public class IssueJAP9TypeTest { public void testIssueJAP9TypeAField() throws NoSuchFieldException { IssueJAP9Type type = new IssueJAP9Type(); XmlElement ann = type.getClass().getDeclaredField("a").getAnnotation(XmlElement.class); - Assert.assertNull(ann); + Assertions.assertNull(ann); } } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/demos/guide/tests/DemoClassTest.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/demos/guide/tests/DemoClassTest.java index 80589c278..d5f8b63e4 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/demos/guide/tests/DemoClassTest.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/demos/guide/tests/DemoClassTest.java @@ -2,37 +2,38 @@ import java.lang.reflect.AnnotatedElement; -import junit.framework.TestCase; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.demos.guide.Comment; import org.jvnet.jaxb.annox.demos.guide.DemoClass; import org.jvnet.jaxb.annox.reflect.AnnotatedElementFactory; import org.jvnet.jaxb.annox.reflect.DualAnnotatedElementFactory; import org.jvnet.jaxb.annox.reflect.ParameterizedAnnotatedElement; -public class DemoClassTest extends TestCase { +public class DemoClassTest { + @Test public void testDemoClassAnnotations() throws Exception { final AnnotatedElementFactory aef = new DualAnnotatedElementFactory(); final AnnotatedElement demoClass = aef .getAnnotatedElement(DemoClass.class); - assertNotNull(demoClass.getAnnotation(Comment.class).value()); + Assertions.assertNotNull(demoClass.getAnnotation(Comment.class).value()); final AnnotatedElement valueField = aef .getAnnotatedElement(DemoClass.class.getDeclaredField("value")); - assertNotNull(valueField.getAnnotation(Comment.class).value()); + Assertions.assertNotNull(valueField.getAnnotation(Comment.class).value()); final AnnotatedElement defaultConstructor = aef .getAnnotatedElement(DemoClass.class.getConstructor()); - assertNotNull(defaultConstructor.getAnnotation(Comment.class).value()); + Assertions.assertNotNull(defaultConstructor.getAnnotation(Comment.class).value()); final ParameterizedAnnotatedElement secondConstructor = aef .getAnnotatedElement(DemoClass.class.getConstructor(int.class)); - assertNotNull(secondConstructor.getAnnotation(Comment.class).value()); - String t = ((Comment)secondConstructor.getParameterAnnotations()[0][0]).value(); - assertNotNull(t); + Assertions.assertNotNull(secondConstructor.getAnnotation(Comment.class).value()); + String t = ((Comment) secondConstructor.getParameterAnnotations()[0][0]).value(); + Assertions.assertNotNull(t); } } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/demos/guide/tests/MyClassTest.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/demos/guide/tests/MyClassTest.java index 40fc0f885..cfc5e3e5e 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/demos/guide/tests/MyClassTest.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/demos/guide/tests/MyClassTest.java @@ -2,25 +2,27 @@ import java.lang.reflect.AnnotatedElement; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.demos.guide.MyAnnotation; import org.jvnet.jaxb.annox.demos.guide.MyClass; import org.jvnet.jaxb.annox.reflect.AnnotatedElementFactory; import org.jvnet.jaxb.annox.reflect.DualAnnotatedElementFactory; -import junit.framework.TestCase; - -public class MyClassTest extends TestCase { +public class MyClassTest { + @Test public void testNormal() throws Exception { final AnnotatedElement myClass = MyClass.class; final AnnotatedElement myField = MyClass.class.getDeclaredField("myField"); final MyAnnotation myClassAnnotation = myClass.getAnnotation(MyAnnotation.class); final MyAnnotation myFieldAnnotation = myField.getAnnotation(MyAnnotation.class); - assertEquals("My class", myClassAnnotation.printName()); - assertEquals("My field", myFieldAnnotation.printName()); + Assertions.assertEquals("My class", myClassAnnotation.printName()); + Assertions.assertEquals("My field", myFieldAnnotation.printName()); } + @Test public void testAnnox() throws Exception { final AnnotatedElementFactory aef = new DualAnnotatedElementFactory(); @@ -30,8 +32,8 @@ public void testAnnox() throws Exception { final MyAnnotation myClassAnnotation = myClass.getAnnotation(MyAnnotation.class); final MyAnnotation myFieldAnnotation = myField.getAnnotation(MyAnnotation.class); - assertEquals("My annotated class", myClassAnnotation.printName()); - assertEquals("My annotated field", myFieldAnnotation.printName()); + Assertions.assertEquals("My annotated class", myClassAnnotation.printName()); + Assertions.assertEquals("My annotated field", myFieldAnnotation.printName()); } } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/model/test/AnnotationWithIntegerFieldTest.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/model/test/AnnotationWithIntegerFieldTest.java index d2849125d..4621763e5 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/model/test/AnnotationWithIntegerFieldTest.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/model/test/AnnotationWithIntegerFieldTest.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.annox.model.test; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.model.XAnnotation; import org.jvnet.jaxb.annox.model.annotation.field.XAnnotationField; import org.jvnet.jaxb.annox.parser.XGenericFieldParser; @@ -24,7 +24,7 @@ public void test() { AnnotationWithIntegerField.class, integerField, integerFields); AnnotationWithIntegerField result = annotation.getResult(); - Assert.assertEquals(42, result.integerField()); - Assert.assertArrayEquals(new int[] { 37, 73 }, result.integerFields()); + Assertions.assertEquals(42, result.integerField()); + Assertions.assertArrayEquals(new int[] { 37, 73 }, result.integerFields()); } } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/JAXBDemoTest.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/JAXBDemoTest.java index 9746f04ca..557145e75 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/JAXBDemoTest.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/JAXBDemoTest.java @@ -2,15 +2,16 @@ import jakarta.xml.bind.annotation.XmlRootElement; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.model.XAnnotation; import org.jvnet.jaxb.annox.parser.XAnnotationParser; import org.jvnet.jaxb.annox.parser.exception.AnnotationExpressionParseException; import org.jvnet.jaxb.annox.parser.exception.AnnotationStringParseException; -import junit.framework.TestCase; - -public class JAXBDemoTest extends TestCase { +public class JAXBDemoTest { + @Test public void testXMLRootElement() throws AnnotationStringParseException, AnnotationExpressionParseException { @SuppressWarnings("unchecked") @@ -22,11 +23,11 @@ public void testXMLRootElement() throws AnnotationStringParseException, // Create an instance of the annotation XmlRootElement xmlRootElement = xannotation.getResult(); - assertEquals("foo", xmlRootElement.name()); - assertEquals("##default", xmlRootElement.namespace()); + Assertions.assertEquals("foo", xmlRootElement.name()); + Assertions.assertEquals("##default", xmlRootElement.namespace()); // Analyze the structure of the annotation - assertEquals(String.class, xannotation.getFieldsMap().get("name").getType()); - assertEquals("##default", xannotation.getFieldsMap().get("namespace").getResult()); + Assertions.assertEquals(String.class, xannotation.getFieldsMap().get("name").getType()); + Assertions.assertEquals("##default", xannotation.getFieldsMap().get("namespace").getResult()); } } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/JavaTypeParserTest.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/JavaTypeParserTest.java index defb9ad5f..31ce9ef2b 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/JavaTypeParserTest.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/JavaTypeParserTest.java @@ -4,14 +4,15 @@ import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.javaparser.AnnotationExprParser; import org.jvnet.jaxb.annox.model.XAnnotation; import org.jvnet.jaxb.annox.parser.XAnnotationParser; -import junit.framework.TestCase; - -public class JavaTypeParserTest extends TestCase { +public class JavaTypeParserTest { + @Test public void testParse() throws Exception { final String text = "@org.jvnet.jaxb.annox.parser.tests.A(" @@ -44,13 +45,13 @@ public void testParse() throws Exception { List annotations = parser.parse(text); - assertEquals(1, annotations.size()); + Assertions.assertEquals(1, annotations.size()); final AnnotationExpr annotationExpr = annotations.get(0); final XAnnotationParser xAnnotationParser = new XAnnotationParser(); XAnnotation xannotation = xAnnotationParser.parse(annotationExpr); - assertNotNull(xannotation); + Assertions.assertNotNull(xannotation); } } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/XAnnotationParserAnnotationExprTest.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/XAnnotationParserAnnotationExprTest.java index b44e08eda..5a4b53bf4 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/XAnnotationParserAnnotationExprTest.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/XAnnotationParserAnnotationExprTest.java @@ -7,16 +7,15 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import junit.framework.TestCase; - import org.apache.commons.io.IOUtils; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.model.XAnnotation; import org.jvnet.jaxb.annox.parser.XAnnotationParser; import org.w3c.dom.Document; import org.w3c.dom.Element; -public class XAnnotationParserAnnotationExprTest extends TestCase { +public class XAnnotationParserAnnotationExprTest { public Element getElement(final String resourceName) throws Exception { InputStream is = null; @@ -66,60 +65,66 @@ public void check(String javaResourceName, String xmlResourceName, System.out.println(one.toString()); System.out.println(two.toString()); System.out.println(three.toString()); - Assert.assertEquals("Annotations should be identical.", one, two); - Assert.assertEquals("Annotations should be identical.", two, three); - Assert.assertEquals("Annotations should be identical.", - one.getResult(), two.getResult()); - Assert.assertEquals("Annotations should be identical.", - two.getResult(), three.getResult()); - Assert.assertEquals("Annotations should be identical.", annotation, - one.getResult()); - Assert.assertEquals("Annotations should be identical.", annotation, - two.getResult()); - Assert.assertEquals("Annotations should be identical.", annotation, - three.getResult()); + Assertions.assertEquals(one, two, "Annotations should be identical."); + Assertions.assertEquals(two, three, "Annotations should be identical."); + Assertions.assertEquals(one.getResult(), two.getResult(), "Annotations should be identical."); + Assertions.assertEquals(two.getResult(), three.getResult(), "Annotations should be identical."); + Assertions.assertEquals(annotation, one.getResult(), "Annotations should be identical."); + Assertions.assertEquals(annotation, two.getResult(), "Annotations should be identical."); + Assertions.assertEquals(annotation, three.getResult(), "Annotations should be identical."); } + @Test public void testOne() throws Exception { check("one.txt", "one.xml", One.class, A.class); } + @Test public void testTwo() throws Exception { check("two.txt", "two.xml", Two.class, A.class); } + @Test public void testThree() throws Exception { check("three.txt", "three.xml", Three.class, D.class); } + @Test public void testFive() throws Exception { check("five.txt", "five.xml", Five.class, F.class); } + @Test public void testSix() throws Exception { check("six.txt", "six.xml", Six.class, G.class); } + @Test public void testSeven() throws Exception { check("seven.txt", "seven.xml", Seven.class, J.class); } + @Test public void testEight() throws Exception { check("eight.txt", "eight.xml", Eight.class, K.class); } + @Test public void testNine() throws Exception { check("nine.txt", "nine.xml", Nine.class, L.class); } + @Test public void testTen() throws Exception { check("ten.txt", "ten.xml", Ten.class, M.class); } + @Test public void testEleven() throws Exception { check("eleven.txt", "eleven.xml", Eleven.class, H.class); } + @Test public void testTwelve() throws Exception { check("twelve.txt", "twelve.xml", Twelve.class, B.class); } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/XAnnotationParserTest.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/XAnnotationParserTest.java index 0a017acd1..41a604d46 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/XAnnotationParserTest.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/XAnnotationParserTest.java @@ -7,9 +7,8 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import junit.framework.TestCase; - -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.model.XAnnotation; import org.jvnet.jaxb.annox.model.annotation.field.XSingleAnnotationField; import org.jvnet.jaxb.annox.model.annotation.value.XStringAnnotationValue; @@ -17,7 +16,7 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; -public class XAnnotationParserTest extends TestCase { +public class XAnnotationParserTest { public Element getElement(final String resourceName) throws Exception { InputStream is = null; @@ -42,6 +41,7 @@ public Element getElement(final String resourceName) throws Exception { } + @Test public void testA() throws Exception { XAnnotationParser parser = new XAnnotationParser(); @@ -55,7 +55,7 @@ public void testA() throws Exception { final String zeroToString = zeroResult.toString(); final XAnnotation two = parser.parse(zeroResult); System.out.println(two.toString()); - Assert.assertEquals("Annotations should be identical.", one, two); + Assertions.assertEquals(one, two, "Annotations should be identical."); final Annotation oneResult = one.getResult(); final int oneHashCode = oneResult.hashCode(); final String oneToString = oneResult.toString(); @@ -66,21 +66,21 @@ public void testA() throws Exception { System.out.println(three.toString()); final XAnnotation four = parser.parse(twoResult); System.out.println(four.toString()); - Assert.assertEquals("Annotations should be identical.", three, four); + Assertions.assertEquals(three, four, "Annotations should be identical."); // Following line failes on JDK11+ since toString representation changed - // Assert.assertEquals("Annotation toStrings must have the same length", + // Assertions.assertEquals("Annotation toStrings must have the same length", // zeroToString.length(), oneToString.length()); - Assert.assertEquals("Annotation toStrings must have the same length", - oneToString.length(), twoToString.length()); - Assert.assertEquals("Annotation hashCodes should be identical.", - zeroHashCode, oneHashCode); - Assert.assertEquals("Annotation hashCodes should be identical.", - oneHashCode, twoHashCode); - Assert.assertEquals("Annotation should be equal.", zeroResult, - oneResult); - Assert.assertEquals("Annotation should be equal.", oneResult, twoResult); + Assertions.assertEquals(oneToString.length(), twoToString.length(), + "Annotation toStrings must have the same length"); + Assertions.assertEquals(zeroHashCode, oneHashCode, + "Annotation hashCodes should be identical."); + Assertions.assertEquals(oneHashCode, twoHashCode, + "Annotation hashCodes should be identical."); + Assertions.assertEquals(zeroResult, oneResult, "Annotation should be equal."); + Assertions.assertEquals(oneResult, twoResult, "Annotation should be equal."); } + @Test public void testD() throws Exception { XAnnotationParser parser = XAnnotationParser.INSTANCE; @@ -92,25 +92,27 @@ public void testD() throws Exception { final XAnnotation two = parser.parse(Three.class .getAnnotation(D.class)); System.out.println(two.toString()); - Assert.assertEquals("Annotations should be identical.", one, two); + Assertions.assertEquals(one, two, "Annotations should be identical."); final Annotation oneResult = one.getResult(); final Annotation twoResult = two.getResult(); final XAnnotation three = parser.parse(oneResult); System.out.println(three.toString()); final XAnnotation four = parser.parse(twoResult); System.out.println(four.toString()); - Assert.assertEquals("Annotations should be identical.", three, four); + Assertions.assertEquals(three, four, "Annotations should be identical."); } + @Test public void testEquals() throws Exception { final Annotation one = One.class.getAnnotation(A.class); final Annotation two = Two.class.getAnnotation(A.class); System.out.println(one.toString()); System.out.println(two.toString()); - Assert.assertEquals("Annotations should be identical.", one, two); + Assertions.assertEquals(one, two, "Annotations should be identical."); } + @Test public void testF() throws Exception { final XAnnotationParser parser = XAnnotationParser.INSTANCE; @@ -124,10 +126,11 @@ public void testF() throws Exception { System.out.println(one.toString()); System.out.println(two.toString()); - Assert.assertEquals("Annotations should be identical.", one, two); + Assertions.assertEquals(one, two, "Annotations should be identical."); } + @Test public void testG() throws Exception { final XAnnotationParser parser = XAnnotationParser.INSTANCE; @@ -139,10 +142,11 @@ public void testG() throws Exception { System.out.println(one.toString()); System.out.println(two.toString()); - Assert.assertEquals("Annotations should be identical.", one, two); + Assertions.assertEquals(one, two, "Annotations should be identical."); } + @Test public void testField() throws Exception { final XAnnotationParser parser = XAnnotationParser.INSTANCE; @@ -150,12 +154,14 @@ public void testField() throws Exception { final Element element = getElement("field.xml"); final XAnnotation zero = parser.parse(element); - Assert.assertEquals("Annotations should be identical.", + Assertions.assertEquals( zero.toString(), - "@org.hibernate.search.annotations.Field(index=YES, store=NO)"); + "@org.hibernate.search.annotations.Field(index=YES, store=NO)", + "Annotations should be identical."); } + @Test public void testFieldBridge() throws Exception { final XAnnotationParser parser = XAnnotationParser.INSTANCE; @@ -165,13 +171,14 @@ public void testFieldBridge() throws Exception { final XAnnotation zero = parser.parse(element); System.out.println(zero.toString()); - Assert.assertEquals( - "Annotations should be identical.", + Assertions.assertEquals( zero.toString(), - "@org.hibernate.search.annotations.FieldBridge(impl=java.lang.String1[][][][], params=[])"); + "@org.hibernate.search.annotations.FieldBridge(impl=java.lang.String1[][][][], params=[])", + "Annotations should be identical."); } + @Test public void testH() throws Exception { final XAnnotationParser parser = XAnnotationParser.INSTANCE; @@ -188,11 +195,12 @@ public void testH() throws Exception { System.out.println(zero.toString()); System.out.println(one.toString()); System.out.println(two.toString()); - Assert.assertEquals("Annotations should be identical.", zero, one); - Assert.assertEquals("Annotations should be identical.", one, two); + Assertions.assertEquals(zero, one, "Annotations should be identical."); + Assertions.assertEquals(one, two, "Annotations should be identical."); } +// @Test // public void testI() throws Exception { // // final XAnnotation d = new XAnnotation(D.class); @@ -202,6 +210,7 @@ public void testH() throws Exception { // XGenericFieldParser.generic().construct("d", ds, ds.getClass()); // } + @Test public void testJ() throws Exception { final XAnnotationParser parser = XAnnotationParser.INSTANCE; @@ -215,10 +224,11 @@ public void testJ() throws Exception { System.out.println(one.toString()); System.out.println(two.toString()); - Assert.assertEquals("Annotations should be identical.", one, two); + Assertions.assertEquals(one, two, "Annotations should be identical."); } + @Test public void testK() throws Exception { final XAnnotationParser parser = XAnnotationParser.INSTANCE; @@ -232,10 +242,11 @@ public void testK() throws Exception { System.out.println(one.toString()); System.out.println(two.toString()); - Assert.assertEquals("Annotations should be identical.", one, two); + Assertions.assertEquals(one, two, "Annotations should be identical."); } + @Test public void testL() throws Exception { final XAnnotationParser parser = XAnnotationParser.INSTANCE; @@ -249,10 +260,11 @@ public void testL() throws Exception { System.out.println(one.toString()); System.out.println(two.toString()); - Assert.assertEquals("Annotations should be identical.", one, two); + Assertions.assertEquals(one, two, "Annotations should be identical."); } + @Test public void testM() throws Exception { final XAnnotationParser parser = XAnnotationParser.INSTANCE; @@ -266,6 +278,6 @@ public void testM() throws Exception { System.out.println(one.toString()); System.out.println(two.toString()); - Assert.assertEquals("Annotations should be identical.", one, two); + Assertions.assertEquals(one, two, "Annotations should be identical."); } } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/reader/resourced/tests/ResourcedXReaderTests.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/reader/resourced/tests/ResourcedXReaderTests.java index ad3f3c8de..75748667a 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/reader/resourced/tests/ResourcedXReaderTests.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/reader/resourced/tests/ResourcedXReaderTests.java @@ -2,81 +2,82 @@ import java.lang.annotation.Annotation; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.model.XClass; import org.jvnet.jaxb.annox.model.XField; import org.jvnet.jaxb.annox.model.XMethod; import org.jvnet.jaxb.annox.reader.XReader; import org.jvnet.jaxb.annox.reader.resourced.ResourcedXReader; -import junit.framework.TestCase; -public class ResourcedXReaderTests extends TestCase { +public class ResourcedXReaderTests { protected XReader xreader; - @Override - protected void setUp() throws Exception { - super.setUp(); + @BeforeEach + public void setUp() { this.xreader = new ResourcedXReader(); } + @Test public void testOne() throws Exception { final XClass xone = xreader.getXClass(One.class); - Assert.assertNotNull(xone); - Assert.assertTrue(xone.isAnnotationPresent(Alpha.class)); + Assertions.assertNotNull(xone); + Assertions.assertTrue(xone.isAnnotationPresent(Alpha.class)); { Alpha alpha = xone.getAnnotation(Alpha.class); - Assert.assertEquals(2, alpha.longField()); - Assert.assertEquals(3, alpha.intField()); - Assert.assertEquals(4, alpha.shortField()); - Assert.assertEquals('g', alpha.charField()); - Assert.assertEquals(6, alpha.byteField()); - Assert.assertEquals(6.0, alpha.doubleField(), 0.001); - Assert.assertEquals(7, alpha.floatField(), 0.001); - Assert.assertEquals(true, alpha.booleanField()); - Assert.assertEquals("nine", alpha.stringField()); - Assert.assertEquals(Epsilon.TEN, alpha.enumField()); - Assert.assertEquals(Twelve.class, alpha.classField()); - Assert.assertSame(xone, xreader.getXClass(One.class)); + Assertions.assertEquals(2, alpha.longField()); + Assertions.assertEquals(3, alpha.intField()); + Assertions.assertEquals(4, alpha.shortField()); + Assertions.assertEquals('g', alpha.charField()); + Assertions.assertEquals(6, alpha.byteField()); + Assertions.assertEquals(6.0, alpha.doubleField(), 0.001); + Assertions.assertEquals(7, alpha.floatField(), 0.001); + Assertions.assertEquals(true, alpha.booleanField()); + Assertions.assertEquals("nine", alpha.stringField()); + Assertions.assertEquals(Epsilon.TEN, alpha.enumField()); + Assertions.assertEquals(Twelve.class, alpha.classField()); + Assertions.assertSame(xone, xreader.getXClass(One.class)); } // Check field final XField xfieldA = xreader.getXField(One.class.getField("fieldA")); Alpha ann_fieldA = xfieldA.getAnnotation(Alpha.class); - Assert.assertEquals(16, ann_fieldA.intField()); + Assertions.assertEquals(16, ann_fieldA.intField()); // Check methods final XMethod xgetFieldA = xreader.getXMethod(One.class .getMethod("getFieldA")); Alpha ann_getFieldA = xgetFieldA.getAnnotation(Alpha.class); - Assert.assertEquals(32, ann_getFieldA.shortField()); + Assertions.assertEquals(32, ann_getFieldA.shortField()); final XMethod xsetFieldA = xreader.getXMethod(One.class.getMethod( "setFieldA", int.class)); Alpha ann_setFieldA = xsetFieldA.getAnnotation(Alpha.class); - Assert.assertEquals('Z', ann_setFieldA.charField()); + Assertions.assertEquals('Z', ann_setFieldA.charField()); final XMethod xsetFieldB1 = xreader.getXMethod(One.class .getMethod("setFieldB")); Alpha ann_setFieldB1 = xsetFieldB1.getAnnotation(Alpha.class); - Assert.assertEquals(64, ann_setFieldB1.byteField()); + Assertions.assertEquals(64, ann_setFieldB1.byteField()); final XMethod xsetFieldB2 = xreader.getXMethod(One.class.getMethod( "setFieldB", String.class)); Alpha ann_setFieldB2 = xsetFieldB2.getAnnotation(Alpha.class); - Assert.assertEquals(65, ann_setFieldB2.doubleField(), 0.001); + Assertions.assertEquals(65, ann_setFieldB2.doubleField(), 0.001); { final XMethod xmethod = xreader.getXMethod(One.class.getMethod( "setFieldC", String.class, int.class)); final Alpha alpha = xmethod.getAnnotation(Alpha.class); - Assert.assertEquals(128, alpha.floatField(), 0.001); + Assertions.assertEquals(128, alpha.floatField(), 0.001); final Annotation[][] pa = xmethod.getParameterAnnotations(); - Assert.assertEquals(2, pa.length); - Assert.assertEquals(0, pa[0].length); - Assert.assertEquals(1, pa[1].length); - Assert.assertEquals("int", ((Alpha) pa[1][0]).stringField()); + Assertions.assertEquals(2, pa.length); + Assertions.assertEquals(0, pa[0].length); + Assertions.assertEquals(1, pa[1].length); + Assertions.assertEquals("int", ((Alpha) pa[1][0]).stringField()); } @@ -84,29 +85,29 @@ public void testOne() throws Exception { final XMethod xmethod = xreader.getXMethod(One.class.getMethod( "setFieldC", String.class, int.class, byte.class)); Alpha alpha = xmethod.getAnnotation(Alpha.class); - Assert.assertEquals(129, alpha.floatField(), 0.001); + Assertions.assertEquals(129, alpha.floatField(), 0.001); final Annotation[][] pa = xmethod.getParameterAnnotations(); - Assert.assertEquals(3, pa.length); - Assert.assertEquals(1, pa[0].length); - Assert.assertEquals(0, pa[1].length); - Assert.assertEquals(1, pa[2].length); - Assert.assertEquals("java.lang.String", ((Alpha) pa[0][0]) + Assertions.assertEquals(3, pa.length); + Assertions.assertEquals(1, pa[0].length); + Assertions.assertEquals(0, pa[1].length); + Assertions.assertEquals(1, pa[2].length); + Assertions.assertEquals("java.lang.String", ((Alpha) pa[0][0]) .stringField()); - Assert.assertEquals("byte", ((Alpha) pa[2][0]).stringField()); + Assertions.assertEquals("byte", ((Alpha) pa[2][0]).stringField()); } { final XMethod xmethod = xreader.getXMethod(One.class.getMethod( "setFieldC", int.class, byte.class)); Alpha alpha = xmethod.getAnnotation(Alpha.class); - Assert.assertEquals(130, alpha.floatField(), 0.001); + Assertions.assertEquals(130, alpha.floatField(), 0.001); final Annotation[][] pa = xmethod.getParameterAnnotations(); - Assert.assertEquals(2, pa.length); - Assert.assertEquals(1, pa[0].length); - Assert.assertEquals(1, pa[1].length); - Assert.assertEquals("int", ((Alpha) pa[0][0]).stringField()); - Assert.assertEquals("byte", ((Alpha) pa[1][0]).stringField()); + Assertions.assertEquals(2, pa.length); + Assertions.assertEquals(1, pa[0].length); + Assertions.assertEquals(1, pa[1].length); + Assertions.assertEquals("int", ((Alpha) pa[0][0]).stringField()); + Assertions.assertEquals("byte", ((Alpha) pa[1][0]).stringField()); } } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/tests/ProxyTest.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/tests/ProxyTest.java index 718f244d9..2eb61258b 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/tests/ProxyTest.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/tests/ProxyTest.java @@ -4,30 +4,31 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; -import org.junit.Assert; -import junit.framework.TestCase; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -public class ProxyTest extends TestCase { +public class ProxyTest { - public void testProxy() throws Exception { + @Test + public void testProxy() throws Exception { - final InvocationHandler handler = new InvocationHandler() { - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - return "a"; - } - }; + final InvocationHandler handler = new InvocationHandler() { + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + return "a"; + } + }; - final A a = (A) Proxy.newProxyInstance( - A.class.getClassLoader(), - new Class[]{ A.class }, - handler); + final A a = (A) Proxy.newProxyInstance( + A.class.getClassLoader(), + new Class[]{A.class}, + handler); - Assert.assertEquals("Wrong value.", "a", a.stringField()); - } + Assertions.assertEquals("a", a.stringField(), "Wrong value."); + } - public static interface A { - public String stringField(); - } + public static interface A { + public String stringField(); + } } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/util/tests/ClassUtilsTest.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/util/tests/ClassUtilsTest.java index 6570db89d..6ee2f0ee7 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/util/tests/ClassUtilsTest.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/util/tests/ClassUtilsTest.java @@ -4,48 +4,46 @@ import java.util.Arrays; import java.util.Map; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.util.ClassUtils; public class ClassUtilsTest { @Test public void testwrapperArrayToPrimitiveArray() { - Assert.assertEquals(int[].class, + Assertions.assertEquals(int[].class, ClassUtils.wrapperArrayToPrimitiveArray(Integer[].class)); - Assert.assertEquals(int[].class, + Assertions.assertEquals(int[].class, ClassUtils.wrapperArrayToPrimitiveArray(int[].class)); - Assert.assertEquals(Object[].class, + Assertions.assertEquals(Object[].class, ClassUtils.wrapperArrayToPrimitiveArray(Object[].class)); } @Test public void testForName() throws Exception { - Assert.assertEquals("Wrong class.", Integer.TYPE, - ClassUtils.forName("int")); - Assert.assertEquals("Wrong class.", byte[].class, - ClassUtils.forName("byte[]")); - Assert.assertEquals("Wrong class.", String.class, - ClassUtils.forName("java.lang.String")); - Assert.assertEquals("Wrong class.", URL[].class, - ClassUtils.forName("java.net.URL[]")); + Assertions.assertEquals(Integer.TYPE, + ClassUtils.forName("int"), "Wrong class."); + Assertions.assertEquals(byte[].class, + ClassUtils.forName("byte[]"), "Wrong class."); + Assertions.assertEquals(String.class, + ClassUtils.forName("java.lang.String"), "Wrong class."); + Assertions.assertEquals(URL[].class, + ClassUtils.forName("java.net.URL[]"), "Wrong class."); } @Test public void testForNames() throws Exception { - Assert.assertTrue( - "Class arrays must be equal.", + Assertions.assertTrue( Arrays.equals( - new Class[] { Integer.TYPE, String.class, int[].class, String[].class, Map.Entry.class }, ClassUtils - .forNames("int, java.lang.String, int[], java.lang.String[], java.util.Map$Entry"))); - + .forNames("int, java.lang.String, int[], java.lang.String[], java.util.Map$Entry")), + "Class arrays must be equal."); } } diff --git a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/util/tests/ReflectionUtilsTest.java b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/util/tests/ReflectionUtilsTest.java index b821fec1d..2510ca1d0 100644 --- a/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/util/tests/ReflectionUtilsTest.java +++ b/jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/util/tests/ReflectionUtilsTest.java @@ -1,12 +1,10 @@ package org.jvnet.jaxb.annox.util.tests; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.jvnet.jaxb.annox.util.ClassUtils; import org.jvnet.jaxb.annox.util.ReflectionUtils; -import junit.framework.TestCase; - -public class ReflectionUtilsTest extends TestCase { +public class ReflectionUtilsTest { public static class Test { public Test() { @@ -43,27 +41,29 @@ public void four(String x, int y, char[] z) { } } + @org.junit.jupiter.api.Test public void testGetMethod() throws Exception { - Assert.assertNotNull(ReflectionUtils.getMethod(Test.class, "one", + Assertions.assertNotNull(ReflectionUtils.getMethod(Test.class, "one", ClassUtils.forNames(null))); - Assert.assertNotNull(ReflectionUtils.getMethod(Test.class, "two", + Assertions.assertNotNull(ReflectionUtils.getMethod(Test.class, "two", ClassUtils.forNames(null))); - Assert.assertNotNull(ReflectionUtils.getMethod(Test.class, "two", + Assertions.assertNotNull(ReflectionUtils.getMethod(Test.class, "two", ClassUtils.forNames(""))); - Assert.assertEquals(ReflectionUtils.getMethod(Test.class, "two", + Assertions.assertEquals(ReflectionUtils.getMethod(Test.class, "two", ClassUtils.forNames("")), ReflectionUtils.getMethod(Test.class, "two", ClassUtils.forNames(""))); - Assert.assertNotNull(ReflectionUtils.getMethod(Test.class, "two", + Assertions.assertNotNull(ReflectionUtils.getMethod(Test.class, "two", ClassUtils.forNames("java.lang.String"))); - Assert.assertNotNull(ReflectionUtils.getMethod(Test.class, "three", + Assertions.assertNotNull(ReflectionUtils.getMethod(Test.class, "three", ClassUtils.forNames("java.lang.String[]"))); - Assert.assertNotNull(ReflectionUtils.getMethod(Test.class, "four", + Assertions.assertNotNull(ReflectionUtils.getMethod(Test.class, "four", ClassUtils.forNames("java.lang.String, int, char[]"))); } + @org.junit.jupiter.api.Test public void testGetConstructor() throws Exception { ReflectionUtils.getConstructor(Test.class, null); diff --git a/jaxb-annox-parent/samples/po/project-build.xml b/jaxb-annox-parent/samples/po/project-build.xml index d13e5f359..394b0f2b2 100644 --- a/jaxb-annox-parent/samples/po/project-build.xml +++ b/jaxb-annox-parent/samples/po/project-build.xml @@ -110,23 +110,22 @@ - + - - - - + + + - - + + diff --git a/jaxb-annox-parent/samples/po/project-pom.xml b/jaxb-annox-parent/samples/po/project-pom.xml index 899ccc339..07ac5f6c9 100644 --- a/jaxb-annox-parent/samples/po/project-pom.xml +++ b/jaxb-annox-parent/samples/po/project-pom.xml @@ -19,9 +19,9 @@ ${jaxb.version} - junit - junit - ${junit4.version} + org.junit.jupiter + junit-jupiter-engine + ${junit5.version} test diff --git a/jaxb-annox-parent/samples/po/src/test/java/org/jvnet/jaxb/annox/samples/po/tests/AnnotationReaderTest.java b/jaxb-annox-parent/samples/po/src/test/java/org/jvnet/jaxb/annox/samples/po/tests/AnnotationReaderTest.java index c6ccb8bb7..56f610a56 100644 --- a/jaxb-annox-parent/samples/po/src/test/java/org/jvnet/jaxb/annox/samples/po/tests/AnnotationReaderTest.java +++ b/jaxb-annox-parent/samples/po/src/test/java/org/jvnet/jaxb/annox/samples/po/tests/AnnotationReaderTest.java @@ -6,7 +6,8 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; -import junit.framework.TestCase; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.annox.samples.po.PurchaseOrderType; import org.jvnet.jaxb.annox.xml.bind.AnnoxAnnotationReader; @@ -14,8 +15,9 @@ import org.glassfish.jaxb.runtime.api.JAXBRIContext; import org.glassfish.jaxb.runtime.v2.model.annotation.RuntimeAnnotationReader; -public class AnnotationReaderTest extends TestCase { +public class AnnotationReaderTest { + @Test public void testAnnotationReader() throws Exception { final RuntimeAnnotationReader annotationReader = new AnnoxAnnotationReader(); @@ -35,15 +37,13 @@ public void testAnnotationReader() throws Exception { final PurchaseOrderType purchaseOrder = purchaseOrderElement.getValue(); - assertNotNull(purchaseOrder.getOrderDate()); - assertNotNull(purchaseOrder.getShipTo()); - assertNotNull(purchaseOrder.getBillTo()); - assertEquals("Hurry, my lawn is going wild!", purchaseOrder - .getComment()); - assertNotNull(purchaseOrder.getItems()); - assertEquals(2, purchaseOrder.getItems().getItem().size()); - assertEquals("Confirm this is electric", purchaseOrder.getItems() - .getItem().get(0).getComment()); + Assertions.assertNotNull(purchaseOrder.getOrderDate()); + Assertions.assertNotNull(purchaseOrder.getShipTo()); + Assertions.assertNotNull(purchaseOrder.getBillTo()); + Assertions.assertEquals("Hurry, my lawn is going wild!", purchaseOrder.getComment()); + Assertions.assertNotNull(purchaseOrder.getItems()); + Assertions.assertEquals(2, purchaseOrder.getItems().getItem().size()); + Assertions.assertEquals("Confirm this is electric", purchaseOrder.getItems().getItem().get(0).getComment()); } diff --git a/jaxb-plugins-parent/jaxb-plugins-runtime/pom.xml b/jaxb-plugins-parent/jaxb-plugins-runtime/pom.xml index 01fda810e..adf633a24 100644 --- a/jaxb-plugins-parent/jaxb-plugins-runtime/pom.xml +++ b/jaxb-plugins-parent/jaxb-plugins-runtime/pom.xml @@ -30,8 +30,13 @@ provided - junit - junit + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-params test diff --git a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/DynamicSchemaTest.java b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/DynamicSchemaTest.java index fb5e189ea..ef5725840 100644 --- a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/DynamicSchemaTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/DynamicSchemaTest.java @@ -18,7 +18,8 @@ import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; public class DynamicSchemaTest { @@ -36,7 +37,7 @@ public A(String name) { } } - @Test(expected = MarshalException.class) + @Test public void generatesAndUsesSchema() throws JAXBException, IOException, SAXException { final JAXBContext context = JAXBContext.newInstance(A.class); @@ -60,7 +61,9 @@ public Result createOutput(String namespaceUri, marshaller.setSchema(schema); // Works marshaller.marshal(new A("works"), System.out); + // Fails - marshaller.marshal(new A(null), System.out); + Assertions.assertThrows(MarshalException.class, + () -> marshaller.marshal(new A(null), System.out)); } } diff --git a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/addelement/AddElementTest.java b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/addelement/AddElementTest.java index 15cef89b9..35e30588a 100644 --- a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/addelement/AddElementTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/addelement/AddElementTest.java @@ -9,9 +9,8 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlRootElement; import jakarta.xml.bind.annotation.XmlTransient; - -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class AddElementTest { @@ -21,7 +20,7 @@ public void addsElement() throws JAXBException { JAXBContext context = JAXBContext.newInstance(Element.class); final Element element = (Element) context.createUnmarshaller() .unmarshal(getClass().getResource("element.xml")); - Assert.assertEquals("beta", element.getChildren().get(1).getValue()); + Assertions.assertEquals("beta", element.getChildren().get(1).getValue()); } @XmlRootElement(name = "element") diff --git a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/dogs/DogTest.java b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/dogs/DogTest.java index 7c9460f10..cb4e8e5cb 100644 --- a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/dogs/DogTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/dogs/DogTest.java @@ -2,9 +2,8 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBException; - -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class DogTest { @@ -14,18 +13,15 @@ public void unmarshallsDogs() throws JAXBException { .newInstance(ObjectFactory.class); final Dogs dogs = (Dogs) context.createUnmarshaller().unmarshal( getClass().getResource("dogs.xml")); - Assert.assertEquals(3, dogs.getDogs().size()); + Assertions.assertEquals(3, dogs.getDogs().size()); // Does not work -// Assert.assertEquals("henry", dogs.getDogs().get(0).getValue() -// .getName()); - Assert.assertEquals("bark", dogs.getDogs().get(0).getValue().getSound()); + // Assertions.assertEquals("henry", dogs.getDogs().get(0).getValue().getName()); + Assertions.assertEquals("bark", dogs.getDogs().get(0).getValue().getSound()); // Does not work -// Assert.assertEquals("fido", dogs.getDogs().get(1).getValue() -// .getName()); - Assert.assertEquals("woof", dogs.getDogs().get(1).getValue().getSound()); + // Assertions.assertEquals("fido", dogs.getDogs().get(1).getValue().getName()); + Assertions.assertEquals("woof", dogs.getDogs().get(1).getValue().getSound()); // Does not work -// Assert.assertEquals("barks", dogs.getDogs().get(2).getValue() -// .getName()); - Assert.assertEquals("miau", dogs.getDogs().get(2).getValue().getSound()); + // Assert.assertEquals("barks", dogs.getDogs().get(2).getValue().getName()); + Assertions.assertEquals("miau", dogs.getDogs().get(2).getValue().getSound()); } } diff --git a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/dynamicelementname/DynamicElementNameTest.java b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/dynamicelementname/DynamicElementNameTest.java index 6c0dff0fd..b86358801 100644 --- a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/dynamicelementname/DynamicElementNameTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/hisrc/xml/bind/tests/dynamicelementname/DynamicElementNameTest.java @@ -11,9 +11,9 @@ import jakarta.xml.bind.annotation.XmlRegistry; import jakarta.xml.bind.annotation.XmlRootElement; import jakarta.xml.bind.annotation.XmlTransient; -import javax.xml.namespace.QName; +import org.junit.jupiter.api.Test; -import org.junit.Test; +import javax.xml.namespace.QName; public class DynamicElementNameTest { diff --git a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/CopyStrategyTest.java b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/CopyStrategyTest.java index ee5f4ae62..b8d322c2f 100644 --- a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/CopyStrategyTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/CopyStrategyTest.java @@ -8,9 +8,8 @@ import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlRootElement; -import junit.framework.TestCase; - import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.CopyStrategy; import org.jvnet.jaxb.lang.CopyTo; import org.jvnet.jaxb.lang.JAXBCopyStrategy; @@ -20,9 +19,10 @@ import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.Polygon; -public class CopyStrategyTest extends TestCase { +public class CopyStrategyTest { - public void testPolygon() { + @Test + public void testPolygon() { final GeometryFactory geometryFactory = new GeometryFactory(); final Polygon polygon = geometryFactory.createPolygon( geometryFactory.createLinearRing(new Coordinate[] { @@ -37,6 +37,7 @@ public void testPolygon() { } + @Test public void testAny() throws Exception { JAXBContext context = JAXBContext.newInstance(A.class); diff --git a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/CyclicTests.java b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/CyclicTests.java index a253d6d8c..a2c139ea1 100644 --- a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/CyclicTests.java +++ b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/CyclicTests.java @@ -3,8 +3,8 @@ import java.util.IdentityHashMap; import java.util.Map; -import junit.framework.TestCase; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.CopyStrategy; import org.jvnet.jaxb.lang.CopyTo; import org.jvnet.jaxb.lang.JAXBCopyStrategy; @@ -12,7 +12,7 @@ import org.jvnet.jaxb.locator.ObjectLocator; import org.jvnet.jaxb.locator.util.LocatorUtils; -public class CyclicTests extends TestCase { +public class CyclicTests { public interface CopyToInstance extends CopyTo { } @@ -60,6 +60,7 @@ public Object copyTo(ObjectLocator locator, Object target, } } + @Test public void testCycle() throws Exception { final A a = new A(); final B b = new B(); @@ -91,7 +92,7 @@ public Object copy(ObjectLocator locator, Object object, } }.copy(new DefaultRootObjectLocator(a), a); - assertSame(a1.b.a.b, a1.b); + Assertions.assertSame(a1.b.a.b, a1.b); // BUG: See https://github.com/highsource/jaxb-tools/issues/92 // assertSame(a1.b.a, a1); } diff --git a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/DefaultCopyStrategyTest.java b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/DefaultCopyStrategyTest.java index 43925d96c..9f2f3a11c 100644 --- a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/DefaultCopyStrategyTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/lang/tests/DefaultCopyStrategyTest.java @@ -3,8 +3,8 @@ import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.Polygon; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.DefaultCopyStrategy; import org.jvnet.jaxb.lang.tests.pojo.CloneableNoClone; @@ -39,7 +39,9 @@ public void testXMLGregorianCalendarOK() throws DatatypeConfigurationException { public void testCloneableNoCloneKO() { final CloneableNoClone object = new CloneableNoClone("no-clone-method-in-it"); - Assert.assertThrows("Exception UnsupportedOperationException not thrown", - UnsupportedOperationException.class, () -> new DefaultCopyStrategy().copy(null, object)); + Assertions.assertThrows( + UnsupportedOperationException.class, + () -> new DefaultCopyStrategy().copy(null, object), + "Exception UnsupportedOperationException not thrown"); } } diff --git a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/xml/bind/model/util/tests/XmlTypeUtilsTest.java b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/xml/bind/model/util/tests/XmlTypeUtilsTest.java index 6caa7b0b0..6cfb849a0 100644 --- a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/xml/bind/model/util/tests/XmlTypeUtilsTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/xml/bind/model/util/tests/XmlTypeUtilsTest.java @@ -1,148 +1,100 @@ package org.jvnet.jaxb.xml.bind.model.util.tests; -import java.util.Arrays; -import java.util.Collection; +import java.util.stream.Stream; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import org.jvnet.jaxb.xml.bind.model.util.XmlTypeUtils; import org.jvnet.jaxb.xml.namespace.util.QNameUtils; -@RunWith(Parameterized.class) public class XmlTypeUtilsTest { - @Parameters - public static Collection data() { - return Arrays - .asList(new Object[][] { + public static Stream data() { + return Stream.of( // - { + Arguments.of( "a1", - org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A1.class }, - { - "a2", - org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A2.class }, - { - "AThree", - org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A3.class }, - { - "AFour", - org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A4.class }, - { - "{urn:five}AFive", - org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A5.class }, - { - "a6", - org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A6.class }, - { - "{urn:seven}a7", - org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A7.class }, - { - null, - org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A8.class }, - { - "{urn:nine}ANine", - org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A9.class }, - { - "a1", - org.jvnet.jaxb.xml.bind.model.util.tests.beta.A1.class }, - { - "a2", - org.jvnet.jaxb.xml.bind.model.util.tests.beta.A2.class }, - { - "AThree", - org.jvnet.jaxb.xml.bind.model.util.tests.beta.A3.class }, - { - "AFour", - org.jvnet.jaxb.xml.bind.model.util.tests.beta.A4.class }, - { - "{urn:five}AFive", - org.jvnet.jaxb.xml.bind.model.util.tests.beta.A5.class }, - { - "a6", - org.jvnet.jaxb.xml.bind.model.util.tests.beta.A6.class }, - { - "{urn:seven}a7", - org.jvnet.jaxb.xml.bind.model.util.tests.beta.A7.class }, - { - null, - org.jvnet.jaxb.xml.bind.model.util.tests.beta.A8.class }, - { - "{urn:nine}ANine", - org.jvnet.jaxb.xml.bind.model.util.tests.beta.A9.class }, - { - "{urn:gamma}a1", - org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A1.class }, - { - "{urn:gamma}a2", - org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A2.class }, - { - "{urn:gamma}AThree", - org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A3.class }, - { - "AFour", - org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A4.class }, - { - "{urn:five}AFive", - org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A5.class }, - { - "a6", - org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A6.class }, - { - "{urn:seven}a7", - org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A7.class }, - { - null, - org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A8.class }, - { - "{urn:nine}ANine", - org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A9.class }, - { - "{urn:delta}a1", - org.jvnet.jaxb.xml.bind.model.util.tests.delta.A1.class }, - { - "{urn:delta}a2", - org.jvnet.jaxb.xml.bind.model.util.tests.delta.A2.class }, - { - "{urn:delta}AThree", - org.jvnet.jaxb.xml.bind.model.util.tests.delta.A3.class }, - { - "AFour", - org.jvnet.jaxb.xml.bind.model.util.tests.delta.A4.class }, - { - "{urn:five}five:AFive", - org.jvnet.jaxb.xml.bind.model.util.tests.delta.A5.class }, - { - "a6", - org.jvnet.jaxb.xml.bind.model.util.tests.delta.A6.class }, - { - "{urn:seven}a7", - org.jvnet.jaxb.xml.bind.model.util.tests.delta.A7.class }, - { - null, - org.jvnet.jaxb.xml.bind.model.util.tests.delta.A8.class }, - { - "{urn:nine}ANine", - org.jvnet.jaxb.xml.bind.model.util.tests.delta.A9.class }, - - }); - } - - private final String key; - - private final Class _class; + org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A1.class ), + Arguments.of("a2", + org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A2.class ), + Arguments.of("AThree", + org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A3.class ), + Arguments.of("AFour", + org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A4.class ), + Arguments.of("{urn:five}AFive", + org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A5.class ), + Arguments.of("a6", + org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A6.class ), + Arguments.of("{urn:seven}a7", + org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A7.class ), + Arguments.of(null, + org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A8.class ), + Arguments.of("{urn:nine}ANine", + org.jvnet.jaxb.xml.bind.model.util.tests.alpha.A9.class ), + Arguments.of("a1", + org.jvnet.jaxb.xml.bind.model.util.tests.beta.A1.class ), + Arguments.of("a2", + org.jvnet.jaxb.xml.bind.model.util.tests.beta.A2.class ), + Arguments.of("AThree", + org.jvnet.jaxb.xml.bind.model.util.tests.beta.A3.class ), + Arguments.of("AFour", + org.jvnet.jaxb.xml.bind.model.util.tests.beta.A4.class ), + Arguments.of("{urn:five}AFive", + org.jvnet.jaxb.xml.bind.model.util.tests.beta.A5.class ), + Arguments.of("a6", + org.jvnet.jaxb.xml.bind.model.util.tests.beta.A6.class ), + Arguments.of("{urn:seven}a7", + org.jvnet.jaxb.xml.bind.model.util.tests.beta.A7.class ), + Arguments.of(null, + org.jvnet.jaxb.xml.bind.model.util.tests.beta.A8.class ), + Arguments.of("{urn:nine}ANine", + org.jvnet.jaxb.xml.bind.model.util.tests.beta.A9.class ), + Arguments.of("{urn:gamma}a1", + org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A1.class ), + Arguments.of("{urn:gamma}a2", + org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A2.class ), + Arguments.of("{urn:gamma}AThree", + org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A3.class ), + Arguments.of("AFour", + org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A4.class ), + Arguments.of("{urn:five}AFive", + org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A5.class ), + Arguments.of("a6", + org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A6.class ), + Arguments.of("{urn:seven}a7", + org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A7.class ), + Arguments.of(null, + org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A8.class ), + Arguments.of("{urn:nine}ANine", + org.jvnet.jaxb.xml.bind.model.util.tests.gamma.A9.class ), + Arguments.of("{urn:delta}a1", + org.jvnet.jaxb.xml.bind.model.util.tests.delta.A1.class ), + Arguments.of("{urn:delta}a2", + org.jvnet.jaxb.xml.bind.model.util.tests.delta.A2.class ), + Arguments.of("{urn:delta}AThree", + org.jvnet.jaxb.xml.bind.model.util.tests.delta.A3.class ), + Arguments.of("AFour", + org.jvnet.jaxb.xml.bind.model.util.tests.delta.A4.class ), + Arguments.of("{urn:five}five:AFive", + org.jvnet.jaxb.xml.bind.model.util.tests.delta.A5.class ), + Arguments.of("a6", + org.jvnet.jaxb.xml.bind.model.util.tests.delta.A6.class ), + Arguments.of("{urn:seven}a7", + org.jvnet.jaxb.xml.bind.model.util.tests.delta.A7.class ), + Arguments.of(null, + org.jvnet.jaxb.xml.bind.model.util.tests.delta.A8.class ), + Arguments.of("{urn:nine}ANine", + org.jvnet.jaxb.xml.bind.model.util.tests.delta.A9.class ) - public XmlTypeUtilsTest(String key, Class _class) { - this.key = key; - this._class = _class; + ); } - @Test - public void producesCorrectTypeName() { - Assert.assertEquals(key, + @ParameterizedTest + @MethodSource("data") + public void producesCorrectTypeName(String key, Class _class) { + Assertions.assertEquals(key, QNameUtils.getKey(XmlTypeUtils.getTypeName(_class))); } diff --git a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/xml/namespace/util/tests/QNameUtilsTest.java b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/xml/namespace/util/tests/QNameUtilsTest.java index fb0de269d..d9da09b4c 100644 --- a/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/xml/namespace/util/tests/QNameUtilsTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-runtime/src/test/java/org/jvnet/jaxb/xml/namespace/util/tests/QNameUtilsTest.java @@ -2,19 +2,19 @@ import javax.xml.namespace.QName; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.xml.namespace.util.QNameUtils; public class QNameUtilsTest { @Test public void producesCorrectKey() { - Assert.assertEquals(null, QNameUtils.getKey(null)); - Assert.assertEquals("a", QNameUtils.getKey(new QName("a"))); - Assert.assertEquals("{b}a", QNameUtils.getKey(new QName("b", "a"))); - Assert.assertEquals("{b}c:a", + Assertions.assertEquals(null, QNameUtils.getKey(null)); + Assertions.assertEquals("a", QNameUtils.getKey(new QName("a"))); + Assertions.assertEquals("{b}a", QNameUtils.getKey(new QName("b", "a"))); + Assertions.assertEquals("{b}c:a", QNameUtils.getKey(new QName("b", "a", "c"))); - Assert.assertEquals("c:a", QNameUtils.getKey(new QName("", "a", "c"))); + Assertions.assertEquals("c:a", QNameUtils.getKey(new QName("", "a", "c"))); } } diff --git a/jaxb-plugins-parent/jaxb-plugins-testing/pom.xml b/jaxb-plugins-parent/jaxb-plugins-testing/pom.xml index 17f2b44e3..dd7c02c67 100644 --- a/jaxb-plugins-parent/jaxb-plugins-testing/pom.xml +++ b/jaxb-plugins-parent/jaxb-plugins-testing/pom.xml @@ -15,8 +15,8 @@ compile - junit - junit + org.junit.jupiter + junit-jupiter-engine compile diff --git a/jaxb-plugins-parent/jaxb-plugins-testing/src/main/java/org/jvnet/jaxb/test/AbstractSamplesTest.java b/jaxb-plugins-parent/jaxb-plugins-testing/src/main/java/org/jvnet/jaxb/test/AbstractSamplesTest.java index 9b23e9d40..fbe408b57 100644 --- a/jaxb-plugins-parent/jaxb-plugins-testing/src/main/java/org/jvnet/jaxb/test/AbstractSamplesTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-testing/src/main/java/org/jvnet/jaxb/test/AbstractSamplesTest.java @@ -7,14 +7,13 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBException; -import org.junit.Assert; -import junit.framework.TestCase; - import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -public abstract class AbstractSamplesTest extends TestCase { +public abstract class AbstractSamplesTest { protected Log logger = LogFactory.getLog(getTestClass()); @@ -24,6 +23,7 @@ protected String getContextPath() { protected abstract void checkSample(File sample) throws Exception; + @Test public void testSamples() throws Exception { logger.debug("Testing samples."); int failed = 0; @@ -42,8 +42,8 @@ public void testSamples() throws Exception { } logger.debug("Finished testing samples."); - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); + Assertions.assertTrue(failed == 0, + "Totally [" + failed + "/" + sampleFiles.length + "] failed the check."); } protected File getBaseDir() { diff --git a/jaxb-plugins-parent/jaxb-plugins-testing/src/test/java/org/jvnet/jaxb/test/tests/TrivialSamplesTest.java b/jaxb-plugins-parent/jaxb-plugins-testing/src/test/java/org/jvnet/jaxb/test/tests/TrivialSamplesTest.java index b7531f562..4cc6d56db 100644 --- a/jaxb-plugins-parent/jaxb-plugins-testing/src/test/java/org/jvnet/jaxb/test/tests/TrivialSamplesTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-testing/src/test/java/org/jvnet/jaxb/test/tests/TrivialSamplesTest.java @@ -2,13 +2,14 @@ import java.io.File; +import org.junit.jupiter.api.Assertions; import org.jvnet.jaxb.test.AbstractSamplesTest; public class TrivialSamplesTest extends AbstractSamplesTest { - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } + @Override + protected void checkSample(File sample) throws Exception { + Assertions.assertTrue(sample.getName().endsWith(".xml"), "Wrong extension."); + } } diff --git a/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/reflection/util/test/FieldAccessorTest.java b/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/reflection/util/test/FieldAccessorTest.java index 3705fe0bd..2f066d297 100644 --- a/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/reflection/util/test/FieldAccessorTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/reflection/util/test/FieldAccessorTest.java @@ -2,8 +2,8 @@ import java.net.URISyntaxException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.reflection.util.Accessor; import org.jvnet.jaxb.reflection.util.FieldAccessor; @@ -16,10 +16,10 @@ public void testGetAndSet() throws URISyntaxException { final Accessor schemeAccessor = new FieldAccessor( URIInternalTest.class, "scheme", String.class); - Assert.assertEquals("urn", schemeAccessor.get(uri)); + Assertions.assertEquals("urn", schemeAccessor.get(uri)); schemeAccessor.set(uri, "nru"); - Assert.assertEquals("nru", schemeAccessor.get(uri)); - Assert.assertEquals("nru", uri.getScheme()); + Assertions.assertEquals("nru", schemeAccessor.get(uri)); + Assertions.assertEquals("nru", uri.getScheme()); } diff --git a/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/util/tests/JClassUtilsTest.java b/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/util/tests/JClassUtilsTest.java index 3275ab406..4d4b17437 100644 --- a/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/util/tests/JClassUtilsTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/util/tests/JClassUtilsTest.java @@ -3,8 +3,8 @@ import java.io.Externalizable; import java.util.Collection; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.util.JClassUtils; import com.sun.codemodel.JClass; @@ -21,27 +21,27 @@ public void correctlyChecksIsInstanceOf() throws JClassAlreadyExistsException { final JClass arrayList = codeModel.ref("java.util.ArrayList"); - Assert.assertTrue(JClassUtils.isInstanceOf(arrayList, Collection.class)); + Assertions.assertTrue(JClassUtils.isInstanceOf(arrayList, Collection.class)); final JDefinedClass subArrayList = codeModel._class("SubArrayList"); subArrayList._extends(arrayList); - Assert.assertTrue(JClassUtils.isInstanceOf(subArrayList, + Assertions.assertTrue(JClassUtils.isInstanceOf(subArrayList, Collection.class)); final JClass subArrayListOfObjects = subArrayList.narrow(Object.class); - Assert.assertTrue(JClassUtils.isInstanceOf(subArrayListOfObjects, + Assertions.assertTrue(JClassUtils.isInstanceOf(subArrayListOfObjects, Collection.class)); final JDefinedClass subExternalizable = codeModel ._class("SubExternalizable"); subExternalizable._implements(Externalizable.class); - Assert.assertTrue(JClassUtils.isInstanceOf(subExternalizable, + Assertions.assertTrue(JClassUtils.isInstanceOf(subExternalizable, Externalizable.class)); subArrayList._implements(subExternalizable); - Assert.assertTrue(JClassUtils.isInstanceOf(subArrayList, + Assertions.assertTrue(JClassUtils.isInstanceOf(subArrayList, Externalizable.class)); - Assert.assertFalse(JClassUtils.isInstanceOf(codeModel.NULL, + Assertions.assertFalse(JClassUtils.isInstanceOf(codeModel.NULL, Collection.class)); } diff --git a/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/xjc/model/concrete/tests/alpha/AlphaMInfoFactoryTest.java b/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/xjc/model/concrete/tests/alpha/AlphaMInfoFactoryTest.java index f40a7721b..045e0a96a 100644 --- a/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/xjc/model/concrete/tests/alpha/AlphaMInfoFactoryTest.java +++ b/jaxb-plugins-parent/jaxb-plugins-tools/src/test/java/org/jvnet/jaxb/xjc/model/concrete/tests/alpha/AlphaMInfoFactoryTest.java @@ -6,9 +6,9 @@ import javax.xml.namespace.QName; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.xjc.model.concrete.XJCCMInfoFactory; import org.jvnet.jaxb.xml.bind.model.MClassInfo; import org.jvnet.jaxb.xml.bind.model.MElementInfo; @@ -30,7 +30,7 @@ public class AlphaMInfoFactoryTest { private static MModelInfo MODEL_INFO; - @BeforeClass + @BeforeAll public static void createModel() throws BadCommandLineException, IOException { final String generateDirectory = "target/generated-sources/" @@ -48,7 +48,7 @@ public static void createModel() throws BadCommandLineException, options.parseArguments(arguments); ConsoleErrorReporter receiver = new ConsoleErrorReporter(); Model model = ModelLoader.load(options, new JCodeModel(), receiver); - Assert.assertNotNull(model); + Assertions.assertNotNull(model); final XJCCMInfoFactory factory = new XJCCMInfoFactory(model); @@ -62,7 +62,7 @@ public static void createModel() throws BadCommandLineException, @Test public void successfullyLoadsModel() { - Assert.assertNotNull(MODEL_INFO); + Assertions.assertNotNull(MODEL_INFO); } @Test @@ -70,7 +70,7 @@ public void createsCorrectTypeNameForNamedComplexType() { final MClassInfo classInfo = MODEL_INFO .getClassInfo(getClass().getPackage().getName() + "." + "NamedComplexType"); - Assert.assertEquals(new QName("urn:test", "NamedComplexType"), + Assertions.assertEquals(new QName("urn:test", "NamedComplexType"), classInfo.getTypeName()); } @@ -79,8 +79,8 @@ public void createsCorrectTypeNameForUnnamedComplexType() { final MElementInfo elementInfo = MODEL_INFO .getGlobalElementInfo(new QName("urn:test", "UnnamedComplexTypeElement")); - Assert.assertNotNull(elementInfo); - Assert.assertNull(elementInfo.getTypeInfo().getTypeName()); + Assertions.assertNotNull(elementInfo); + Assertions.assertNull(elementInfo.getTypeInfo().getTypeName()); } @Test @@ -88,8 +88,8 @@ public void createsCorrectTypeNameForNamedSimpleType() { final MElementInfo elementInfo = MODEL_INFO .getGlobalElementInfo(new QName("urn:test", "NamedSimpleTypeElement")); - Assert.assertNotNull(elementInfo); - Assert.assertEquals(new QName("urn:test", "NamedSimpleType"), + Assertions.assertNotNull(elementInfo); + Assertions.assertEquals(new QName("urn:test", "NamedSimpleType"), elementInfo.getTypeInfo().getTypeName()); } @@ -98,16 +98,16 @@ public void createsCorrectTypeNameForUnnamedSimpleType() { final MElementInfo elementInfo = MODEL_INFO .getGlobalElementInfo(new QName("urn:test", "UnnamedSimpleTypeElement")); - Assert.assertNotNull(elementInfo); - Assert.assertNull(elementInfo.getTypeInfo().getTypeName()); + Assertions.assertNotNull(elementInfo); + Assertions.assertNull(elementInfo.getTypeInfo().getTypeName()); } @Test public void createsCorrectTypeNameForStringElementType() { final MElementInfo elementInfo = MODEL_INFO .getGlobalElementInfo(new QName("urn:test", "StringElement")); - Assert.assertNotNull(elementInfo); - Assert.assertEquals(XmlSchemaConstants.STRING, elementInfo + Assertions.assertNotNull(elementInfo); + Assertions.assertEquals(XmlSchemaConstants.STRING, elementInfo .getTypeInfo().getTypeName()); } @@ -119,8 +119,8 @@ public void createsCorrectTypeNameForKnownReferencedType() { .getGlobalElementInfo(new QName("urn:test", "KnownReferencedTypeElement")); final MTypeInfo typeInfo = elementInfo.getTypeInfo(); - Assert.assertNotNull(typeInfo); - Assert.assertEquals(QNameUtils.getKey(typeName), + Assertions.assertNotNull(typeInfo); + Assertions.assertEquals(QNameUtils.getKey(typeName), QNameUtils.getKey(typeInfo.getTypeName())); } @@ -130,7 +130,7 @@ public void createsCorrectTypeNameForUnnownReferencedType() { .getGlobalElementInfo(new QName("urn:test", "UnknownReferencedTypeElement")); final MTypeInfo typeInfo = elementInfo.getTypeInfo(); - Assert.assertNotNull(typeInfo); - Assert.assertNull(typeInfo.getTypeName()); + Assertions.assertNotNull(typeInfo); + Assertions.assertNull(typeInfo.getTypeName()); } } diff --git a/jaxb-plugins-parent/jaxb-plugins/src/test/java/org/jvnet/jaxb/plugin/inheritance/tests/JavaParserTest.java b/jaxb-plugins-parent/jaxb-plugins/src/test/java/org/jvnet/jaxb/plugin/inheritance/tests/JavaParserTest.java index 0521df124..d8291b3bb 100644 --- a/jaxb-plugins-parent/jaxb-plugins/src/test/java/org/jvnet/jaxb/plugin/inheritance/tests/JavaParserTest.java +++ b/jaxb-plugins-parent/jaxb-plugins/src/test/java/org/jvnet/jaxb/plugin/inheritance/tests/JavaParserTest.java @@ -1,26 +1,27 @@ package org.jvnet.jaxb.plugin.inheritance.tests; -import junit.framework.TestCase; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.plugin.inheritance.util.JavaTypeParser; import com.sun.codemodel.JClass; import com.sun.codemodel.JCodeModel; -public class JavaParserTest extends TestCase { +public class JavaParserTest { + @Test public void testParse() throws Exception { final JavaTypeParser javaTypeParser = new JavaTypeParser(); final JCodeModel codeModel = new JCodeModel(); JClass comparator = javaTypeParser.parseClass("java.util.Comparator", codeModel); - assertNotNull(comparator); + Assertions.assertNotNull(comparator); JClass integerComparator = javaTypeParser.parseClass( "java.util.Comparator", codeModel); - assertNotNull(integerComparator); + Assertions.assertNotNull(integerComparator); JClass wildcardIntegerComparator = javaTypeParser.parseClass( "java.util.Comparator", codeModel); - assertNotNull(wildcardIntegerComparator); + Assertions.assertNotNull(wildcardIntegerComparator); } } diff --git a/jaxb-plugins-parent/jaxb-plugins/src/test/java/org/jvnet/jaxb/plugin/inheritance/tests/JavaTypeParserTest.java b/jaxb-plugins-parent/jaxb-plugins/src/test/java/org/jvnet/jaxb/plugin/inheritance/tests/JavaTypeParserTest.java index cb5ecbce2..ac9da0a3f 100644 --- a/jaxb-plugins-parent/jaxb-plugins/src/test/java/org/jvnet/jaxb/plugin/inheritance/tests/JavaTypeParserTest.java +++ b/jaxb-plugins-parent/jaxb-plugins/src/test/java/org/jvnet/jaxb/plugin/inheritance/tests/JavaTypeParserTest.java @@ -8,15 +8,16 @@ import com.github.javaparser.ast.type.ClassOrInterfaceType; import com.github.javaparser.ast.type.ReferenceType; import com.github.javaparser.ast.type.Type; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; import java.util.List; -import junit.framework.TestCase; - -public class JavaTypeParserTest extends TestCase { +public class JavaTypeParserTest { + @Test public void testParse() throws Exception { final String text = "public class Dummy implements java.util.Comparator{}"; @@ -24,25 +25,25 @@ public void testParse() throws Exception { final CompilationUnit compilationUnit = StaticJavaParser.parse( new ByteArrayInputStream(text.getBytes("UTF-8")), StandardCharsets.UTF_8); final NodeList> typeDeclarations = compilationUnit.getTypes(); - assertEquals(1, typeDeclarations.size()); + Assertions.assertEquals(1, typeDeclarations.size()); final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - assertTrue(typeDeclaration instanceof ClassOrInterfaceDeclaration); + Assertions.assertTrue(typeDeclaration instanceof ClassOrInterfaceDeclaration); final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - assertEquals("Dummy", classDeclaration.getNameAsString()); + Assertions.assertEquals("Dummy", classDeclaration.getNameAsString()); final List implementedInterfaces = classDeclaration.getImplementedTypes(); - assertEquals(1, implementedInterfaces.size()); + Assertions.assertEquals(1, implementedInterfaces.size()); final ClassOrInterfaceType implementedInterface = implementedInterfaces .get(0); - assertEquals("Comparator", implementedInterface.getNameAsString()); + Assertions.assertEquals("Comparator", implementedInterface.getNameAsString()); final List typeArgs = implementedInterface.getTypeArguments().orElse(null); - assertEquals(1, typeArgs.size()); + Assertions.assertEquals(1, typeArgs.size()); final Type typeArg = typeArgs.get(0); - assertTrue(typeArg instanceof ReferenceType); + Assertions.assertTrue(typeArg instanceof ReferenceType); final ReferenceType referenceTypeArg = (ReferenceType) typeArg; final Type referencedType = referenceTypeArg.getElementType(); - assertTrue(referencedType instanceof ClassOrInterfaceType); + Assertions.assertTrue(referencedType instanceof ClassOrInterfaceType); final ClassOrInterfaceType typeArgType = (ClassOrInterfaceType) referencedType; - assertEquals("Integer", typeArgType.getNameAsString()); - + Assertions.assertEquals("Integer", typeArgType.getNameAsString()); } + } diff --git a/jaxb-plugins-parent/pom.xml b/jaxb-plugins-parent/pom.xml index 79ccd7759..8bdd7c1d6 100644 --- a/jaxb-plugins-parent/pom.xml +++ b/jaxb-plugins-parent/pom.xml @@ -41,8 +41,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine test diff --git a/jaxb-plugins-parent/samples/basic/pom.xml b/jaxb-plugins-parent/samples/basic/pom.xml index 2cf2dc108..80d854af5 100644 --- a/jaxb-plugins-parent/samples/basic/pom.xml +++ b/jaxb-plugins-parent/samples/basic/pom.xml @@ -12,8 +12,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine org.jvnet.jaxb diff --git a/jaxb-plugins-parent/samples/basic/project-build.xml b/jaxb-plugins-parent/samples/basic/project-build.xml index f13aba7dd..cafe37f8c 100644 --- a/jaxb-plugins-parent/samples/basic/project-build.xml +++ b/jaxb-plugins-parent/samples/basic/project-build.xml @@ -154,17 +154,16 @@ - + - - - - + + + @@ -173,8 +172,8 @@ - - + + diff --git a/jaxb-plugins-parent/samples/basic/src/test/java/org/jvnet/jaxb/tests/one/CopyableTest.java b/jaxb-plugins-parent/samples/basic/src/test/java/org/jvnet/jaxb/tests/one/CopyableTest.java index cab81303d..60bee7551 100644 --- a/jaxb-plugins-parent/samples/basic/src/test/java/org/jvnet/jaxb/tests/one/CopyableTest.java +++ b/jaxb-plugins-parent/samples/basic/src/test/java/org/jvnet/jaxb/tests/one/CopyableTest.java @@ -2,7 +2,7 @@ import java.io.File; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.jvnet.jaxb.lang.JAXBCopyStrategy; import org.jvnet.jaxb.lang.JAXBEqualsStrategy; @@ -16,7 +16,7 @@ protected void checkSample(File sample) throws Exception { final Object object = createContext().createUnmarshaller().unmarshal( sample); final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); + Assertions.assertTrue(JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy), "Source and copy must be equal."); } } diff --git a/jaxb-plugins-parent/samples/basic/src/test/java/org/jvnet/jaxb/tests/one/EqualsTest.java b/jaxb-plugins-parent/samples/basic/src/test/java/org/jvnet/jaxb/tests/one/EqualsTest.java index 90168dece..0ec96103b 100644 --- a/jaxb-plugins-parent/samples/basic/src/test/java/org/jvnet/jaxb/tests/one/EqualsTest.java +++ b/jaxb-plugins-parent/samples/basic/src/test/java/org/jvnet/jaxb/tests/one/EqualsTest.java @@ -2,6 +2,8 @@ import java.io.File; +import org.junit.jupiter.api.Assertions; + import org.jvnet.jaxb.lang.JAXBEqualsStrategy; import org.jvnet.jaxb.test.AbstractSamplesTest; @@ -12,6 +14,6 @@ protected void checkSample(File sample) throws Exception { final Object lhs = createContext().createUnmarshaller().unmarshal(sample); final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); + Assertions.assertTrue(JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs), "Values must be equal."); } } diff --git a/jaxb-plugins-parent/samples/cxf/pom.xml b/jaxb-plugins-parent/samples/cxf/pom.xml index 6a30ea750..8ebe12903 100644 --- a/jaxb-plugins-parent/samples/cxf/pom.xml +++ b/jaxb-plugins-parent/samples/cxf/pom.xml @@ -12,8 +12,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine org.jvnet.jaxb diff --git a/jaxb-plugins-parent/samples/po-simple/pom.xml b/jaxb-plugins-parent/samples/po-simple/pom.xml index f980317c5..9e814f9a2 100644 --- a/jaxb-plugins-parent/samples/po-simple/pom.xml +++ b/jaxb-plugins-parent/samples/po-simple/pom.xml @@ -12,8 +12,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine org.jvnet.jaxb diff --git a/jaxb-plugins-parent/samples/po-simple/project-build.xml b/jaxb-plugins-parent/samples/po-simple/project-build.xml index 7a305708a..abaf65961 100644 --- a/jaxb-plugins-parent/samples/po-simple/project-build.xml +++ b/jaxb-plugins-parent/samples/po-simple/project-build.xml @@ -149,17 +149,16 @@ - + - - - - + + + @@ -168,8 +167,8 @@ - - + + diff --git a/jaxb-plugins-parent/samples/po-simple/project-pom.xml b/jaxb-plugins-parent/samples/po-simple/project-pom.xml index 52cba3113..fda8e50e4 100644 --- a/jaxb-plugins-parent/samples/po-simple/project-pom.xml +++ b/jaxb-plugins-parent/samples/po-simple/project-pom.xml @@ -42,9 +42,9 @@ test - junit - junit - ${junit4.version} + org.junit.jupiter + junit-jupiter-engine + ${junit5.version} test diff --git a/jaxb-plugins-parent/samples/po-simple/src/test/java/org/jvnet/jaxb/tests/posimple/EqualsTest.java b/jaxb-plugins-parent/samples/po-simple/src/test/java/org/jvnet/jaxb/tests/posimple/EqualsTest.java index 15c398904..c6db07552 100644 --- a/jaxb-plugins-parent/samples/po-simple/src/test/java/org/jvnet/jaxb/tests/posimple/EqualsTest.java +++ b/jaxb-plugins-parent/samples/po-simple/src/test/java/org/jvnet/jaxb/tests/posimple/EqualsTest.java @@ -4,6 +4,8 @@ import jakarta.xml.bind.JAXBElement; +import org.junit.jupiter.api.Assertions; + import org.jvnet.jaxb.test.AbstractSamplesTest; public class EqualsTest extends AbstractSamplesTest { @@ -15,7 +17,6 @@ protected void checkSample(File sample) throws Exception { .createUnmarshaller().unmarshal(sample); final JAXBElement rhs = (JAXBElement) createContext() .createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", - lhs.getValue().equals(rhs.getValue())); + Assertions.assertTrue(lhs.getValue().equals(rhs.getValue()), "Values must be equal."); } } diff --git a/jaxb-plugins-parent/samples/po/pom.xml b/jaxb-plugins-parent/samples/po/pom.xml index 63042fd15..c8d27d430 100644 --- a/jaxb-plugins-parent/samples/po/pom.xml +++ b/jaxb-plugins-parent/samples/po/pom.xml @@ -12,8 +12,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine org.jvnet.jaxb diff --git a/jaxb-plugins-parent/samples/po/project-build.xml b/jaxb-plugins-parent/samples/po/project-build.xml index fcb4c5501..1137fab1f 100644 --- a/jaxb-plugins-parent/samples/po/project-build.xml +++ b/jaxb-plugins-parent/samples/po/project-build.xml @@ -154,17 +154,16 @@ - + - - - - + + + @@ -173,8 +172,8 @@ - - + + diff --git a/jaxb-plugins-parent/samples/po/src/test/java/org/jvnet/jaxb/tests/po/CopyableTest.java b/jaxb-plugins-parent/samples/po/src/test/java/org/jvnet/jaxb/tests/po/CopyableTest.java index 4e961c7d5..138f73160 100644 --- a/jaxb-plugins-parent/samples/po/src/test/java/org/jvnet/jaxb/tests/po/CopyableTest.java +++ b/jaxb-plugins-parent/samples/po/src/test/java/org/jvnet/jaxb/tests/po/CopyableTest.java @@ -2,7 +2,7 @@ import java.io.File; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.jvnet.jaxb.lang.JAXBCopyStrategy; import org.jvnet.jaxb.lang.JAXBEqualsStrategy; @@ -16,7 +16,7 @@ protected void checkSample(File sample) throws Exception { final Object object = createContext().createUnmarshaller().unmarshal( sample); final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); + Assertions.assertTrue(JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy), "Source and copy must be equal."); } } diff --git a/jaxb-plugins-parent/samples/po/src/test/java/org/jvnet/jaxb/tests/po/EqualsTest.java b/jaxb-plugins-parent/samples/po/src/test/java/org/jvnet/jaxb/tests/po/EqualsTest.java index 89354841a..3db33907c 100644 --- a/jaxb-plugins-parent/samples/po/src/test/java/org/jvnet/jaxb/tests/po/EqualsTest.java +++ b/jaxb-plugins-parent/samples/po/src/test/java/org/jvnet/jaxb/tests/po/EqualsTest.java @@ -2,6 +2,8 @@ import java.io.File; +import org.junit.jupiter.api.Assertions; + import org.jvnet.jaxb.lang.JAXBEqualsStrategy; import org.jvnet.jaxb.test.AbstractSamplesTest; @@ -12,6 +14,6 @@ protected void checkSample(File sample) throws Exception { final Object lhs = createContext().createUnmarshaller().unmarshal(sample); final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); + Assertions.assertTrue(JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs), "Values must be equal."); } } diff --git a/jaxb-plugins-parent/tests/JAXB-1058/src/test/java/org/jvnet/jaxb2_commons/tests/JAXB_1058/ExecuteJAXB1058.java b/jaxb-plugins-parent/tests/JAXB-1058/src/test/java/org/jvnet/jaxb2_commons/tests/JAXB_1058/ExecuteJAXB1058.java index 8a6cf1759..0d2296edd 100644 --- a/jaxb-plugins-parent/tests/JAXB-1058/src/test/java/org/jvnet/jaxb2_commons/tests/JAXB_1058/ExecuteJAXB1058.java +++ b/jaxb-plugins-parent/tests/JAXB-1058/src/test/java/org/jvnet/jaxb2_commons/tests/JAXB_1058/ExecuteJAXB1058.java @@ -2,13 +2,12 @@ import java.io.File; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.Test; public class ExecuteJAXB1058 { diff --git a/jaxb-plugins-parent/tests/booleangetter/src/test/java/org/jvnet/jaxb/tests/booleangetter/PersonTest.java b/jaxb-plugins-parent/tests/booleangetter/src/test/java/org/jvnet/jaxb/tests/booleangetter/PersonTest.java index bf65f1a5d..d44b6385f 100644 --- a/jaxb-plugins-parent/tests/booleangetter/src/test/java/org/jvnet/jaxb/tests/booleangetter/PersonTest.java +++ b/jaxb-plugins-parent/tests/booleangetter/src/test/java/org/jvnet/jaxb/tests/booleangetter/PersonTest.java @@ -1,15 +1,14 @@ package org.jvnet.jaxb.tests.booleangetter; -import org.junit.Assert; -import org.junit.Test; - import generated.Person; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class PersonTest { @Test public void testPerson() { Person p = new Person(); - Assert.assertEquals(false, p.getMailingAddressIdentical()); + Assertions.assertEquals(false, p.getMailingAddressIdentical()); } } diff --git a/jaxb-plugins-parent/tests/camelcase/src/test/java/org/jvnet/jaxb/tests/camelcase/AddressTest.java b/jaxb-plugins-parent/tests/camelcase/src/test/java/org/jvnet/jaxb/tests/camelcase/AddressTest.java index e9edf2c83..3ef9518f0 100644 --- a/jaxb-plugins-parent/tests/camelcase/src/test/java/org/jvnet/jaxb/tests/camelcase/AddressTest.java +++ b/jaxb-plugins-parent/tests/camelcase/src/test/java/org/jvnet/jaxb/tests/camelcase/AddressTest.java @@ -1,9 +1,8 @@ package org.jvnet.jaxb.tests.camelcase; -import org.junit.Assert; -import org.junit.Test; - import generated.Address; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class AddressTest { @@ -11,8 +10,8 @@ public class AddressTest { public void testAddress() { Address a = new Address(); // No plugin default-value present, checking everything is null or default java value - Assert.assertEquals(0, a.getNumber()); - Assert.assertNull(a.getCareOf()); - Assert.assertNull(a.getStreet()); + Assertions.assertEquals(0, a.getNumber()); + Assertions.assertNull(a.getCareOf()); + Assertions.assertNull(a.getStreet()); } } diff --git a/jaxb-plugins-parent/tests/camelcase/src/test/java/org/jvnet/jaxb/tests/camelcase/PersonTest.java b/jaxb-plugins-parent/tests/camelcase/src/test/java/org/jvnet/jaxb/tests/camelcase/PersonTest.java index 0b1ac84a9..fef09a407 100644 --- a/jaxb-plugins-parent/tests/camelcase/src/test/java/org/jvnet/jaxb/tests/camelcase/PersonTest.java +++ b/jaxb-plugins-parent/tests/camelcase/src/test/java/org/jvnet/jaxb/tests/camelcase/PersonTest.java @@ -1,15 +1,14 @@ package org.jvnet.jaxb.tests.camelcase; -import org.junit.Assert; -import org.junit.Test; - import generated.Person; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class PersonTest { @Test public void testPerson() { Person p = new Person(); - Assert.assertEquals(false, p.isMailingAddressIdentical()); + Assertions.assertEquals(false, p.isMailingAddressIdentical()); } } diff --git a/jaxb-plugins-parent/tests/commons_lang/src/test/java/org/jvnet/jaxb2_commons/tests/commons_lang/AddressTest.java b/jaxb-plugins-parent/tests/commons_lang/src/test/java/org/jvnet/jaxb2_commons/tests/commons_lang/AddressTest.java index a4f1ea51f..aa6dc6ee1 100644 --- a/jaxb-plugins-parent/tests/commons_lang/src/test/java/org/jvnet/jaxb2_commons/tests/commons_lang/AddressTest.java +++ b/jaxb-plugins-parent/tests/commons_lang/src/test/java/org/jvnet/jaxb2_commons/tests/commons_lang/AddressTest.java @@ -2,10 +2,10 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import org.junit.Assert; -import org.junit.Test; import generated.Address; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class AddressTest { @@ -13,10 +13,10 @@ public class AddressTest { public void testAddress() { Address a = new Address(); // No plugin default-value present, checking everything is null or default java value - Assert.assertEquals(0, a.getNumber()); - Assert.assertNull(a.getCareOf()); - Assert.assertNull(a.getStreet()); + Assertions.assertEquals(0, a.getNumber()); + Assertions.assertNull(a.getCareOf()); + Assertions.assertNull(a.getStreet()); - Assert.assertEquals(ToStringBuilder.reflectionToString(a, ToStringStyle.MULTI_LINE_STYLE), a.toString()); + Assertions.assertEquals(ToStringBuilder.reflectionToString(a, ToStringStyle.MULTI_LINE_STYLE), a.toString()); } } diff --git a/jaxb-plugins-parent/tests/commons_lang/src/test/java/org/jvnet/jaxb2_commons/tests/commons_lang/PersonTest.java b/jaxb-plugins-parent/tests/commons_lang/src/test/java/org/jvnet/jaxb2_commons/tests/commons_lang/PersonTest.java index a53ff2bf1..9103cabd4 100644 --- a/jaxb-plugins-parent/tests/commons_lang/src/test/java/org/jvnet/jaxb2_commons/tests/commons_lang/PersonTest.java +++ b/jaxb-plugins-parent/tests/commons_lang/src/test/java/org/jvnet/jaxb2_commons/tests/commons_lang/PersonTest.java @@ -2,10 +2,10 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import org.junit.Assert; -import org.junit.Test; import generated.Person; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class PersonTest { @@ -13,8 +13,8 @@ public class PersonTest { public void testPerson() { Person p = new Person(); // No plugin default-value present, checking everything is null or default java value - Assert.assertEquals(false, p.isMailingAddressIdentical()); + Assertions.assertEquals(false, p.isMailingAddressIdentical()); - Assert.assertEquals(ToStringBuilder.reflectionToString(p, ToStringStyle.MULTI_LINE_STYLE), p.toString()); + Assertions.assertEquals(ToStringBuilder.reflectionToString(p, ToStringStyle.MULTI_LINE_STYLE), p.toString()); } } diff --git a/jaxb-plugins-parent/tests/defaultvalue/src/test/java/org/jvnet/jaxb2_commons/tests/defaultvalue/AddressTest.java b/jaxb-plugins-parent/tests/defaultvalue/src/test/java/org/jvnet/jaxb2_commons/tests/defaultvalue/AddressTest.java index 43792d5f6..f9941aef7 100644 --- a/jaxb-plugins-parent/tests/defaultvalue/src/test/java/org/jvnet/jaxb2_commons/tests/defaultvalue/AddressTest.java +++ b/jaxb-plugins-parent/tests/defaultvalue/src/test/java/org/jvnet/jaxb2_commons/tests/defaultvalue/AddressTest.java @@ -1,18 +1,17 @@ package org.jvnet.jaxb2_commons.tests.defaultvalue; -import org.junit.Assert; -import org.junit.Test; - import generated.Address; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class AddressTest { @Test public void testAddress() { Address a = new Address(); - Assert.assertEquals(42, a.getNumber()); - Assert.assertEquals("none", a.getCareOf()); + Assertions.assertEquals(42, a.getNumber()); + Assertions.assertEquals("none", a.getCareOf()); // no default value for street - Assert.assertNull(a.getStreet()); + Assertions.assertNull(a.getStreet()); } } diff --git a/jaxb-plugins-parent/tests/defaultvalue/src/test/java/org/jvnet/jaxb2_commons/tests/defaultvalue/PersonTest.java b/jaxb-plugins-parent/tests/defaultvalue/src/test/java/org/jvnet/jaxb2_commons/tests/defaultvalue/PersonTest.java index 5c61ed9f1..0fffe96a6 100644 --- a/jaxb-plugins-parent/tests/defaultvalue/src/test/java/org/jvnet/jaxb2_commons/tests/defaultvalue/PersonTest.java +++ b/jaxb-plugins-parent/tests/defaultvalue/src/test/java/org/jvnet/jaxb2_commons/tests/defaultvalue/PersonTest.java @@ -1,15 +1,14 @@ package org.jvnet.jaxb2_commons.tests.defaultvalue; -import org.junit.Assert; -import org.junit.Test; - import generated.Person; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class PersonTest { @Test public void testPerson() { Person p = new Person(); - Assert.assertEquals(true, p.isMailingAddressIdentical()); + Assertions.assertEquals(true, p.isMailingAddressIdentical()); } } diff --git a/jaxb-plugins-parent/tests/enumtostring/src/test/java/org/jvnet/jaxb/tests/enumtostring/ConsoleTest.java b/jaxb-plugins-parent/tests/enumtostring/src/test/java/org/jvnet/jaxb/tests/enumtostring/ConsoleTest.java index f744c5777..ada5adb00 100644 --- a/jaxb-plugins-parent/tests/enumtostring/src/test/java/org/jvnet/jaxb/tests/enumtostring/ConsoleTest.java +++ b/jaxb-plugins-parent/tests/enumtostring/src/test/java/org/jvnet/jaxb/tests/enumtostring/ConsoleTest.java @@ -3,8 +3,8 @@ import generated.Console; import generated.Model; import generated.Vendor; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class ConsoleTest { @@ -15,19 +15,19 @@ public void testConsole() { c.setVendor(Vendor.SONY); String cToString = c.toString(); - Assert.assertTrue(cToString.startsWith("generated.Console")); - Assert.assertTrue(cToString.endsWith("[model=PS5, vendor=SONY]")); + Assertions.assertTrue(cToString.startsWith("generated.Console")); + Assertions.assertTrue(cToString.endsWith("[model=PS5, vendor=SONY]")); } @Test public void testModel() { Model m = Model.PS_3; - Assert.assertEquals(Model.PS_3.value(), m.toString()); + Assertions.assertEquals(Model.PS_3.value(), m.toString()); } @Test public void testVendor() { Vendor v = Vendor.MICROSOFT; - Assert.assertEquals(Vendor.MICROSOFT.name(), v.toString()); + Assertions.assertEquals(Vendor.MICROSOFT.name(), v.toString()); } } diff --git a/jaxb-plugins-parent/tests/fluentapi/src/test/java/org/jvnet/jaxb/tests/fluentapi/BaseTest.java b/jaxb-plugins-parent/tests/fluentapi/src/test/java/org/jvnet/jaxb/tests/fluentapi/BaseTest.java index 2945b03a2..086d8eb35 100644 --- a/jaxb-plugins-parent/tests/fluentapi/src/test/java/org/jvnet/jaxb/tests/fluentapi/BaseTest.java +++ b/jaxb-plugins-parent/tests/fluentapi/src/test/java/org/jvnet/jaxb/tests/fluentapi/BaseTest.java @@ -1,8 +1,8 @@ package org.jvnet.jaxb.tests.fluentapi; import generated.Base; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; @@ -26,13 +26,13 @@ public void testBase() throws DatatypeConfigurationException { .withListOfString("a", "b", "c") .withListOfString(Arrays.asList("e", "f", "g")); - Assert.assertEquals("String", b.getA()); - Assert.assertEquals(xgc, b.getB()); - Assert.assertEquals(xgc, b.getC()); - Assert.assertEquals(xgc, b.getD()); - Assert.assertEquals(textBytes, b.getE()); - Assert.assertNotNull(b.getListOfString()); - Assert.assertEquals(6, b.getListOfString().size()); - Assert.assertTrue(b.getListOfString().containsAll(Arrays.asList("a", "b", "c", "e", "f", "g"))); + Assertions.assertEquals("String", b.getA()); + Assertions.assertEquals(xgc, b.getB()); + Assertions.assertEquals(xgc, b.getC()); + Assertions.assertEquals(xgc, b.getD()); + Assertions.assertEquals(textBytes, b.getE()); + Assertions.assertNotNull(b.getListOfString()); + Assertions.assertEquals(6, b.getListOfString().size()); + Assertions.assertTrue(b.getListOfString().containsAll(Arrays.asList("a", "b", "c", "e", "f", "g"))); } } diff --git a/jaxb-plugins-parent/tests/fluentapi/src/test/java/org/jvnet/jaxb/tests/fluentapi/PrimitivesAndUnboxedPrimitivesTest.java b/jaxb-plugins-parent/tests/fluentapi/src/test/java/org/jvnet/jaxb/tests/fluentapi/PrimitivesAndUnboxedPrimitivesTest.java index 006b6c7f6..1457cb537 100644 --- a/jaxb-plugins-parent/tests/fluentapi/src/test/java/org/jvnet/jaxb/tests/fluentapi/PrimitivesAndUnboxedPrimitivesTest.java +++ b/jaxb-plugins-parent/tests/fluentapi/src/test/java/org/jvnet/jaxb/tests/fluentapi/PrimitivesAndUnboxedPrimitivesTest.java @@ -2,8 +2,8 @@ import generated.Primitives; import generated.UnboxedPrimitives; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class PrimitivesAndUnboxedPrimitivesTest { @@ -18,13 +18,13 @@ public void testPrimitives() { .withByte((byte) 80) .withShort((short) 160); - Assert.assertEquals(true, p.isBoolean()); - Assert.assertEquals(1, p.getInt()); - Assert.assertEquals(10L, p.getLong()); - Assert.assertEquals(20d, p.getDouble(), 0); - Assert.assertEquals(40.0f, p.getFloat(), 0); - Assert.assertEquals((byte) 80, p.getByte()); - Assert.assertEquals((short) 160, p.getShort()); + Assertions.assertEquals(true, p.isBoolean()); + Assertions.assertEquals(1, p.getInt()); + Assertions.assertEquals(10L, p.getLong()); + Assertions.assertEquals(20d, p.getDouble(), 0); + Assertions.assertEquals(40.0f, p.getFloat(), 0); + Assertions.assertEquals((byte) 80, p.getByte()); + Assertions.assertEquals((short) 160, p.getShort()); } @Test @@ -38,12 +38,12 @@ public void testUnboxedPrimitives() { .withUnboxedByte(Byte.valueOf((byte) 80)) .withUnboxedShort(Short.valueOf((short) 160)); - Assert.assertEquals(Boolean.TRUE, u.isUnboxedBoolean()); - Assert.assertEquals(Integer.valueOf(1), u.getUnboxedInt()); - Assert.assertEquals(Long.valueOf(10), u.getUnboxedLong()); - Assert.assertEquals(Double.valueOf(20d), u.getUnboxedDouble()); - Assert.assertEquals(Float.valueOf(40.0f), u.getUnboxedFloat()); - Assert.assertEquals(Byte.valueOf((byte) 80), u.getUnboxedByte()); - Assert.assertEquals(Short.valueOf((short) 160), u.getUnboxedShort()); + Assertions.assertEquals(Boolean.TRUE, u.isUnboxedBoolean()); + Assertions.assertEquals(Integer.valueOf(1), u.getUnboxedInt()); + Assertions.assertEquals(Long.valueOf(10), u.getUnboxedLong()); + Assertions.assertEquals(Double.valueOf(20d), u.getUnboxedDouble()); + Assertions.assertEquals(Float.valueOf(40.0f), u.getUnboxedFloat()); + Assertions.assertEquals(Byte.valueOf((byte) 80), u.getUnboxedByte()); + Assertions.assertEquals(Short.valueOf((short) 160), u.getUnboxedShort()); } } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/CopyableTest.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/CopyableTest.java index 1c78bdc1e..a25d50feb 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/CopyableTest.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/CopyableTest.java @@ -2,7 +2,7 @@ import java.io.File; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.jvnet.jaxb.lang.CopyStrategy; import org.jvnet.jaxb.lang.EqualsStrategy; import org.jvnet.jaxb.lang.ExtendedJAXBEqualsStrategy; @@ -20,8 +20,9 @@ protected void checkSample(File sample) throws Exception { final CopyStrategy copyStrategy = new JAXBCopyStrategy(); final Object copy = copyStrategy.copy(null, original, true); final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", - equalsStrategy.equals(null, null, original, copy, true, true)); + Assertions.assertTrue( + equalsStrategy.equals(null, null, original, copy, true, true), + "Source and copy must be equal."); } } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH22Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH22Test.java index 54a248f90..9f148eb15 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH22Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH22Test.java @@ -1,20 +1,20 @@ package org.jvnet.jaxb.tests.issues; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.JAXBEqualsStrategy; public class GH22Test { @Test public void testJAXBEqualsSymmetryConcreteClassAndEnum() { - Assert.assertFalse(JAXBEqualsStrategy.getInstance().equals(null, null, + Assertions.assertFalse(JAXBEqualsStrategy.getInstance().equals(null, null, new SomeConcreteClass(), SomeEnum.ENUM)); } @Test public void testJAXBEqualsSymmetryEnumAndConcreteClass() { // This test fails and throws a ClassCastException - Assert.assertFalse(JAXBEqualsStrategy.getInstance().equals(null, null, + Assertions.assertFalse(JAXBEqualsStrategy.getInstance().equals(null, null, SomeEnum.ENUM, new SomeConcreteClass())); } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH26Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH26Test.java index 345ea5b96..7b0e1fd08 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH26Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH26Test.java @@ -3,9 +3,9 @@ import java.io.File; import java.net.URL; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.xjc.model.concrete.XJCCMInfoFactory; import org.jvnet.jaxb.xml.bind.model.MAttributePropertyInfo; import org.jvnet.jaxb.xml.bind.model.MClassInfo; @@ -24,7 +24,7 @@ public class GH26Test { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } @@ -55,33 +55,33 @@ public void compilesSchema() throws Exception { final MClassInfo classInfo = mmodel .getClassInfo("org.jvnet.jaxb.tests.issues.IssueGH26Type"); - Assert.assertNotNull(classInfo); + Assertions.assertNotNull(classInfo); final MElementPropertyInfo a = (MElementPropertyInfo) classInfo .getProperty("a"); - Assert.assertEquals("a", a.getDefaultValue()); - Assert.assertNotNull(a.getDefaultValueNamespaceContext()); + Assertions.assertEquals("a", a.getDefaultValue()); + Assertions.assertNotNull(a.getDefaultValueNamespaceContext()); final MElementsPropertyInfo bOrC = (MElementsPropertyInfo) classInfo .getProperty("bOrC"); -// Assert.assertEquals("b", bOrC.getElementTypeInfos().get(0).getDefaultValue()); - Assert.assertNotNull(bOrC.getElementTypeInfos().get(0).getDefaultValueNamespaceContext()); +// Assertions.assertEquals("b", bOrC.getElementTypeInfos().get(0).getDefaultValue()); + Assertions.assertNotNull(bOrC.getElementTypeInfos().get(0).getDefaultValueNamespaceContext()); -// Assert.assertEquals("3", bOrC.getElementTypeInfos().get(1).getDefaultValue()); - Assert.assertNotNull(bOrC.getElementTypeInfos().get(1).getDefaultValueNamespaceContext()); +// Assertions.assertEquals("3", bOrC.getElementTypeInfos().get(1).getDefaultValue()); + Assertions.assertNotNull(bOrC.getElementTypeInfos().get(1).getDefaultValueNamespaceContext()); final MElementRefsPropertyInfo dOrE = (MElementRefsPropertyInfo) classInfo .getProperty("dOrE"); -// Assert.assertEquals("e", dOrE.getElementTypeInfos().get(0).getDefaultValue()); - Assert.assertNotNull(dOrE.getElementTypeInfos().get(0).getDefaultValueNamespaceContext()); +// Assertions.assertEquals("e", dOrE.getElementTypeInfos().get(0).getDefaultValue()); + Assertions.assertNotNull(dOrE.getElementTypeInfos().get(0).getDefaultValueNamespaceContext()); -// Assert.assertEquals("d", dOrE.getElementTypeInfos().get(1).getDefaultValue()); - Assert.assertNotNull(dOrE.getElementTypeInfos().get(1).getDefaultValueNamespaceContext()); +// Assertions.assertEquals("d", dOrE.getElementTypeInfos().get(1).getDefaultValue()); + Assertions.assertNotNull(dOrE.getElementTypeInfos().get(1).getDefaultValueNamespaceContext()); final MAttributePropertyInfo z = (MAttributePropertyInfo) classInfo .getProperty("z"); - Assert.assertEquals("z", z.getDefaultValue()); - Assert.assertNotNull(z.getDefaultValueNamespaceContext()); + Assertions.assertEquals("z", z.getDefaultValue()); + Assertions.assertNotNull(z.getDefaultValueNamespaceContext()); // model.generateCode(options, receiver); // com.sun.codemodel.CodeWriter cw = options.createCodeWriter(); // model.codeModel.build(cw); diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH31Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH31Test.java index 4cc33c166..f12cc3bd4 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH31Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH31Test.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.tests.issues; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.EnumValue; import org.jvnet.jaxb.lang.JAXBToStringStrategy; import org.jvnet.jaxb.lang.ToStringStrategy; @@ -29,7 +29,7 @@ public StringBuilder append(ObjectLocator locator, } }; }; - Assert.assertEquals( + Assertions.assertEquals( "org.jvnet.jaxb.tests.issues.IssueGH31ComplexType[testEnum=Male(default)]", t.append(null, new StringBuilder(), s).toString()); } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH37Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH37Test.java index afab9246a..25ce52f56 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH37Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/GH37Test.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.tests.issues; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.JAXBToStringStrategy; import org.jvnet.jaxb.lang.ToStringStrategy; @@ -13,16 +13,16 @@ public void considersDefaultValuesInMerge() { final IssueGH37Type right = new IssueGH37Type(); final IssueGH37Type result = new IssueGH37Type(); result.mergeFrom(left, right); - Assert.assertTrue(result.isTestBoolean()); + Assertions.assertTrue(result.isTestBoolean()); } @Test public void considersDefaultValuesInCopyTo() { final IssueGH37Type original = new IssueGH37Type(); final IssueGH37Type copy = (IssueGH37Type) original.clone(); - Assert.assertTrue(copy.isTestBoolean()); - Assert.assertFalse(copy.isSetTestBoolean()); - Assert.assertEquals(original, copy); + Assertions.assertTrue(copy.isTestBoolean()); + Assertions.assertFalse(copy.isSetTestBoolean()); + Assertions.assertEquals(original, copy); } @Test @@ -34,12 +34,12 @@ public boolean isUseIdentityHashCode() { } }; IssueGH37Type a = new IssueGH37Type(); - Assert.assertEquals( + Assertions.assertEquals( "org.jvnet.jaxb.tests.issues.IssueGH37Type[testBoolean=true(default)]", a.append(null, new StringBuilder(), strategy).toString()); IssueGH37Type b = new IssueGH37Type(); b.setTestBoolean(true); - Assert.assertEquals( + Assertions.assertEquals( "org.jvnet.jaxb.tests.issues.IssueGH37Type[testBoolean=true]", b.append(null, new StringBuilder(), strategy).toString()); } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB10Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB10Test.java index 8b1f5cb45..04fa518ea 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB10Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB10Test.java @@ -3,18 +3,17 @@ import java.lang.reflect.Field; import jakarta.xml.bind.annotation.XmlAnyElement; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import junit.framework.TestCase; - -import org.junit.Assert; - -public class JIIB10Test extends TestCase { +public class JIIB10Test { + @Test public void testXmlAnyElementLax() throws Exception { final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); final XmlAnyElement xmlAnyElementAnnotation = contentField .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); + Assertions.assertTrue(xmlAnyElementAnnotation.lax()); } } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB14Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB14Test.java index 1ba18a8c4..510828756 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB14Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB14Test.java @@ -1,26 +1,21 @@ package org.jvnet.jaxb.tests.issues; -import junit.framework.TestCase; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import org.junit.Assert; -import org.jvnet.jaxb.tests.issues.IssueJIIB14BaseClass; -import org.jvnet.jaxb.tests.issues.IssueJIIB14BaseInterfaceFour; -import org.jvnet.jaxb.tests.issues.IssueJIIB14BaseInterfaceOne; -import org.jvnet.jaxb.tests.issues.IssueJIIB14BaseInterfaceThree; -import org.jvnet.jaxb.tests.issues.IssueJIIB14BaseInterfaceTwo; - -public class JIIB14Test extends TestCase { +public class JIIB14Test { + @Test public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, + Assertions.assertEquals(IssueJIIB14BaseClass.class, IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class + Assertions.assertTrue(IssueJIIB14BaseInterfaceOne.class .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class + Assertions.assertTrue(IssueJIIB14BaseInterfaceTwo.class .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class + Assertions.assertTrue(IssueJIIB14BaseInterfaceThree.class .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class + Assertions.assertTrue(IssueJIIB14BaseInterfaceFour.class .isAssignableFrom(IssueJIIB14JAXBElement.class)); } } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB20Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB20Test.java index b8fabf8b7..cd03fb291 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB20Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB20Test.java @@ -1,21 +1,21 @@ package org.jvnet.jaxb.tests.issues; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + import java.util.Arrays; import java.util.List; -import junit.framework.TestCase; - -import org.junit.Assert; - -public class JIIB20Test extends TestCase { +public class JIIB20Test { + @Test public void testException() throws Exception { final List strings = Arrays.asList("a", "b", "c"); final IssueJIIB20 one = new IssueJIIB20(); one.setStrings(strings); - Assert.assertEquals(strings, one.getStrings()); - Assert.assertSame(strings, one.getStrings()); + Assertions.assertEquals(strings, one.getStrings()); + Assertions.assertSame(strings, one.getStrings()); } } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB35Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB35Test.java index 019acf983..b60b369a0 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB35Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB35Test.java @@ -2,13 +2,13 @@ import jakarta.xml.bind.JAXBContext; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.ContextUtils; -import junit.framework.TestCase; - -public class JIIB35Test extends TestCase { +public class JIIB35Test { + @Test public void testException() throws Exception { final ObjectFactory objectFactory = new ObjectFactory(); @@ -28,9 +28,9 @@ public void testException() throws Exception { four.toString(); final String delta = ContextUtils.toString(context, four); - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); + Assertions.assertEquals(alpha, beta); + Assertions.assertEquals(beta, gamma); + Assertions.assertEquals(gamma, delta); } } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB36Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB36Test.java index a4938e080..b544928fe 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB36Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB36Test.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.tests.issues; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class JIIB36Test { @@ -11,9 +11,9 @@ public void runsWithoutException() { final IssueJIIB36 one = new IssueJIIB36(); final IssueJIIB36 two = new IssueJIIB36(); - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); + Assertions.assertTrue(one.equals(two)); + Assertions.assertTrue(two.equals(one)); + Assertions.assertEquals(one.hashCode(), two.hashCode()); } } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB38Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB38Test.java index 1c660d382..ebc04f457 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB38Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB38Test.java @@ -1,17 +1,18 @@ package org.jvnet.jaxb.tests.issues; -import org.junit.Assert; -import junit.framework.TestCase; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -public class JIIB38Test extends TestCase { +public class JIIB38Test { + @Test public void testException() throws Exception { final IssueJIIB38 one = new IssueJIIB38(); final IssueJIIB38Type two = IssueJIIB38Type.A; - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); + Assertions.assertTrue(one instanceof Cloneable); + Assertions.assertTrue(two instanceof Cloneable); } } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB8Test.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB8Test.java index e28a0cad7..57d36f42e 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB8Test.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/JIIB8Test.java @@ -1,19 +1,20 @@ package org.jvnet.jaxb.tests.issues; -import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import org.junit.Assert; -import junit.framework.TestCase; +import java.util.Arrays; -public class JIIB8Test extends TestCase { +public class JIIB8Test { + @Test public void testCollectionSetters() throws Exception { final IssueJIIB8Type one = new IssueJIIB8Type(); one.setValue(Arrays.asList("1", "2", "3")); - Assert.assertEquals(3, one.getValue().size()); + Assertions.assertEquals(3, one.getValue().size()); } } diff --git a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/RunPlugins.java b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/RunPlugins.java index 41bf581e8..3da2defc6 100644 --- a/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/RunPlugins.java +++ b/jaxb-plugins-parent/tests/issues-legacy-ns/src/test/java/org/jvnet/jaxb/tests/issues/RunPlugins.java @@ -3,18 +3,17 @@ import java.io.File; import java.net.URL; -import org.junit.Before; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RunPlugins { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/CopyableTest.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/CopyableTest.java index 1c78bdc1e..a25d50feb 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/CopyableTest.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/CopyableTest.java @@ -2,7 +2,7 @@ import java.io.File; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.jvnet.jaxb.lang.CopyStrategy; import org.jvnet.jaxb.lang.EqualsStrategy; import org.jvnet.jaxb.lang.ExtendedJAXBEqualsStrategy; @@ -20,8 +20,9 @@ protected void checkSample(File sample) throws Exception { final CopyStrategy copyStrategy = new JAXBCopyStrategy(); final Object copy = copyStrategy.copy(null, original, true); final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", - equalsStrategy.equals(null, null, original, copy, true, true)); + Assertions.assertTrue( + equalsStrategy.equals(null, null, original, copy, true, true), + "Source and copy must be equal."); } } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH22Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH22Test.java index 54a248f90..9f148eb15 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH22Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH22Test.java @@ -1,20 +1,20 @@ package org.jvnet.jaxb.tests.issues; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.JAXBEqualsStrategy; public class GH22Test { @Test public void testJAXBEqualsSymmetryConcreteClassAndEnum() { - Assert.assertFalse(JAXBEqualsStrategy.getInstance().equals(null, null, + Assertions.assertFalse(JAXBEqualsStrategy.getInstance().equals(null, null, new SomeConcreteClass(), SomeEnum.ENUM)); } @Test public void testJAXBEqualsSymmetryEnumAndConcreteClass() { // This test fails and throws a ClassCastException - Assert.assertFalse(JAXBEqualsStrategy.getInstance().equals(null, null, + Assertions.assertFalse(JAXBEqualsStrategy.getInstance().equals(null, null, SomeEnum.ENUM, new SomeConcreteClass())); } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH26Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH26Test.java index 345ea5b96..7b0e1fd08 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH26Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH26Test.java @@ -3,9 +3,9 @@ import java.io.File; import java.net.URL; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.xjc.model.concrete.XJCCMInfoFactory; import org.jvnet.jaxb.xml.bind.model.MAttributePropertyInfo; import org.jvnet.jaxb.xml.bind.model.MClassInfo; @@ -24,7 +24,7 @@ public class GH26Test { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } @@ -55,33 +55,33 @@ public void compilesSchema() throws Exception { final MClassInfo classInfo = mmodel .getClassInfo("org.jvnet.jaxb.tests.issues.IssueGH26Type"); - Assert.assertNotNull(classInfo); + Assertions.assertNotNull(classInfo); final MElementPropertyInfo a = (MElementPropertyInfo) classInfo .getProperty("a"); - Assert.assertEquals("a", a.getDefaultValue()); - Assert.assertNotNull(a.getDefaultValueNamespaceContext()); + Assertions.assertEquals("a", a.getDefaultValue()); + Assertions.assertNotNull(a.getDefaultValueNamespaceContext()); final MElementsPropertyInfo bOrC = (MElementsPropertyInfo) classInfo .getProperty("bOrC"); -// Assert.assertEquals("b", bOrC.getElementTypeInfos().get(0).getDefaultValue()); - Assert.assertNotNull(bOrC.getElementTypeInfos().get(0).getDefaultValueNamespaceContext()); +// Assertions.assertEquals("b", bOrC.getElementTypeInfos().get(0).getDefaultValue()); + Assertions.assertNotNull(bOrC.getElementTypeInfos().get(0).getDefaultValueNamespaceContext()); -// Assert.assertEquals("3", bOrC.getElementTypeInfos().get(1).getDefaultValue()); - Assert.assertNotNull(bOrC.getElementTypeInfos().get(1).getDefaultValueNamespaceContext()); +// Assertions.assertEquals("3", bOrC.getElementTypeInfos().get(1).getDefaultValue()); + Assertions.assertNotNull(bOrC.getElementTypeInfos().get(1).getDefaultValueNamespaceContext()); final MElementRefsPropertyInfo dOrE = (MElementRefsPropertyInfo) classInfo .getProperty("dOrE"); -// Assert.assertEquals("e", dOrE.getElementTypeInfos().get(0).getDefaultValue()); - Assert.assertNotNull(dOrE.getElementTypeInfos().get(0).getDefaultValueNamespaceContext()); +// Assertions.assertEquals("e", dOrE.getElementTypeInfos().get(0).getDefaultValue()); + Assertions.assertNotNull(dOrE.getElementTypeInfos().get(0).getDefaultValueNamespaceContext()); -// Assert.assertEquals("d", dOrE.getElementTypeInfos().get(1).getDefaultValue()); - Assert.assertNotNull(dOrE.getElementTypeInfos().get(1).getDefaultValueNamespaceContext()); +// Assertions.assertEquals("d", dOrE.getElementTypeInfos().get(1).getDefaultValue()); + Assertions.assertNotNull(dOrE.getElementTypeInfos().get(1).getDefaultValueNamespaceContext()); final MAttributePropertyInfo z = (MAttributePropertyInfo) classInfo .getProperty("z"); - Assert.assertEquals("z", z.getDefaultValue()); - Assert.assertNotNull(z.getDefaultValueNamespaceContext()); + Assertions.assertEquals("z", z.getDefaultValue()); + Assertions.assertNotNull(z.getDefaultValueNamespaceContext()); // model.generateCode(options, receiver); // com.sun.codemodel.CodeWriter cw = options.createCodeWriter(); // model.codeModel.build(cw); diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH31Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH31Test.java index 4cc33c166..f12cc3bd4 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH31Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH31Test.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.tests.issues; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.EnumValue; import org.jvnet.jaxb.lang.JAXBToStringStrategy; import org.jvnet.jaxb.lang.ToStringStrategy; @@ -29,7 +29,7 @@ public StringBuilder append(ObjectLocator locator, } }; }; - Assert.assertEquals( + Assertions.assertEquals( "org.jvnet.jaxb.tests.issues.IssueGH31ComplexType[testEnum=Male(default)]", t.append(null, new StringBuilder(), s).toString()); } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH37Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH37Test.java index afab9246a..25ce52f56 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH37Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/GH37Test.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.tests.issues; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.JAXBToStringStrategy; import org.jvnet.jaxb.lang.ToStringStrategy; @@ -13,16 +13,16 @@ public void considersDefaultValuesInMerge() { final IssueGH37Type right = new IssueGH37Type(); final IssueGH37Type result = new IssueGH37Type(); result.mergeFrom(left, right); - Assert.assertTrue(result.isTestBoolean()); + Assertions.assertTrue(result.isTestBoolean()); } @Test public void considersDefaultValuesInCopyTo() { final IssueGH37Type original = new IssueGH37Type(); final IssueGH37Type copy = (IssueGH37Type) original.clone(); - Assert.assertTrue(copy.isTestBoolean()); - Assert.assertFalse(copy.isSetTestBoolean()); - Assert.assertEquals(original, copy); + Assertions.assertTrue(copy.isTestBoolean()); + Assertions.assertFalse(copy.isSetTestBoolean()); + Assertions.assertEquals(original, copy); } @Test @@ -34,12 +34,12 @@ public boolean isUseIdentityHashCode() { } }; IssueGH37Type a = new IssueGH37Type(); - Assert.assertEquals( + Assertions.assertEquals( "org.jvnet.jaxb.tests.issues.IssueGH37Type[testBoolean=true(default)]", a.append(null, new StringBuilder(), strategy).toString()); IssueGH37Type b = new IssueGH37Type(); b.setTestBoolean(true); - Assert.assertEquals( + Assertions.assertEquals( "org.jvnet.jaxb.tests.issues.IssueGH37Type[testBoolean=true]", b.append(null, new StringBuilder(), strategy).toString()); } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB10Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB10Test.java index 8b1f5cb45..04fa518ea 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB10Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB10Test.java @@ -3,18 +3,17 @@ import java.lang.reflect.Field; import jakarta.xml.bind.annotation.XmlAnyElement; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import junit.framework.TestCase; - -import org.junit.Assert; - -public class JIIB10Test extends TestCase { +public class JIIB10Test { + @Test public void testXmlAnyElementLax() throws Exception { final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); final XmlAnyElement xmlAnyElementAnnotation = contentField .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); + Assertions.assertTrue(xmlAnyElementAnnotation.lax()); } } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB14Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB14Test.java index 1ba18a8c4..510828756 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB14Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB14Test.java @@ -1,26 +1,21 @@ package org.jvnet.jaxb.tests.issues; -import junit.framework.TestCase; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import org.junit.Assert; -import org.jvnet.jaxb.tests.issues.IssueJIIB14BaseClass; -import org.jvnet.jaxb.tests.issues.IssueJIIB14BaseInterfaceFour; -import org.jvnet.jaxb.tests.issues.IssueJIIB14BaseInterfaceOne; -import org.jvnet.jaxb.tests.issues.IssueJIIB14BaseInterfaceThree; -import org.jvnet.jaxb.tests.issues.IssueJIIB14BaseInterfaceTwo; - -public class JIIB14Test extends TestCase { +public class JIIB14Test { + @Test public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, + Assertions.assertEquals(IssueJIIB14BaseClass.class, IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class + Assertions.assertTrue(IssueJIIB14BaseInterfaceOne.class .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class + Assertions.assertTrue(IssueJIIB14BaseInterfaceTwo.class .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class + Assertions.assertTrue(IssueJIIB14BaseInterfaceThree.class .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class + Assertions.assertTrue(IssueJIIB14BaseInterfaceFour.class .isAssignableFrom(IssueJIIB14JAXBElement.class)); } } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB20Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB20Test.java index b8fabf8b7..cd03fb291 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB20Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB20Test.java @@ -1,21 +1,21 @@ package org.jvnet.jaxb.tests.issues; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + import java.util.Arrays; import java.util.List; -import junit.framework.TestCase; - -import org.junit.Assert; - -public class JIIB20Test extends TestCase { +public class JIIB20Test { + @Test public void testException() throws Exception { final List strings = Arrays.asList("a", "b", "c"); final IssueJIIB20 one = new IssueJIIB20(); one.setStrings(strings); - Assert.assertEquals(strings, one.getStrings()); - Assert.assertSame(strings, one.getStrings()); + Assertions.assertEquals(strings, one.getStrings()); + Assertions.assertSame(strings, one.getStrings()); } } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB35Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB35Test.java index 019acf983..b60b369a0 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB35Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB35Test.java @@ -2,13 +2,13 @@ import jakarta.xml.bind.JAXBContext; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.lang.ContextUtils; -import junit.framework.TestCase; - -public class JIIB35Test extends TestCase { +public class JIIB35Test { + @Test public void testException() throws Exception { final ObjectFactory objectFactory = new ObjectFactory(); @@ -28,9 +28,9 @@ public void testException() throws Exception { four.toString(); final String delta = ContextUtils.toString(context, four); - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); + Assertions.assertEquals(alpha, beta); + Assertions.assertEquals(beta, gamma); + Assertions.assertEquals(gamma, delta); } } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB36Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB36Test.java index a4938e080..b544928fe 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB36Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB36Test.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.tests.issues; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class JIIB36Test { @@ -11,9 +11,9 @@ public void runsWithoutException() { final IssueJIIB36 one = new IssueJIIB36(); final IssueJIIB36 two = new IssueJIIB36(); - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); + Assertions.assertTrue(one.equals(two)); + Assertions.assertTrue(two.equals(one)); + Assertions.assertEquals(one.hashCode(), two.hashCode()); } } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB38Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB38Test.java index 1c660d382..ebc04f457 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB38Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB38Test.java @@ -1,17 +1,18 @@ package org.jvnet.jaxb.tests.issues; -import org.junit.Assert; -import junit.framework.TestCase; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -public class JIIB38Test extends TestCase { +public class JIIB38Test { + @Test public void testException() throws Exception { final IssueJIIB38 one = new IssueJIIB38(); final IssueJIIB38Type two = IssueJIIB38Type.A; - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); + Assertions.assertTrue(one instanceof Cloneable); + Assertions.assertTrue(two instanceof Cloneable); } } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB8Test.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB8Test.java index e28a0cad7..57d36f42e 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB8Test.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/JIIB8Test.java @@ -1,19 +1,20 @@ package org.jvnet.jaxb.tests.issues; -import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import org.junit.Assert; -import junit.framework.TestCase; +import java.util.Arrays; -public class JIIB8Test extends TestCase { +public class JIIB8Test { + @Test public void testCollectionSetters() throws Exception { final IssueJIIB8Type one = new IssueJIIB8Type(); one.setValue(Arrays.asList("1", "2", "3")); - Assert.assertEquals(3, one.getValue().size()); + Assertions.assertEquals(3, one.getValue().size()); } } diff --git a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/RunPlugins.java b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/RunPlugins.java index 41bf581e8..3da2defc6 100644 --- a/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/RunPlugins.java +++ b/jaxb-plugins-parent/tests/issues/src/test/java/org/jvnet/jaxb/tests/issues/RunPlugins.java @@ -3,18 +3,17 @@ import java.io.File; import java.net.URL; -import org.junit.Before; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RunPlugins { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } diff --git a/jaxb-plugins-parent/tests/map_init/src/test/java/org/jvnet/jaxb/tests/mapinit/EmployeeDefinedTest.java b/jaxb-plugins-parent/tests/map_init/src/test/java/org/jvnet/jaxb/tests/mapinit/EmployeeDefinedTest.java index 9db64c75c..e3499c618 100644 --- a/jaxb-plugins-parent/tests/map_init/src/test/java/org/jvnet/jaxb/tests/mapinit/EmployeeDefinedTest.java +++ b/jaxb-plugins-parent/tests/map_init/src/test/java/org/jvnet/jaxb/tests/mapinit/EmployeeDefinedTest.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.tests.mapinit; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.example.defined.Employee; import java.util.ArrayList; @@ -13,13 +13,13 @@ public class EmployeeDefinedTest { @Test public void testEmployee() { Employee a = new Employee(); - Assert.assertNotNull(a.getDataMap()); - Assert.assertTrue(a.getDataMap() instanceof TreeMap); - Assert.assertNotNull(a.getWeakDataMap()); - Assert.assertTrue(a.getWeakDataMap() instanceof WeakHashMap); - Assert.assertNull(a.getIgnoredDataMap()); - Assert.assertNull(a.getValue()); - Assert.assertNotNull(a.getListValue()); - Assert.assertTrue(a.getListValue() instanceof ArrayList); + Assertions.assertNotNull(a.getDataMap()); + Assertions.assertTrue(a.getDataMap() instanceof TreeMap); + Assertions.assertNotNull(a.getWeakDataMap()); + Assertions.assertTrue(a.getWeakDataMap() instanceof WeakHashMap); + Assertions.assertNull(a.getIgnoredDataMap()); + Assertions.assertNull(a.getValue()); + Assertions.assertNotNull(a.getListValue()); + Assertions.assertTrue(a.getListValue() instanceof ArrayList); } } diff --git a/jaxb-plugins-parent/tests/map_init/src/test/java/org/jvnet/jaxb/tests/mapinit/EmployeeUndefinedTest.java b/jaxb-plugins-parent/tests/map_init/src/test/java/org/jvnet/jaxb/tests/mapinit/EmployeeUndefinedTest.java index 9c72c8452..b5d36b1f3 100644 --- a/jaxb-plugins-parent/tests/map_init/src/test/java/org/jvnet/jaxb/tests/mapinit/EmployeeUndefinedTest.java +++ b/jaxb-plugins-parent/tests/map_init/src/test/java/org/jvnet/jaxb/tests/mapinit/EmployeeUndefinedTest.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.tests.mapinit; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.example.undefined.Employee; import java.util.ArrayList; @@ -13,13 +13,13 @@ public class EmployeeUndefinedTest { @Test public void testEmployee() { Employee a = new Employee(); - Assert.assertNotNull(a.getDataMap()); - Assert.assertTrue(a.getDataMap() instanceof HashMap); - Assert.assertNotNull(a.getWeakDataMap()); - Assert.assertTrue(a.getWeakDataMap() instanceof WeakHashMap); - Assert.assertNull(a.getIgnoredDataMap()); - Assert.assertNull(a.getValue()); - Assert.assertNotNull(a.getListValue()); - Assert.assertTrue(a.getListValue() instanceof ArrayList); + Assertions.assertNotNull(a.getDataMap()); + Assertions.assertTrue(a.getDataMap() instanceof HashMap); + Assertions.assertNotNull(a.getWeakDataMap()); + Assertions.assertTrue(a.getWeakDataMap() instanceof WeakHashMap); + Assertions.assertNull(a.getIgnoredDataMap()); + Assertions.assertNull(a.getValue()); + Assertions.assertNotNull(a.getListValue()); + Assertions.assertTrue(a.getListValue() instanceof ArrayList); } } diff --git a/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/ATest.java b/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/ATest.java index 917cc4366..fe9ee547b 100644 --- a/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/ATest.java +++ b/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/ATest.java @@ -2,8 +2,8 @@ import jakarta.xml.bind.annotation.XmlNs; import jakarta.xml.bind.annotation.XmlSchema; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.test.namespace.a.AType; public class ATest { @@ -13,9 +13,9 @@ public void testA() { AType a = new AType(); XmlSchema schema = a.getClass().getPackage().getAnnotation(XmlSchema.class); XmlNs[] namespaces = schema.xmlns(); - Assert.assertNotNull(namespaces); - Assert.assertEquals(1, namespaces.length); - Assert.assertEquals("a", namespaces[0].namespaceURI()); - Assert.assertEquals("a", namespaces[0].prefix()); + Assertions.assertNotNull(namespaces); + Assertions.assertEquals(1, namespaces.length); + Assertions.assertEquals("a", namespaces[0].namespaceURI()); + Assertions.assertEquals("a", namespaces[0].prefix()); } } diff --git a/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/BTest.java b/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/BTest.java index ca502d0e8..ef9d20da2 100644 --- a/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/BTest.java +++ b/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/BTest.java @@ -2,8 +2,8 @@ import jakarta.xml.bind.annotation.XmlNs; import jakarta.xml.bind.annotation.XmlSchema; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.test.namespace.b.BType; import java.util.Arrays; @@ -15,15 +15,15 @@ public void testB() { BType b = new BType(); XmlSchema schema = b.getClass().getPackage().getAnnotation(XmlSchema.class); XmlNs[] namespaces = schema.xmlns(); - Assert.assertNotNull(namespaces); - Assert.assertEquals(2, namespaces.length); + Assertions.assertNotNull(namespaces); + Assertions.assertEquals(2, namespaces.length); XmlNs aNs = Arrays.stream(namespaces).filter(ns -> "aprefix".equals(ns.prefix())).findFirst().orElse(null); - Assert.assertNotNull(aNs); - Assert.assertEquals("a", aNs.namespaceURI()); - Assert.assertEquals("aprefix", aNs.prefix()); + Assertions.assertNotNull(aNs); + Assertions.assertEquals("a", aNs.namespaceURI()); + Assertions.assertEquals("aprefix", aNs.prefix()); XmlNs bNs = Arrays.stream(namespaces).filter(ns -> "b".equals(ns.prefix())).findFirst().orElse(null); - Assert.assertNotNull(bNs); - Assert.assertEquals("b", bNs.namespaceURI()); - Assert.assertEquals("b", bNs.prefix()); + Assertions.assertNotNull(bNs); + Assertions.assertEquals("b", bNs.namespaceURI()); + Assertions.assertEquals("b", bNs.prefix()); } } diff --git a/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/CTest.java b/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/CTest.java index 1c9ebfd08..9136b4091 100644 --- a/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/CTest.java +++ b/jaxb-plugins-parent/tests/namespace/src/test/java/org/jvnet/jaxb/tests/namespace/CTest.java @@ -5,8 +5,8 @@ import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.annotation.XmlNs; import jakarta.xml.bind.annotation.XmlSchema; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.test.namespace.a.A1Type; import org.jvnet.jaxb.test.namespace.c.C1Type; import org.jvnet.jaxb.test.namespace.c.CType; @@ -22,19 +22,19 @@ public void testC() throws JAXBException { CType c = new CType(); XmlSchema schema = c.getClass().getPackage().getAnnotation(XmlSchema.class); XmlNs[] namespaces = schema.xmlns(); - Assert.assertEquals(3, namespaces.length); + Assertions.assertEquals(3, namespaces.length); XmlNs aNs = Arrays.stream(namespaces).filter(ns -> "aprefix".equals(ns.prefix())).findFirst().orElse(null); - Assert.assertNotNull(aNs); - Assert.assertEquals("a", aNs.namespaceURI()); - Assert.assertEquals("aprefix", aNs.prefix()); + Assertions.assertNotNull(aNs); + Assertions.assertEquals("a", aNs.namespaceURI()); + Assertions.assertEquals("aprefix", aNs.prefix()); XmlNs bNs = Arrays.stream(namespaces).filter(ns -> "bprefix".equals(ns.prefix())).findFirst().orElse(null); - Assert.assertNotNull(bNs); - Assert.assertEquals("b", bNs.namespaceURI()); - Assert.assertEquals("bprefix", bNs.prefix()); + Assertions.assertNotNull(bNs); + Assertions.assertEquals("b", bNs.namespaceURI()); + Assertions.assertEquals("bprefix", bNs.prefix()); XmlNs cNs = Arrays.stream(namespaces).filter(ns -> "creal".equals(ns.prefix())).findFirst().orElse(null); - Assert.assertNotNull(cNs); - Assert.assertEquals("c", cNs.namespaceURI()); - Assert.assertEquals("creal", cNs.prefix()); + Assertions.assertNotNull(cNs); + Assertions.assertEquals("c", cNs.namespaceURI()); + Assertions.assertEquals("creal", cNs.prefix()); c.setA(new A1Type()); c.setC(new C1Type()); @@ -46,12 +46,12 @@ public void testC() throws JAXBException { context.createMarshaller().marshal(jaxbElement, writer); String marshalled = writer.toString(); - Assert.assertNotNull(marshalled); + Assertions.assertNotNull(marshalled); String expectedA = "xmlns:aprefix=\"a\""; - Assert.assertTrue(marshalled.contains(expectedA)); + Assertions.assertTrue(marshalled.contains(expectedA)); String expectedB = "xmlns:bprefix=\"b\""; - Assert.assertTrue(marshalled.contains(expectedB)); + Assertions.assertTrue(marshalled.contains(expectedB)); String expectedC = "xmlns:creal=\"c\""; - Assert.assertTrue(marshalled.contains(expectedC)); + Assertions.assertTrue(marshalled.contains(expectedC)); } } diff --git a/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java index 8eaf776e0..89c7a0386 100644 --- a/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ b/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java @@ -2,7 +2,7 @@ import java.io.File; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.jvnet.jaxb.lang.JAXBCopyStrategy; import org.jvnet.jaxb.lang.JAXBEqualsStrategy; import org.jvnet.jaxb.test.AbstractSamplesTest; @@ -15,8 +15,9 @@ protected void checkSample(File sample) throws Exception { final Object original = createContext().createUnmarshaller().unmarshal( sample); final Object copy = JAXBCopyStrategy.getInstance().copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); + Assertions.assertTrue( + JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy), + "Source and copy must be equal."); } } diff --git a/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java index 639c1591a..21b38561b 100644 --- a/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ b/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java @@ -2,6 +2,7 @@ import java.io.File; +import org.junit.jupiter.api.Assertions; import org.jvnet.jaxb.lang.JAXBEqualsStrategy; import org.jvnet.jaxb.test.AbstractSamplesTest; @@ -14,7 +15,8 @@ protected void checkSample(File sample) throws Exception { sample); final Object rhs = createContext().createUnmarshaller().unmarshal( sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.getInstance().equals( - null, null, lhs, rhs)); + Assertions.assertTrue( + JAXBEqualsStrategy.getInstance().equals(null, null, lhs, rhs), + "Values must be equal."); } } diff --git a/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java index 9e1cff3b5..5c208a7f7 100644 --- a/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ b/jaxb-plugins-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java @@ -2,6 +2,7 @@ import java.io.File; +import org.junit.jupiter.api.Assertions; import org.jvnet.jaxb.lang.JAXBCopyStrategy; import org.jvnet.jaxb.lang.JAXBHashCodeStrategy; import org.jvnet.jaxb.test.AbstractSamplesTest; @@ -22,7 +23,7 @@ protected void checkSample(File sample) throws Exception { 0, rhs); final int copyHashCode = JAXBHashCodeStrategy.getInstance().hashCode(null, 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); + Assertions.assertEquals(leftHashCode, rightHashCode, "Values must be equal."); + Assertions.assertEquals(leftHashCode, copyHashCode, "Values must be equal."); } } diff --git a/jaxb-plugins-parent/tests/parentpointer/src/test/java/org/jvnet/jaxb/tests/parentpointer/AddressTest.java b/jaxb-plugins-parent/tests/parentpointer/src/test/java/org/jvnet/jaxb/tests/parentpointer/AddressTest.java index 096a655f9..0c184c192 100644 --- a/jaxb-plugins-parent/tests/parentpointer/src/test/java/org/jvnet/jaxb/tests/parentpointer/AddressTest.java +++ b/jaxb-plugins-parent/tests/parentpointer/src/test/java/org/jvnet/jaxb/tests/parentpointer/AddressTest.java @@ -1,10 +1,9 @@ package org.jvnet.jaxb.tests.parentpointer; -import generated.Person; -import org.junit.Assert; -import org.junit.Test; - import generated.Address; +import generated.Person; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class AddressTest { @@ -12,6 +11,6 @@ public class AddressTest { public void testAddress() { Address a = new Address(); a.setParent(new Person()); - Assert.assertNotNull(a.getParent()); + Assertions.assertNotNull(a.getParent()); } } diff --git a/jaxb-plugins-parent/tests/propertylistenerinjector/src/test/java/org/jvnet/jaxb/tests/propertylistenerinjector/AddressTest.java b/jaxb-plugins-parent/tests/propertylistenerinjector/src/test/java/org/jvnet/jaxb/tests/propertylistenerinjector/AddressTest.java index 624ac701e..0178816d7 100644 --- a/jaxb-plugins-parent/tests/propertylistenerinjector/src/test/java/org/jvnet/jaxb/tests/propertylistenerinjector/AddressTest.java +++ b/jaxb-plugins-parent/tests/propertylistenerinjector/src/test/java/org/jvnet/jaxb/tests/propertylistenerinjector/AddressTest.java @@ -1,8 +1,7 @@ package org.jvnet.jaxb.tests.propertylistenerinjector; -import org.junit.Test; - import generated.Address; +import org.junit.jupiter.api.Test; public class AddressTest { diff --git a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/PrimitivesTest.java b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/PrimitivesTest.java index 519b55b21..549246ce3 100644 --- a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/PrimitivesTest.java +++ b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/PrimitivesTest.java @@ -1,13 +1,13 @@ package org.jvnet.jaxb2_commons.tests.simple_hashcode_equals_01.cases; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class PrimitivesTest { @Test public void equalsPrimitives() { - Assert.assertEquals(new Primitives(), new Primitives()); + Assertions.assertEquals(new Primitives(), new Primitives()); } } diff --git a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/RunPluginsForCases.java b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/RunPluginsForCases.java index ccf64bd77..776f3d9b0 100644 --- a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/RunPluginsForCases.java +++ b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/RunPluginsForCases.java @@ -3,18 +3,17 @@ import java.io.File; import java.net.URL; -import org.junit.Before; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RunPluginsForCases { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } diff --git a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/UnboxedPrimitivesTest.java b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/UnboxedPrimitivesTest.java index aaa3169b7..d7dc2e2ab 100644 --- a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/UnboxedPrimitivesTest.java +++ b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/cases/UnboxedPrimitivesTest.java @@ -1,13 +1,13 @@ package org.jvnet.jaxb2_commons.tests.simple_hashcode_equals_01.cases; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class UnboxedPrimitivesTest { - @Test - public void equalsPrimitives() { - Assert.assertEquals(new UnboxedPrimitives(), new UnboxedPrimitives()); - } + @Test + public void equalsPrimitives() { + Assertions.assertEquals(new UnboxedPrimitives(), new UnboxedPrimitives()); + } } diff --git a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/customer/CustomerTest.java b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/customer/CustomerTest.java index 1a502d438..3103cfe62 100644 --- a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/customer/CustomerTest.java +++ b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/customer/CustomerTest.java @@ -1,18 +1,17 @@ package org.jvnet.jaxb2_commons.tests.simple_hashcode_equals_01.customer; -import static org.junit.Assert.assertEquals; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class CustomerTest { - @Before + @BeforeEach public void setUp() throws Exception { } - @After + @AfterEach public void tearDown() throws Exception { } @@ -36,7 +35,7 @@ public void test() { jaxb2.setPostCode(eclipse.getPostCode()); jaxb2.setSingle(eclipse.isSingle()); - assertEquals(eclipse.hashCode(), jaxb2.hashCode()); + Assertions.assertEquals(eclipse.hashCode(), jaxb2.hashCode()); } } diff --git a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/customer/RunPluginsForCustomer.java b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/customer/RunPluginsForCustomer.java index 386485fae..247dc68f2 100644 --- a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/customer/RunPluginsForCustomer.java +++ b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/customer/RunPluginsForCustomer.java @@ -3,18 +3,17 @@ import java.io.File; import java.net.URL; -import org.junit.Before; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RunPluginsForCustomer { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } diff --git a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/main/RunPluginsForMain.java b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/main/RunPluginsForMain.java index 5674425ff..cba4a5c4e 100644 --- a/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/main/RunPluginsForMain.java +++ b/jaxb-plugins-parent/tests/simple-hashCode-equals-01/src/test/java/org/jvnet/jaxb2_commons/tests/simple_hashcode_equals_01/main/RunPluginsForMain.java @@ -3,18 +3,17 @@ import java.io.File; import java.net.URL; -import org.junit.Before; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RunPluginsForMain { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } diff --git a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh18Test.java b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh18Test.java index 6d3894923..bba59bee3 100644 --- a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh18Test.java +++ b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh18Test.java @@ -1,6 +1,6 @@ package org.jvnet.jaxb.plugin.simplify.tests01; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Gh18Test { diff --git a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh1Test.java b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh1Test.java index 33301bfa4..fd7651575 100644 --- a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh1Test.java +++ b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh1Test.java @@ -5,10 +5,10 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; -import javax.xml.namespace.QName; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import org.junit.Assert; -import org.junit.Test; +import javax.xml.namespace.QName; public class Gh1Test { @@ -39,6 +39,6 @@ public void contextIsSuccessfullyCreated() throws JAXBException { new JAXBElement(new QName("test"), Gh1.class, value), System.out); context.createMarshaller().marshal( new JAXBElement(new QName("test"), Gh1.class, value), sw); - Assert.assertTrue(sw.toString().contains("Test")); + Assertions.assertTrue(sw.toString().contains("Test")); } } diff --git a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh2Test.java b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh2Test.java index 732743e72..7349c4666 100644 --- a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh2Test.java +++ b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh2Test.java @@ -1,11 +1,11 @@ package org.jvnet.jaxb.plugin.simplify.tests01; +import org.junit.jupiter.api.Test; + import java.util.Date; import javax.xml.datatype.Duration; -import org.junit.Test; - public class Gh2Test { @Test diff --git a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh4Test.java b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh4Test.java index 19e6d8b80..918ae5a9b 100644 --- a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh4Test.java +++ b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh4Test.java @@ -2,16 +2,15 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class Gh4Test { private JAXBContext context; - @Before + @BeforeEach public void setUp() throws Exception { context = JAXBContext.newInstance(getClass().getPackage().getName()); } @@ -37,7 +36,7 @@ public void unmarshalls() throws Exception { "simplifyReferencesPropertyAsElementProperty.xml"))) .getValue(); - Assert.assertEquals(3, value.getBases().size()); - Assert.assertEquals(3, value.getBaseElements().size()); + Assertions.assertEquals(3, value.getBases().size()); + Assertions.assertEquals(3, value.getBaseElements().size()); } } diff --git a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh5Test.java b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh5Test.java index 3fc82d9b5..cc97d922b 100644 --- a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh5Test.java +++ b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh5Test.java @@ -2,16 +2,15 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class Gh5Test { private JAXBContext context; - @Before + @BeforeEach public void setUp() throws Exception { context = JAXBContext.newInstance(getClass().getPackage().getName()); } @@ -37,7 +36,7 @@ public void unmarshalls() throws Exception { "simplifyReferencesPropertyAsReferenceProperty.xml"))) .getValue(); - Assert.assertEquals(3, value.getBases().size()); - Assert.assertEquals(3, value.getBaseElements().size()); + Assertions.assertEquals(3, value.getBases().size()); + Assertions.assertEquals(3, value.getBaseElements().size()); } } diff --git a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh6Test.java b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh6Test.java index 2428c074a..8be28dc0c 100644 --- a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh6Test.java +++ b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/Gh6Test.java @@ -2,16 +2,15 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class Gh6Test { private JAXBContext context; - @Before + @BeforeEach public void setUp() throws Exception { context = JAXBContext.newInstance(getClass().getPackage().getName()); } @@ -33,7 +32,7 @@ public void testElementsPropertyAsElementPropertyType() throws Exception { getClass().getResourceAsStream("simplifyElementsPropertyAsElementProperty.xml"))) .getValue(); - Assert.assertEquals(3, value.getStrings().size()); - Assert.assertEquals(3, value.getInts().size()); + Assertions.assertEquals(3, value.getStrings().size()); + Assertions.assertEquals(3, value.getInts().size()); } } diff --git a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/RunSimplifyPlugin.java b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/RunSimplifyPlugin.java index 8eb495262..71e6ccc4f 100644 --- a/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/RunSimplifyPlugin.java +++ b/jaxb-plugins-parent/tests/simplify-01/src/test/java/org/jvnet/jaxb/plugin/simplify/tests01/RunSimplifyPlugin.java @@ -3,18 +3,17 @@ import java.io.File; import java.net.URL; -import org.junit.Before; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RunSimplifyPlugin { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } diff --git a/jaxb-plugins-parent/tests/simplify-02/src/test/java/org/jvnet/jaxb2_commons/plugin/simplify/tests02/RunSimplifyPlugin.java b/jaxb-plugins-parent/tests/simplify-02/src/test/java/org/jvnet/jaxb2_commons/plugin/simplify/tests02/RunSimplifyPlugin.java index 1d7070800..c878a7622 100644 --- a/jaxb-plugins-parent/tests/simplify-02/src/test/java/org/jvnet/jaxb2_commons/plugin/simplify/tests02/RunSimplifyPlugin.java +++ b/jaxb-plugins-parent/tests/simplify-02/src/test/java/org/jvnet/jaxb2_commons/plugin/simplify/tests02/RunSimplifyPlugin.java @@ -3,18 +3,17 @@ import java.io.File; import java.net.URL; -import org.junit.Before; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RunSimplifyPlugin { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } diff --git a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh18Test.java b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh18Test.java index f975912ab..84ce03682 100644 --- a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh18Test.java +++ b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh18Test.java @@ -1,6 +1,6 @@ package org.jvnet.jaxb.plugin.simplify.tests03; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Gh18Test { diff --git a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh1Test.java b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh1Test.java index cce94afe2..eae3a0dec 100644 --- a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh1Test.java +++ b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh1Test.java @@ -5,10 +5,10 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; -import javax.xml.namespace.QName; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import org.junit.Assert; -import org.junit.Test; +import javax.xml.namespace.QName; public class Gh1Test { @@ -37,6 +37,6 @@ public void contextIsSuccessfullyCreated() throws JAXBException { new JAXBElement(new QName("test"), Gh1.class, value), System.out); context.createMarshaller().marshal( new JAXBElement(new QName("test"), Gh1.class, value), sw); - Assert.assertTrue(sw.toString().contains("Test")); + Assertions.assertTrue(sw.toString().contains("Test")); } } diff --git a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh2Test.java b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh2Test.java index 9af76177f..284c9e570 100644 --- a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh2Test.java +++ b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh2Test.java @@ -1,11 +1,11 @@ package org.jvnet.jaxb.plugin.simplify.tests03; +import org.junit.jupiter.api.Test; + import java.util.Date; import javax.xml.datatype.Duration; -import org.junit.Test; - public class Gh2Test { @Test diff --git a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh4Test.java b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh4Test.java index 39bbde739..023582a7d 100644 --- a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh4Test.java +++ b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh4Test.java @@ -2,16 +2,15 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class Gh4Test { private JAXBContext context; - @Before + @BeforeEach public void setUp() throws Exception { context = JAXBContext.newInstance(getClass().getPackage().getName()); } @@ -37,7 +36,7 @@ public void unmarshalls() throws Exception { "simplifyReferencesPropertyAsElementProperty.xml"))) .getValue(); - Assert.assertEquals(3, value.getBasesLength()); - Assert.assertEquals(3, value.getBaseElementsLength()); + Assertions.assertEquals(3, value.getBasesLength()); + Assertions.assertEquals(3, value.getBaseElementsLength()); } } diff --git a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh5Test.java b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh5Test.java index c691a0347..43f6845c5 100644 --- a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh5Test.java +++ b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh5Test.java @@ -2,16 +2,15 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class Gh5Test { private JAXBContext context; - @Before + @BeforeEach public void setUp() throws Exception { context = JAXBContext.newInstance(getClass().getPackage().getName()); } @@ -37,7 +36,7 @@ public void unmarshalls() throws Exception { "simplifyReferencesPropertyAsReferenceProperty.xml"))) .getValue(); - Assert.assertEquals(3, value.getBasesLength()); - Assert.assertEquals(3, value.getBaseElementsLength()); + Assertions.assertEquals(3, value.getBasesLength()); + Assertions.assertEquals(3, value.getBaseElementsLength()); } } diff --git a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh6Test.java b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh6Test.java index bd26ff65f..59a4d0820 100644 --- a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh6Test.java +++ b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/Gh6Test.java @@ -2,16 +2,15 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class Gh6Test { private JAXBContext context; - @Before + @BeforeEach public void setUp() throws Exception { context = JAXBContext.newInstance(getClass().getPackage().getName()); } @@ -33,7 +32,7 @@ public void testElementsPropertyAsElementPropertyType() throws Exception { getClass().getResourceAsStream("simplifyElementsPropertyAsElementProperty.xml"))) .getValue(); - Assert.assertEquals(3, value.getStringsLength()); - Assert.assertEquals(3, value.getIntsLength()); + Assertions.assertEquals(3, value.getStringsLength()); + Assertions.assertEquals(3, value.getIntsLength()); } } diff --git a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/RunSimplifyPlugin.java b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/RunSimplifyPlugin.java index 92301152d..a64100468 100644 --- a/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/RunSimplifyPlugin.java +++ b/jaxb-plugins-parent/tests/simplify-03/src/test/java/org/jvnet/jaxb/plugin/simplify/tests03/RunSimplifyPlugin.java @@ -3,18 +3,17 @@ import java.io.File; import java.net.URL; -import org.junit.Before; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RunSimplifyPlugin { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } diff --git a/jaxb-plugins-parent/tests/superclass/b/src/test/java/org/jvnet/jaxb/test/superclass/b/tests/CopyToTest.java b/jaxb-plugins-parent/tests/superclass/b/src/test/java/org/jvnet/jaxb/test/superclass/b/tests/CopyToTest.java index 12753bccf..048392552 100644 --- a/jaxb-plugins-parent/tests/superclass/b/src/test/java/org/jvnet/jaxb/test/superclass/b/tests/CopyToTest.java +++ b/jaxb-plugins-parent/tests/superclass/b/src/test/java/org/jvnet/jaxb/test/superclass/b/tests/CopyToTest.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.test.superclass.b.tests; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.test.superclass.b.AnotherObjectType; public class CopyToTest { @@ -12,9 +12,9 @@ public void correctlyCopies() { source.setId("Id"); source.setData("Data"); final AnotherObjectType target = (AnotherObjectType) source.clone(); - Assert.assertEquals("Id", target.getId()); - Assert.assertEquals("Data", target.getData()); - Assert.assertEquals(source, target); - Assert.assertEquals(source.hashCode(), target.hashCode()); + Assertions.assertEquals("Id", target.getId()); + Assertions.assertEquals("Data", target.getData()); + Assertions.assertEquals(source, target); + Assertions.assertEquals(source.hashCode(), target.hashCode()); } } diff --git a/jaxb-plugins-parent/tests/superclass/b/src/test/java/org/jvnet/jaxb/test/superclass/b/tests/RunPlugins.java b/jaxb-plugins-parent/tests/superclass/b/src/test/java/org/jvnet/jaxb/test/superclass/b/tests/RunPlugins.java index a4ccb5edd..f7abd6ea3 100644 --- a/jaxb-plugins-parent/tests/superclass/b/src/test/java/org/jvnet/jaxb/test/superclass/b/tests/RunPlugins.java +++ b/jaxb-plugins-parent/tests/superclass/b/src/test/java/org/jvnet/jaxb/test/superclass/b/tests/RunPlugins.java @@ -3,18 +3,17 @@ import java.io.File; import java.net.URL; -import org.junit.Before; -import org.junit.Test; - import com.sun.codemodel.JCodeModel; import com.sun.tools.xjc.ConsoleErrorReporter; import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RunPlugins { - @Before + @BeforeEach public void setUp() { System.setProperty("javax.xml.accessExternalSchema", "all"); } diff --git a/jaxb-plugins-parent/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/jaxb-plugins-parent/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java index b597484fb..60f84ae5a 100644 --- a/jaxb-plugins-parent/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ b/jaxb-plugins-parent/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java @@ -2,6 +2,7 @@ import java.io.File; +import org.junit.jupiter.api.Assertions; import org.jvnet.jaxb.lang.JAXBEqualsStrategy; import org.jvnet.jaxb.test.AbstractSamplesTest; @@ -16,6 +17,8 @@ public String getContextPath() { protected void checkSample(File sample) throws Exception { final Object lhs = createContext().createUnmarshaller().unmarshal(sample); final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.getInstance().equals(null, null, lhs, rhs)); + Assertions.assertTrue( + JAXBEqualsStrategy.getInstance().equals(null, null, lhs, rhs), + "Values must be equal."); } } diff --git a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/RawXJCMojoTest.java b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/RawXJCMojoTest.java index eee0137c3..d003ecfc6 100644 --- a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/RawXJCMojoTest.java +++ b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/RawXJCMojoTest.java @@ -4,10 +4,10 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.testing.stubs.ArtifactStub; import org.apache.maven.project.MavenProject; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import java.io.ByteArrayOutputStream; import java.io.File; @@ -22,18 +22,16 @@ import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; -import static org.junit.Assert.assertEquals; - public class RawXJCMojoTest { - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); + @TempDir + public File temporaryFolder; private File testJarFile; - @Before + @BeforeEach public void createJarFile() throws Exception { - testJarFile = temporaryFolder.newFile("test.jar"); + testJarFile = new File(temporaryFolder, "test.jar"); try (JarOutputStream out = new JarOutputStream(new FileOutputStream(testJarFile))) { out.putNextEntry(new JarEntry("dir/")); out.closeEntry(); @@ -95,11 +93,11 @@ public void doExecute(Void options) throws MojoExecutionException { mojo.collectBindingUrisFromDependencies(bindings); - assertEquals(2, bindings.size()); - assertEquals(URI.create("jar:" + testJarFile.toURI() + "!/dir/nested.xjb"), bindings.get(0)); - assertEquals(URI.create("jar:" + testJarFile.toURI() + "!/root.xjb"), bindings.get(1)); - assertEquals("nested binding", readContent(bindings.get(0))); - assertEquals("root binding", readContent(bindings.get(1))); + Assertions.assertEquals(2, bindings.size()); + Assertions.assertEquals(URI.create("jar:" + testJarFile.toURI() + "!/dir/nested.xjb"), bindings.get(0)); + Assertions.assertEquals(URI.create("jar:" + testJarFile.toURI() + "!/root.xjb"), bindings.get(1)); + Assertions.assertEquals("nested binding", readContent(bindings.get(0))); + Assertions.assertEquals("root binding", readContent(bindings.get(1))); } @Test @@ -121,11 +119,11 @@ public void doExecute(Void options) throws MojoExecutionException { mojo.collectBindingUrisFromArtifact(testJarFile, bindings); - assertEquals(2, bindings.size()); - assertEquals(URI.create("jar:" + testJarFile.toURI() + "!/dir/nested.xjb"), bindings.get(0)); - assertEquals(URI.create("jar:" + testJarFile.toURI() + "!/root.xjb"), bindings.get(1)); - assertEquals("nested binding", readContent(bindings.get(0))); - assertEquals("root binding", readContent(bindings.get(1))); + Assertions.assertEquals(2, bindings.size()); + Assertions.assertEquals(URI.create("jar:" + testJarFile.toURI() + "!/dir/nested.xjb"), bindings.get(0)); + Assertions.assertEquals(URI.create("jar:" + testJarFile.toURI() + "!/root.xjb"), bindings.get(1)); + Assertions.assertEquals("nested binding", readContent(bindings.get(0))); + Assertions.assertEquals("root binding", readContent(bindings.get(1))); } private String readContent(URI uri) throws Exception { diff --git a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/net/tests/URILastModifiedResolverTest.java b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/net/tests/URILastModifiedResolverTest.java index 4b447647e..d77983c0c 100644 --- a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/net/tests/URILastModifiedResolverTest.java +++ b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/net/tests/URILastModifiedResolverTest.java @@ -6,8 +6,8 @@ import java.net.URISyntaxException; import org.apache.maven.plugin.logging.SystemStreamLog; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.maven.net.CompositeURILastModifiedResolver; import org.jvnet.jaxb.maven.net.JarURILastModifiedResolver; import org.jvnet.jaxb.maven.net.URILastModifiedResolver; @@ -28,17 +28,17 @@ public void getsFileURIFromJarFileURICorrectly() throws URISyntaxException, final URI fileURI = getClass().getResource( getClass().getSimpleName() + ".class").toURI(); - Assert.assertNotNull(resolver.getLastModified(jarURI)); - Assert.assertNotNull(resolver.getLastModified(partJarURI)); - Assert.assertNotNull(resolver.getLastModified(fileURI)); + Assertions.assertNotNull(resolver.getLastModified(jarURI)); + Assertions.assertNotNull(resolver.getLastModified(partJarURI)); + Assertions.assertNotNull(resolver.getLastModified(fileURI)); // Switch to true to tests HTTP/HTTPs boolean online = false; if (online) { final URI httpsURI = new URI("https://ya.ru/"); final URI httpURI = new URI("http://schemas.opengis.net/ogc_schema_updates.rss"); - Assert.assertNotNull(resolver.getLastModified(httpsURI)); - Assert.assertNotNull(resolver.getLastModified(httpURI)); + Assertions.assertNotNull(resolver.getLastModified(httpsURI)); + Assertions.assertNotNull(resolver.getLastModified(httpURI)); } } } diff --git a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/resolver/tools/tests/MavenCatalogResolverTest.java b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/resolver/tools/tests/MavenCatalogResolverTest.java index 3bcbeee43..70ba8a5a2 100644 --- a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/resolver/tools/tests/MavenCatalogResolverTest.java +++ b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/resolver/tools/tests/MavenCatalogResolverTest.java @@ -3,8 +3,8 @@ import java.io.IOException; import java.net.URL; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.xml.sax.InputSource; import org.apache.xml.resolver.CatalogManager; @@ -22,7 +22,7 @@ public void checkReenterability() throws IOException { cra.getCatalog().parseCatalog(a); InputSource ea = cra.resolveEntity(null, "http://www.w3.org/1999/xlink.xsd"); - Assert.assertNotNull(ea); + Assertions.assertNotNull(ea); CatalogManager cmb = new CatalogManager(); cmb.setIgnoreMissingProperties(true); @@ -32,7 +32,7 @@ public void checkReenterability() throws IOException { crb.getCatalog().parseCatalog(b); InputSource eb = crb.resolveEntity(null, "http://www.w3.org/2005/atom-author-link.xsd"); - Assert.assertNotNull(eb); + Assertions.assertNotNull(eb); } } diff --git a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/tests/AddIfExistsToEpisodeSchemaBindingsTest.java b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/tests/AddIfExistsToEpisodeSchemaBindingsTest.java index 702c121ef..baeedbded 100644 --- a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/tests/AddIfExistsToEpisodeSchemaBindingsTest.java +++ b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/tests/AddIfExistsToEpisodeSchemaBindingsTest.java @@ -3,8 +3,8 @@ import java.io.InputStream; import org.codehaus.plexus.util.IOUtil; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.maven.RawXJCMojo; public class AddIfExistsToEpisodeSchemaBindingsTest { @@ -13,7 +13,7 @@ public class AddIfExistsToEpisodeSchemaBindingsTest { public void transformationResourceIsAccessible() { InputStream is = RawXJCMojo.class .getResourceAsStream(RawXJCMojo.ADD_IF_EXISTS_TO_EPISODE_SCHEMA_BINDINGS_TRANSFORMATION_RESOURCE_NAME); - Assert.assertNotNull(is); + Assertions.assertNotNull(is); IOUtil.close(is); } } diff --git a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/tests/DependencyResourceTest.java b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/tests/DependencyResourceTest.java index ca36286cb..67fc22be6 100644 --- a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/tests/DependencyResourceTest.java +++ b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/tests/DependencyResourceTest.java @@ -1,6 +1,6 @@ package org.jvnet.jaxb.maven.tests; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.maven.DependencyResource; public class DependencyResourceTest { diff --git a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/util/IOUtilsTests.java b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/util/IOUtilsTests.java index 1d7203da4..44e710743 100644 --- a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/util/IOUtilsTests.java +++ b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/util/IOUtilsTests.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.maven.util; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.List; @@ -13,13 +13,13 @@ public void reorderFilesIncludesNull() { String[] files = {"a.xsd", "c.xsd", "b.xsd" }; List orderedFiles = IOUtils.reorderFiles(files, null); - Assert.assertNotNull("Ordered files list should not be null", - orderedFiles); - Assert.assertEquals("Ordered files list should contains all elements of initial list", - files.length, orderedFiles.size()); - Assert.assertEquals(files[0], orderedFiles.get(0)); - Assert.assertEquals(files[1], orderedFiles.get(1)); - Assert.assertEquals(files[2], orderedFiles.get(2)); + Assertions.assertNotNull(orderedFiles, + "Ordered files list should not be null"); + Assertions.assertEquals(files.length, orderedFiles.size(), + "Ordered files list should contains all elements of initial list"); + Assertions.assertEquals(files[0], orderedFiles.get(0)); + Assertions.assertEquals(files[1], orderedFiles.get(1)); + Assertions.assertEquals(files[2], orderedFiles.get(2)); } @Test @@ -27,13 +27,13 @@ public void reorderFilesIncludesEmpty() { String[] files = {"a.xsd", "c.xsd", "b.xsd" }; List orderedFiles = IOUtils.reorderFiles(files, new String[] {}); - Assert.assertNotNull("Ordered files list should not be null", - orderedFiles); - Assert.assertEquals("Ordered files list should contains all elements of initial list", - files.length, orderedFiles.size()); - Assert.assertEquals(files[0], orderedFiles.get(0)); - Assert.assertEquals(files[1], orderedFiles.get(1)); - Assert.assertEquals(files[2], orderedFiles.get(2)); + Assertions.assertNotNull(orderedFiles, + "Ordered files list should not be null"); + Assertions.assertEquals(files.length, orderedFiles.size(), + "Ordered files list should contains all elements of initial list"); + Assertions.assertEquals(files[0], orderedFiles.get(0)); + Assertions.assertEquals(files[1], orderedFiles.get(1)); + Assertions.assertEquals(files[2], orderedFiles.get(2)); } @Test @@ -41,13 +41,13 @@ public void reorderFilesIncludesNoWildcard() { String[] files = {"a.xsd", "c.xsd", "b.xsd" }; List orderedFiles = IOUtils.reorderFiles(files, new String[] { "b.xsd", "c.xsd", "a.xsd" }); - Assert.assertNotNull("Ordered files list should not be null", - orderedFiles); - Assert.assertEquals("Ordered files list should contains all elements of initial list", - files.length, orderedFiles.size()); - Assert.assertEquals(files[2], orderedFiles.get(0)); - Assert.assertEquals(files[1], orderedFiles.get(1)); - Assert.assertEquals(files[0], orderedFiles.get(2)); + Assertions.assertNotNull(orderedFiles, + "Ordered files list should not be null"); + Assertions.assertEquals(files.length, orderedFiles.size(), + "Ordered files list should contains all elements of initial list"); + Assertions.assertEquals(files[2], orderedFiles.get(0)); + Assertions.assertEquals(files[1], orderedFiles.get(1)); + Assertions.assertEquals(files[0], orderedFiles.get(2)); } @Test @@ -55,13 +55,13 @@ public void reorderFilesIncludesNoWildcardWithCommonSuffix() { String[] files = {"a.xsd", "b.xsd", "service-ab.xsd" }; List orderedFiles = IOUtils.reorderFiles(files, new String[] { "b.xsd", "a.xsd", "service-ab.xsd" }); - Assert.assertNotNull("Ordered files list should not be null", - orderedFiles); - Assert.assertEquals("Ordered files list should contains all elements of initial list", - files.length, orderedFiles.size()); - Assert.assertEquals(files[1], orderedFiles.get(0)); - Assert.assertEquals(files[0], orderedFiles.get(1)); - Assert.assertEquals(files[2], orderedFiles.get(2)); + Assertions.assertNotNull(orderedFiles, + "Ordered files list should not be null"); + Assertions.assertEquals(files.length, orderedFiles.size(), + "Ordered files list should contains all elements of initial list"); + Assertions.assertEquals(files[1], orderedFiles.get(0)); + Assertions.assertEquals(files[0], orderedFiles.get(1)); + Assertions.assertEquals(files[2], orderedFiles.get(2)); } @Test @@ -69,19 +69,19 @@ public void reorderFilesIncludesWithWildcardFirst() { String[] files = {"a.xsd", "common" + File.separatorChar + "c1.xsd", "b.xsd", "common" + File.separatorChar + "c2.xsd", "common" + File.separatorChar + "a.xsd", "common" + File.separatorChar + "b.xsd" }; List orderedFiles = IOUtils.reorderFiles(files, new String[] { "common/*.xsd", "a.xsd", "b.xsd" }); - Assert.assertNotNull("Ordered files list should not be null", - orderedFiles); - Assert.assertEquals("Ordered files list should contains all elements of initial list", - files.length, orderedFiles.size()); + Assertions.assertNotNull(orderedFiles, + "Ordered files list should not be null"); + Assertions.assertEquals(files.length, orderedFiles.size(), + "Ordered files list should contains all elements of initial list"); // we have all common/*.xsd files in same order - Assert.assertEquals(files[1], orderedFiles.get(0)); - Assert.assertEquals(files[3], orderedFiles.get(1)); - Assert.assertEquals(files[4], orderedFiles.get(2)); - Assert.assertEquals(files[5], orderedFiles.get(3)); + Assertions.assertEquals(files[1], orderedFiles.get(0)); + Assertions.assertEquals(files[3], orderedFiles.get(1)); + Assertions.assertEquals(files[4], orderedFiles.get(2)); + Assertions.assertEquals(files[5], orderedFiles.get(3)); // and then a.xsd - Assert.assertEquals(files[0], orderedFiles.get(4)); + Assertions.assertEquals(files[0], orderedFiles.get(4)); // and finally b.xsd - Assert.assertEquals(files[2], orderedFiles.get(5)); + Assertions.assertEquals(files[2], orderedFiles.get(5)); } @Test @@ -89,20 +89,20 @@ public void reorderFilesIncludesWithWildcardMiddle() { String[] files = {"a.xsd", "common" + File.separatorChar + "c1.xsd", "b.xsd", "common" + File.separatorChar + "c2.xsd", "common" + File.separatorChar + "a.xsd", "common" + File.separatorChar + "b.xsd" }; List orderedFiles = IOUtils.reorderFiles(files, new String[] { "a.xsd", "common/*.xsd", "b.xsd" }); - Assert.assertNotNull("Ordered files list should not be null", - orderedFiles); - Assert.assertEquals("Ordered files list should contains all elements of initial list", - files.length, orderedFiles.size()); + Assertions.assertNotNull(orderedFiles, + "Ordered files list should not be null"); + Assertions.assertEquals(files.length, orderedFiles.size(), + "Ordered files list should contains all elements of initial list"); // we have a.xsd - Assert.assertEquals(files[0], orderedFiles.get(0)); + Assertions.assertEquals(files[0], orderedFiles.get(0)); // and then all common/*.xsd files in same order - Assert.assertEquals(files[1], orderedFiles.get(1)); - Assert.assertEquals(files[3], orderedFiles.get(2)); - Assert.assertEquals(files[4], orderedFiles.get(3)); - Assert.assertEquals(files[5], orderedFiles.get(4)); + Assertions.assertEquals(files[1], orderedFiles.get(1)); + Assertions.assertEquals(files[3], orderedFiles.get(2)); + Assertions.assertEquals(files[4], orderedFiles.get(3)); + Assertions.assertEquals(files[5], orderedFiles.get(4)); // and finally b.xsd - Assert.assertEquals(files[2], orderedFiles.get(5)); + Assertions.assertEquals(files[2], orderedFiles.get(5)); } @Test @@ -110,19 +110,19 @@ public void reorderFilesIncludesWithWildcardLast() { String[] files = {"a.xsd", "common" + File.separatorChar + "c1.xsd", "b.xsd", "common" + File.separatorChar + "c2.xsd", "common" + File.separatorChar + "a.xsd", "common" + File.separatorChar + "b.xsd" }; List orderedFiles = IOUtils.reorderFiles(files, new String[] { "a.xsd", "b.xsd", "common/*.xsd" }); - Assert.assertNotNull("Ordered files list should not be null", - orderedFiles); - Assert.assertEquals("Ordered files list should contains all elements of initial list", - files.length, orderedFiles.size()); + Assertions.assertNotNull(orderedFiles, + "Ordered files list should not be null"); + Assertions.assertEquals(files.length, orderedFiles.size(), + "Ordered files list should contains all elements of initial list"); // we have a.xsd - Assert.assertEquals(files[0], orderedFiles.get(0)); + Assertions.assertEquals(files[0], orderedFiles.get(0)); // and then b.xsd - Assert.assertEquals(files[2], orderedFiles.get(1)); + Assertions.assertEquals(files[2], orderedFiles.get(1)); // and finally all common/*.xsd files in same order - Assert.assertEquals(files[1], orderedFiles.get(2)); - Assert.assertEquals(files[3], orderedFiles.get(3)); - Assert.assertEquals(files[4], orderedFiles.get(4)); - Assert.assertEquals(files[5], orderedFiles.get(5)); + Assertions.assertEquals(files[1], orderedFiles.get(2)); + Assertions.assertEquals(files[3], orderedFiles.get(3)); + Assertions.assertEquals(files[4], orderedFiles.get(4)); + Assertions.assertEquals(files[5], orderedFiles.get(5)); } } diff --git a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/util/tests/CollectionsUtilsTests.java b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/util/tests/CollectionsUtilsTests.java index 41d35ac21..0d65dba34 100644 --- a/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/util/tests/CollectionsUtilsTests.java +++ b/maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/util/tests/CollectionsUtilsTests.java @@ -3,8 +3,8 @@ import java.util.Arrays; import java.util.Comparator; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.maven.util.CollectionUtils; import org.jvnet.jaxb.maven.util.CollectionUtils.Function; @@ -23,15 +23,15 @@ public String eval(String argument) { . gtWithNullAsGreatest(); final Comparator lt = CollectionUtils . ltWithNullAsSmallest(); - Assert.assertEquals("b", CollectionUtils.bestValue( + Assertions.assertEquals("b", CollectionUtils.bestValue( Arrays. asList("a", "b"), identity, gt)); - Assert.assertEquals("a", CollectionUtils.bestValue( + Assertions.assertEquals("a", CollectionUtils.bestValue( Arrays. asList("a", "b"), identity, lt)); - Assert.assertEquals( + Assertions.assertEquals( null, CollectionUtils.bestValue( Arrays. asList("a", null, "b"), identity, gt)); - Assert.assertEquals( + Assertions.assertEquals( null, CollectionUtils.bestValue( Arrays. asList("a", null, "b"), identity, lt)); diff --git a/maven-plugin/pom.xml b/maven-plugin/pom.xml index 2de1b7cd7..e731ee78e 100644 --- a/maven-plugin/pom.xml +++ b/maven-plugin/pom.xml @@ -57,8 +57,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine test diff --git a/maven-plugin/testing/pom.xml b/maven-plugin/testing/pom.xml index ee517dc5c..f8071a2fd 100644 --- a/maven-plugin/testing/pom.xml +++ b/maven-plugin/testing/pom.xml @@ -10,8 +10,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine compile diff --git a/maven-plugin/testing/src/main/java/org/jvnet/jaxb/maven/test/RunXJCMojo.java b/maven-plugin/testing/src/main/java/org/jvnet/jaxb/maven/test/RunXJCMojo.java index 13e9b717e..e00400295 100644 --- a/maven-plugin/testing/src/main/java/org/jvnet/jaxb/maven/test/RunXJCMojo.java +++ b/maven-plugin/testing/src/main/java/org/jvnet/jaxb/maven/test/RunXJCMojo.java @@ -4,13 +4,12 @@ import java.util.Collections; import java.util.List; -import junit.framework.TestCase; - import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.Mojo; import org.apache.maven.project.MavenProject; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.maven.AbstractXJCMojo; import org.jvnet.jaxb.maven.XJCMojo; import org.slf4j.Logger; @@ -24,12 +23,13 @@ * @author Aleksei Valikov */ -public class RunXJCMojo extends TestCase { +public class RunXJCMojo { /** * Logger. */ protected Logger log = LoggerFactory.getLogger(RunXJCMojo.class); + @Test public void testExecute() throws Exception { final Mojo mojo = initMojo(); mojo.execute(); diff --git a/maven-plugin/tests/java-9/src/test/java/org/jvnet/jaxb/maven/java9/Java9Test.java b/maven-plugin/tests/java-9/src/test/java/org/jvnet/jaxb/maven/java9/Java9Test.java index 57592a209..b942929f4 100644 --- a/maven-plugin/tests/java-9/src/test/java/org/jvnet/jaxb/maven/java9/Java9Test.java +++ b/maven-plugin/tests/java-9/src/test/java/org/jvnet/jaxb/maven/java9/Java9Test.java @@ -1,9 +1,8 @@ //Copyright (c) 2017 by Disy Informationssysteme GmbH package org.jvnet.jaxb.maven.java9; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; // NOT_PUBLISHED public class Java9Test { @@ -11,13 +10,13 @@ public class Java9Test { @Test public void packageBindingRespected() throws Exception { Object o = Class.forName("with_pack.SimpleClassWithPackage").newInstance(); - assertNotNull(o); + Assertions.assertNotNull(o); } @Test public void classNameBindingRespected() throws Exception { Object o = Class.forName("class_name.SimpleClassWithRightName").newInstance(); - assertNotNull(o); + Assertions.assertNotNull(o); } } diff --git a/maven-plugin/tests/jt-194/main/src/test/java/org/jvnet/jaxb/test/JT194Test.java b/maven-plugin/tests/jt-194/main/src/test/java/org/jvnet/jaxb/test/JT194Test.java index fe6de49b2..6b6394c53 100644 --- a/maven-plugin/tests/jt-194/main/src/test/java/org/jvnet/jaxb/test/JT194Test.java +++ b/maven-plugin/tests/jt-194/main/src/test/java/org/jvnet/jaxb/test/JT194Test.java @@ -1,14 +1,14 @@ package org.jvnet.jaxb.test; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class JT194Test { @Test public void testBindingOK() throws Exception { // With bindings we don't have PurchaseOrderType but PurchaseOrder and PurchaseOrderImpl - Assert.assertEquals(true, generated.PurchaseOrder.class.isInterface()); - Assert.assertEquals(false, generated.impl.PurchaseOrderImpl.class.isInterface()); + Assertions.assertEquals(true, generated.PurchaseOrder.class.isInterface()); + Assertions.assertEquals(false, generated.impl.PurchaseOrderImpl.class.isInterface()); } } diff --git a/maven-plugin/tests/jt-40/generate/src/test/java/org/jvnet/jaxb/test/JT40Test.java b/maven-plugin/tests/jt-40/generate/src/test/java/org/jvnet/jaxb/test/JT40Test.java index 6ffa599f1..ff24bcc74 100644 --- a/maven-plugin/tests/jt-40/generate/src/test/java/org/jvnet/jaxb/test/JT40Test.java +++ b/maven-plugin/tests/jt-40/generate/src/test/java/org/jvnet/jaxb/test/JT40Test.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.test; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.main.AFail; import org.jvnet.jaxb.main.ASuccess; @@ -10,22 +10,22 @@ public class JT40Test { @Test public void testGeneratedTestSourcesNoClassRefTestInMain() throws Exception { ASuccess a = new ASuccess(); - Assert.assertEquals("OK", a.getB().getB2()); + Assertions.assertEquals("OK", a.getB().getB2()); ASuccess aOther = new ASuccess("OK Too"); - Assert.assertEquals("OK Too", aOther.getB().getB2()); + Assertions.assertEquals("OK Too", aOther.getB().getB2()); } @Test public void testGeneratedTestSourcesClassRefTestInMain() throws Exception { try { AFail a = new AFail(); - Assert.assertEquals(generated.PurchaseOrderType.class.getName(), a.getB().getB2()); + Assertions.assertEquals(generated.PurchaseOrderType.class.getName(), a.getB().getB2()); } catch (ClassNotFoundException e) { - Assert.fail("Exception thrown (but should not)"); + Assertions.fail("Exception thrown (but should not)"); } AFail aOther = new AFail("OK"); - Assert.assertEquals("OK", aOther.getB().getB2()); + Assertions.assertEquals("OK", aOther.getB().getB2()); } } diff --git a/maven-plugin/tests/jt-40/test/src/test/java/org/jvnet/jaxb/test/JT40Test.java b/maven-plugin/tests/jt-40/test/src/test/java/org/jvnet/jaxb/test/JT40Test.java index e02398105..f51ed2429 100644 --- a/maven-plugin/tests/jt-40/test/src/test/java/org/jvnet/jaxb/test/JT40Test.java +++ b/maven-plugin/tests/jt-40/test/src/test/java/org/jvnet/jaxb/test/JT40Test.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.test; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.jvnet.jaxb.main.AFail; import org.jvnet.jaxb.main.ASuccess; @@ -10,22 +10,22 @@ public class JT40Test { @Test public void testGeneratedTestSourcesNoClassRefTestInMain() throws Exception { ASuccess a = new ASuccess(); - Assert.assertEquals("OK", a.getB().getB2()); + Assertions.assertEquals("OK", a.getB().getB2()); ASuccess aOther = new ASuccess("OK Too"); - Assert.assertEquals("OK Too", aOther.getB().getB2()); + Assertions.assertEquals("OK Too", aOther.getB().getB2()); } @Test public void testGeneratedTestSourcesClassRefTestInMain() throws Exception { try { new AFail(); - Assert.fail("Exception not thrown"); + Assertions.fail("Exception not thrown"); } catch (ClassNotFoundException e) { // OK } AFail aOther = new AFail("OK"); - Assert.assertEquals("OK", aOther.getB().getB2()); + Assertions.assertEquals("OK", aOther.getB().getB2()); } } diff --git a/maven-plugin/tests/res-star/src/test/java/org/jvnet/jaxb/maven/tests/resstar/ChecksTest.java b/maven-plugin/tests/res-star/src/test/java/org/jvnet/jaxb/maven/tests/resstar/ChecksTest.java index 6336348ba..92f165ce3 100644 --- a/maven-plugin/tests/res-star/src/test/java/org/jvnet/jaxb/maven/tests/resstar/ChecksTest.java +++ b/maven-plugin/tests/res-star/src/test/java/org/jvnet/jaxb/maven/tests/resstar/ChecksTest.java @@ -1,7 +1,7 @@ package org.jvnet.jaxb.maven.tests.resstar; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class ChecksTest { @@ -13,10 +13,10 @@ public void testIncludedFound() throws ClassNotFoundException { Class.forName(className); } - @Test(expected = ClassNotFoundException.class) + @Test public void testNotIncludedNotFound() throws ClassNotFoundException { String className = "org.example.xs.PurchaseOrder"; - Class.forName(className); - Assert.fail("Class " + className + " shouldn't have been found"); + Assertions.assertThrows(ClassNotFoundException.class, () -> Class.forName(className), + "Class " + className + " shouldn't have been found"); } } diff --git a/maven-plugin/tests/two/pom.xml b/maven-plugin/tests/two/pom.xml index b7b6dad44..cff131435 100644 --- a/maven-plugin/tests/two/pom.xml +++ b/maven-plugin/tests/two/pom.xml @@ -15,8 +15,8 @@ jaxb-runtime - junit - junit + org.junit.jupiter + junit-jupiter-engine test diff --git a/maven-plugin/tests/wsdl-file/pom.xml b/maven-plugin/tests/wsdl-file/pom.xml index aa2ef19fc..81384985b 100644 --- a/maven-plugin/tests/wsdl-file/pom.xml +++ b/maven-plugin/tests/wsdl-file/pom.xml @@ -17,8 +17,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine test diff --git a/maven-plugin/tests/wsdl/pom.xml b/maven-plugin/tests/wsdl/pom.xml index 2f7f9cf6f..2ab5540c8 100644 --- a/maven-plugin/tests/wsdl/pom.xml +++ b/maven-plugin/tests/wsdl/pom.xml @@ -17,8 +17,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine test diff --git a/pom.xml b/pom.xml index 17e3baed2..7df7ebda3 100644 --- a/pom.xml +++ b/pom.xml @@ -66,16 +66,17 @@ 3.3.0 - 1.10.12 + 1.10.14 4.0.5 1.9.4 2.11.0 3.12.0 1.10.0 + 3.0 4.1.1.Final 2.5 - 4.13.2 + 5.11.0 1.7.36 5.3.31 1.8.3 @@ -234,8 +235,13 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine + test + + + org.hamcrest + hamcrest test @@ -350,9 +356,19 @@ ${commons-io.version} - junit - junit - ${junit4.version} + org.junit.jupiter + junit-jupiter-engine + ${junit5.version} + + + org.junit.jupiter + junit-jupiter-params + ${junit5.version} + + + org.hamcrest + hamcrest + ${hamcrest.version} @@ -576,12 +592,6 @@ maven-antrun-plugin ${maven-antrun-plugin.version} - - junit - junit - ${junit4.version} - compile - org.apache.ant ant @@ -589,9 +599,14 @@ org.apache.ant - ant-junit + ant-junitlauncher ${ant.version} + + org.junit.jupiter + junit-jupiter-engine + ${junit5.version} +