This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit fe8d9a6093a2acdcd632eec2b26c988ef6f34b27 Author: Andrus Adamchik <[email protected]> AuthorDate: Sun May 10 09:49:47 2026 -0400 JUnit 5 migration of "cayenne-ant" module (phase 1) --- cayenne-ant/pom.xml | 7 +---- ...enneGeneratorTaskCrossMapRelationshipsTest.java | 8 +++--- .../cayenne/tools/CayenneGeneratorTaskTest.java | 30 +++++++++++----------- .../apache/cayenne/tools/CgenWithConfigTest.java | 16 ++++++------ .../apache/cayenne/tools/DbGeneratorTaskTest.java | 14 +++++----- .../apache/cayenne/tools/DbImporterTaskTest.java | 24 ++++++++--------- 6 files changed, 47 insertions(+), 52 deletions(-) diff --git a/cayenne-ant/pom.xml b/cayenne-ant/pom.xml index a54f23266..5fa5b84b3 100644 --- a/cayenne-ant/pom.xml +++ b/cayenne-ant/pom.xml @@ -57,12 +57,7 @@ <artifactId>junit-jupiter</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.junit.vintage</groupId> - <artifactId>junit-vintage-engine</artifactId> - <scope>test</scope> - </dependency> - <dependency> +<dependency> <groupId>org.apache.cayenne</groupId> <artifactId>cayenne-dbsync</artifactId> <version>${project.version}</version> diff --git a/cayenne-ant/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskCrossMapRelationshipsTest.java b/cayenne-ant/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskCrossMapRelationshipsTest.java index 9881164b2..ff387dfe6 100644 --- a/cayenne-ant/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskCrossMapRelationshipsTest.java +++ b/cayenne-ant/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskCrossMapRelationshipsTest.java @@ -25,7 +25,7 @@ import org.apache.tools.ant.Location; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileList; import org.apache.tools.ant.types.Path; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.BufferedReader; import java.io.File; @@ -33,8 +33,8 @@ import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.regex.Pattern; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; public class CayenneGeneratorTaskCrossMapRelationshipsTest { @@ -42,7 +42,7 @@ public class CayenneGeneratorTaskCrossMapRelationshipsTest { * Tests pairs generation with a cross-DataMap relationship. */ @Test - public void testCrossDataMapRelationships() throws Exception { + public void crossDataMapRelationships() throws Exception { CayenneGeneratorTask task = new CayenneGeneratorTask(); task.setProject(new Project()); diff --git a/cayenne-ant/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskTest.java b/cayenne-ant/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskTest.java index 20edb61af..f6e4c8501 100644 --- a/cayenne-ant/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskTest.java +++ b/cayenne-ant/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskTest.java @@ -26,8 +26,8 @@ import org.apache.cayenne.test.file.FileUtil; import org.apache.cayenne.test.resource.ResourceUtil; import org.apache.tools.ant.Location; import org.apache.tools.ant.Project; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.BufferedReader; import java.io.File; @@ -36,10 +36,10 @@ import java.io.InputStreamReader; import java.util.List; import java.util.regex.Pattern; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; public class CayenneGeneratorTaskTest { @@ -62,7 +62,7 @@ public class CayenneGeneratorTaskTest { protected CayenneGeneratorTask task; - @Before + @BeforeEach public void setUp() { Project project = new Project(); @@ -78,7 +78,7 @@ public class CayenneGeneratorTaskTest { * Test single classes with a non-standard template. */ @Test - public void testSingleClassesCustTemplate() throws Exception { + public void singleClassesCustTemplate() throws Exception { // prepare destination directory File mapDir = new File(baseDir, "single-classes-custtempl"); assertTrue(mapDir.mkdirs()); @@ -103,7 +103,7 @@ public class CayenneGeneratorTaskTest { } @Test - public void testTransferPluginDataToCgenConfiguration() throws Exception { + public void transferPluginDataToCgenConfiguration() throws Exception { // prepare destination directory File mapDir = new File(baseDir.toURI()); @@ -166,7 +166,7 @@ public class CayenneGeneratorTaskTest { * Test single classes generation including full package path. */ @Test - public void testSingleClasses1() throws Exception { + public void singleClasses1() throws Exception { // prepare destination directory File mapDir = new File(baseDir, "single-classes-tree"); assertTrue(mapDir.mkdirs()); @@ -191,7 +191,7 @@ public class CayenneGeneratorTaskTest { /** Test single classes generation ignoring package path. */ @Test - public void testSingleClasses2() throws Exception { + public void singleClasses2() throws Exception { // prepare destination directory File mapDir = new File(baseDir, "single-classes-flat"); assertTrue(mapDir.mkdirs()); @@ -222,7 +222,7 @@ public class CayenneGeneratorTaskTest { * package. */ @Test - public void testPairs1() throws Exception { + public void pairs1() throws Exception { // prepare destination directory File mapDir = new File(baseDir, "pairs-tree"); assertTrue(mapDir.mkdirs()); @@ -248,7 +248,7 @@ public class CayenneGeneratorTaskTest { /** Test pairs generation in the same directory. */ @Test - public void testPairs2() throws Exception { + public void pairs2() throws Exception { // prepare destination directory File mapDir = new File(baseDir, "pairs-flat"); assertTrue(mapDir.mkdirs()); @@ -280,7 +280,7 @@ public class CayenneGeneratorTaskTest { * subclass in different packages. */ @Test - public void testPairs3() throws Exception { + public void pairs3() throws Exception { // prepare destination directory File mapDir = new File(baseDir, "pairs-tree-split"); assertTrue(mapDir.mkdirs()); @@ -306,7 +306,7 @@ public class CayenneGeneratorTaskTest { } @Test - public void testPairsEmbeddable3() throws Exception { + public void pairsEmbeddable3() throws Exception { // prepare destination directory File mapDir = new File(baseDir, "pairs-embeddables3-split"); assertTrue(mapDir.mkdirs()); diff --git a/cayenne-ant/src/test/java/org/apache/cayenne/tools/CgenWithConfigTest.java b/cayenne-ant/src/test/java/org/apache/cayenne/tools/CgenWithConfigTest.java index 02bd8f436..2f034a3a0 100644 --- a/cayenne-ant/src/test/java/org/apache/cayenne/tools/CgenWithConfigTest.java +++ b/cayenne-ant/src/test/java/org/apache/cayenne/tools/CgenWithConfigTest.java @@ -22,13 +22,13 @@ import org.apache.cayenne.test.file.FileUtil; import org.apache.cayenne.test.resource.ResourceUtil; import org.apache.tools.ant.Location; import org.apache.tools.ant.Project; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.File; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @since 4.1 @@ -47,7 +47,7 @@ public class CgenWithConfigTest { protected CayenneGeneratorTask task; - @Before + @BeforeEach public void setUp() { Project project = new Project(); @@ -60,7 +60,7 @@ public class CgenWithConfigTest { } @Test - public void testCgenWithDmConfig() { + public void cgenWithDmConfig() { File mapDir = new File(baseDir, "cgenConfigTest"); assertTrue(mapDir.mkdirs()); @@ -84,7 +84,7 @@ public class CgenWithConfigTest { } @Test - public void testCgenWithDmAndPomConfigs() { + public void cgenWithDmAndPomConfigs() { File mapDir = new File(baseDir, "cgenDmPomTest"); assertTrue(mapDir.mkdirs()); @@ -119,7 +119,7 @@ public class CgenWithConfigTest { } @Test - public void testReplaceDatamapMode() { + public void replaceDatamapMode() { File mapDir = new File(baseDir, "cgenReplaceMode"); assertTrue(mapDir.mkdirs()); diff --git a/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbGeneratorTaskTest.java b/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbGeneratorTaskTest.java index 8be55e77e..7c3cee93b 100644 --- a/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbGeneratorTaskTest.java +++ b/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbGeneratorTaskTest.java @@ -26,32 +26,32 @@ import org.apache.cayenne.dbsync.reverse.configuration.ToolsModule; import org.apache.cayenne.di.DIBootstrap; import org.apache.cayenne.di.Injector; import org.slf4j.Logger; -import org.junit.Test; +import org.junit.jupiter.api.Test; import javax.sql.DataSource; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; public class DbGeneratorTaskTest { @Test - public void testSetUserName() throws Exception { + public void setUserName() throws Exception { DbGeneratorTask task = new DbGeneratorTask(); task.setUserName("abc"); assertEquals("abc", task.userName); } @Test - public void testSetPassword() throws Exception { + public void setPassword() throws Exception { DbGeneratorTask task = new DbGeneratorTask(); task.setPassword("xyz"); assertEquals("xyz", task.password); } @Test - public void testSetAdapter() throws Exception { + public void setAdapter() throws Exception { DataSource ds = mock(DataSource.class); Injector injector = DIBootstrap.createInjector(new ToolsModule(mock(Logger.class))); @@ -67,7 +67,7 @@ public class DbGeneratorTaskTest { } @Test - public void testSetUrl() throws Exception { + public void setUrl() throws Exception { DbGeneratorTask task = new DbGeneratorTask(); task.setUrl("jdbc:///"); assertEquals("jdbc:///", task.url); diff --git a/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java b/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java index 5d169b001..3a2e48566 100644 --- a/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java +++ b/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java @@ -26,7 +26,7 @@ import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectHelper; import org.apache.tools.ant.UnknownElement; import org.apache.tools.ant.util.FileUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.xmlunit.matchers.CompareMatcher; import java.io.File; @@ -46,9 +46,9 @@ import static org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineeringUtils import static org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineeringUtils.assertTableTypes; import static org.apache.cayenne.util.Util.isBlank; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; // TODO: we are only testing on Derby. We may need to dynamically switch between DBs // based on "cayenneTestConnection", like we do in cayenne-server, etc. @@ -67,42 +67,42 @@ public class DbImporterTaskTest { } @Test - public void testLoadCatalog() throws Exception { + public void loadCatalog() throws Exception { assertCatalog(getCdbImport("build-catalog.xml").getReverseEngineering()); } @Test - public void testLoadSchema() throws Exception { + public void loadSchema() throws Exception { assertSchema(getCdbImport("build-schema.xml").getReverseEngineering()); } @Test - public void testLoadCatalogAndSchema() throws Exception { + public void loadCatalogAndSchema() throws Exception { assertCatalogAndSchema(getCdbImport("build-catalog-and-schema.xml").getReverseEngineering()); } @Test - public void testLoadFlat() throws Exception { + public void loadFlat() throws Exception { assertFlat(getCdbImport("build-flat.xml").getReverseEngineering()); } @Test - public void testSkipRelationshipsLoading() throws Exception { + public void skipRelationshipsLoading() throws Exception { assertSkipRelationshipsLoading(getCdbImport("build-skip-relationships-loading.xml").getReverseEngineering()); } @Test - public void testTableTypes() throws Exception { + public void tableTypes() throws Exception { assertTableTypes(getCdbImport("build-table-types.xml").getReverseEngineering()); } @Test - public void testBuildWithProject() throws Exception { + public void buildWithProject() throws Exception { assertNotNull(getCdbImport("build-with-project.xml").getCayenneProject()); } @Test - public void testIncludeTable() throws Exception { + public void includeTable() throws Exception { test("build-include-table.xml"); }
