You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2024/07/09 00:22:02 UTC
(maven-doxia-converter) branch DOXIATOOLS-81v1 created (now fa65344)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch DOXIATOOLS-81v1
in repository https://gitbox.apache.org/repos/asf/maven-doxia-converter.git
at fa65344 [DOXIATOOLS-81] Switch to JUnit 5
This branch includes the following new commits:
new fa65344 [DOXIATOOLS-81] Switch to JUnit 5
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-doxia-converter) 01/01: [DOXIATOOLS-81] Switch to JUnit 5
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch DOXIATOOLS-81v1
in repository https://gitbox.apache.org/repos/asf/maven-doxia-converter.git
commit fa653440032fdd968073aa58cf974cacfb2efce1
Author: Sylwester Lachiewicz <sl...@gmail.com>
AuthorDate: Sat Dec 30 21:41:09 2023 +0100
[DOXIATOOLS-81] Switch to JUnit 5
---
pom.xml | 6 +--
.../java/org/apache/maven/doxia/ConverterTest.java | 58 ++++++++++++++--------
2 files changed, 41 insertions(+), 23 deletions(-)
diff --git a/pom.xml b/pom.xml
index 21405ff..0eee232 100644
--- a/pom.xml
+++ b/pom.xml
@@ -150,9 +150,9 @@ under the License.
</dependency>
<!-- Test -->
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>5.10.1</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/src/test/java/org/apache/maven/doxia/ConverterTest.java b/src/test/java/org/apache/maven/doxia/ConverterTest.java
index ba4fc23..8698515 100644
--- a/src/test/java/org/apache/maven/doxia/ConverterTest.java
+++ b/src/test/java/org/apache/maven/doxia/ConverterTest.java
@@ -31,25 +31,32 @@ import org.apache.maven.doxia.wrapper.InputFileWrapper;
import org.apache.maven.doxia.wrapper.InputReaderWrapper;
import org.apache.maven.doxia.wrapper.OutputFileWrapper;
import org.apache.maven.doxia.wrapper.OutputStreamWrapper;
-import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.WriterFactory;
+import org.eclipse.sisu.launch.InjectedTest;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Tests Doxia converter.
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
*/
-public class ConverterTest extends PlexusTestCase {
+class ConverterTest extends InjectedTest {
private Converter converter;
private boolean formatOutput;
/** {@inheritDoc} */
- @Override
- protected void setUp() throws Exception {
+ @BeforeEach
+ public void setUp() throws Exception {
super.setUp();
converter = new DefaultConverter();
@@ -58,8 +65,8 @@ public class ConverterTest extends PlexusTestCase {
}
/** {@inheritDoc} */
- @Override
- protected void tearDown() throws Exception {
+ @AfterEach
+ public void tearDown() throws Exception {
super.tearDown();
converter = null;
@@ -71,7 +78,8 @@ public class ConverterTest extends PlexusTestCase {
* @see Converter#convert(InputFileWrapper, OutputFileWrapper)
* @throws Exception if any
*/
- public void testFileConverterWithInputFileOutputDir() throws Exception {
+ @Test
+ void fileConverterWithInputFileOutputDir() throws Exception {
String in = getBasedir() + "/src/test/resources/unit/Doxia.htm";
String out = getBasedir() + "/target/unit/";
@@ -92,7 +100,8 @@ public class ConverterTest extends PlexusTestCase {
* @see Converter#convert(InputFileWrapper, OutputFileWrapper)
* @throws Exception if any
*/
- public void testFileConverterWithInputDirOutputDir() throws Exception {
+ @Test
+ void fileConverterWithInputDirOutputDir() throws Exception {
String in = getBasedir() + "/src/test/resources/unit/apt";
String out = getBasedir() + "/target/unit/";
@@ -115,7 +124,8 @@ public class ConverterTest extends PlexusTestCase {
* @see Converter#convert(InputFileWrapper, OutputFileWrapper)
* @throws Exception if any
*/
- public void testFileConverterWithInputFileOutputFile() throws Exception {
+ @Test
+ void fileConverterWithInputFileOutputFile() throws Exception {
String in = getBasedir() + "/src/test/resources/unit/Doxia.htm";
String out = getBasedir() + "/target/unit/Doxia.apt";
@@ -136,7 +146,8 @@ public class ConverterTest extends PlexusTestCase {
* @see Converter#convert(InputFileWrapper, OutputFileWrapper)
* @throws Exception if any
*/
- public void testAptFileConverter() throws Exception {
+ @Test
+ void aptFileConverter() throws Exception {
String in = getBasedir() + "/src/test/resources/unit/apt/test.apt";
String out = getBasedir() + "/target/unit/file/apt/test.apt.xhtml";
@@ -166,7 +177,8 @@ public class ConverterTest extends PlexusTestCase {
* @see Converter#convert(InputFileWrapper, OutputFileWrapper)
* @throws Exception if any
*/
- public void testFmlFileConverter() throws Exception {
+ @Test
+ void fmlFileConverter() throws Exception {
String in = getBasedir() + "/src/test/resources/unit/fml/test.fml";
String out = getBasedir() + "/target/unit/file/fml/test.fml.xhtml";
@@ -187,7 +199,8 @@ public class ConverterTest extends PlexusTestCase {
* @see Converter#convert(InputFileWrapper, OutputFileWrapper)
* @throws Exception if any
*/
- public void testXdocFileConverter() throws Exception {
+ @Test
+ void xdocFileConverter() throws Exception {
String in = getBasedir() + "/src/test/resources/unit/xdoc/test.xml";
String out = getBasedir() + "/target/unit/file/xdoc/test.xdoc.xhtml";
@@ -217,7 +230,8 @@ public class ConverterTest extends PlexusTestCase {
* @see Converter#convert(InputFileWrapper, OutputFileWrapper)
* @throws Exception if any
*/
- public void testXhtmlFileConverter() throws Exception {
+ @Test
+ void xhtmlFileConverter() throws Exception {
String in = getBasedir() + "/src/test/resources/unit/xhtml/test.xhtml";
String out = getBasedir() + "/target/unit/file/xhtml/test.xhtml.xhtml";
@@ -247,7 +261,8 @@ public class ConverterTest extends PlexusTestCase {
* @see Converter#convert(InputReaderWrapper, OutputStreamWrapper)
* @throws Exception if any
*/
- public void testAptWriterConverter() throws Exception {
+ @Test
+ void aptWriterConverter() throws Exception {
String in = getBasedir() + "/src/test/resources/unit/apt/test.apt";
String from = "apt";
String out = getBasedir() + "/target/unit/writer/apt/test.apt.xhtml";
@@ -279,7 +294,8 @@ public class ConverterTest extends PlexusTestCase {
* @see Converter#convert(InputReaderWrapper, OutputStreamWrapper)
* @throws Exception if any
*/
- public void testAutoDetectConverter() throws Exception {
+ @Test
+ void autoDetectConverter() throws Exception {
String in = getBasedir() + "/src/test/resources/unit/xdoc/test.xml";
String out = getBasedir() + "/target/unit/writer/apt/test.xdoc.apt";
@@ -381,7 +397,8 @@ public class ConverterTest extends PlexusTestCase {
/**
* Test {@link DefaultConverter#autoDetectEncoding(File)}
*/
- public void testAutodetectEncoding() {
+ @Test
+ void autodetectEncoding() {
assertEquals("ISO-8859-1", autoDetectEncoding("apt/test.apt"));
assertEquals("UTF-8", autoDetectEncoding("fml/test.fml")); // plexus-utils should detect ISO-8859-1
assertEquals("UTF-8", autoDetectEncoding("xhtml/test.xhtml"));
@@ -399,8 +416,9 @@ public class ConverterTest extends PlexusTestCase {
* Test {@link DefaultConverter.DoxiaFormat#autoDetectFormat(File)}
*
*/
- public void testAutodetectFormat() {
- assertEquals(autoDetectFormat("apt/test.apt"), DoxiaFormat.APT);
+ @Test
+ void autodetectFormat() {
+ assertEquals(DoxiaFormat.APT, autoDetectFormat("apt/test.apt"));
try {
autoDetectFormat("apt/test.unknown");
@@ -409,7 +427,7 @@ public class ConverterTest extends PlexusTestCase {
assertTrue(true);
}
- assertEquals(autoDetectFormat("fml/test.fml"), DoxiaFormat.FML);
- assertEquals(autoDetectFormat("xhtml/test.xhtml"), DoxiaFormat.XHTML);
+ assertEquals(DoxiaFormat.FML, autoDetectFormat("fml/test.fml"));
+ assertEquals(DoxiaFormat.XHTML, autoDetectFormat("xhtml/test.xhtml"));
}
}