Skip to content

317 chore migrate junit4 to junit5 #373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fj-doc-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
</dependency>

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package test.org.fugerit.java.doc.sample.config;

import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.fail;

import org.fugerit.java.doc.base.facade.DocHandlerFactory;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestDocHandlerFactory {
class TestDocHandlerFactory {

private final static Logger logger = LoggerFactory.getLogger( TestDocHandlerFactory.class );

@Test
public void initDocFactoryTest() {
void initDocFactoryTest() {
try {
String path = "cl://config/doc-handler-sample.xml";
DocHandlerFactory factory = DocHandlerFactory.newInstance( path );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
import org.fugerit.java.doc.mod.fop.PdfFopTypeHandler;
import org.fugerit.java.doc.mod.opencsv.OpenCSVTypeHandler;
import org.fugerit.java.doc.mod.poi.XlsxPoiTypeHandler;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TestCoverageHelper {
class TestCoverageHelper {

private static final DocTypeHandler[] HANDLERS = { SimpleMarkdownBasicTypeHandler.HANDLER,
SimpleMarkdownExtTypeHandler.HANDLER, PdfFopTypeHandler.HANDLER,
Expand All @@ -32,7 +32,7 @@ public class TestCoverageHelper {
"coverage/default_doc.xml" };

@Test
public void testHandlers() {
void testHandlers() {
Arrays.asList(HANDLERS).stream().forEach(handler -> {
Arrays.asList(TEMPLATES).stream().forEach(template -> {
SafeFunction.apply(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class AutodocDetailFullDocHelper extends BasicFacadeTest {

public AutodocDetailFullDocHelper() {
super( "full_doc_header_footer", DocConfig.TYPE_HTML, DocConfig.TYPE_HTML_FRAGMENT, DocConfig.TYPE_PDF, DocConfig.TYPE_FO );
super.setup( "full_doc_header_footer", DocConfig.TYPE_HTML, DocConfig.TYPE_HTML_FRAGMENT, DocConfig.TYPE_PDF, DocConfig.TYPE_FO );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.fugerit.java.doc.mod.fop.FopConfigDefault;
import org.fugerit.java.doc.mod.fop.FreeMarkerFopTypeHandler;
import org.fugerit.java.doc.mod.fop.PdfFopTypeHandler;
import org.junit.BeforeClass;
import org.junit.jupiter.api.BeforeAll;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -40,8 +40,8 @@ public class DevHelper {

private final static Logger logger = LoggerFactory.getLogger( DevHelper.class );

@BeforeClass
public static void initPath() {
@BeforeAll
static void initPath() {
File baseOut = new File( BasicFacadeTest.BASIC_OUTPUT_PATH );
if ( !baseOut.exists() ) {
logger.info( "create base dir -> {} -> {}", baseOut.getAbsolutePath(), baseOut.mkdirs() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

import java.io.File;

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

import test.org.fugerit.java.doc.sample.facade.BasicFacadeTest;

public class TestFo01 extends DevHelper {
class TestFo01 extends DevHelper {

@Test
public void test01() throws Exception {
void test01() throws Exception {
String testCase = "test-fo-01";
boolean res = this.workerFoToPdf( new File( "src/test/resources/dev/"+testCase+".fo" ),
new File( BasicFacadeTest.BASIC_OUTPUT_PATH, testCase+".pdf" ) );
Assert.assertTrue( res );
Assertions.assertTrue( res );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
import java.io.File;

import org.fugerit.java.doc.base.config.DocConfig;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import test.org.fugerit.java.doc.sample.facade.BasicFacadeTest;

public class TestHtml01 extends DevHelper {
class TestHtml01 extends DevHelper {

@Test
public void test01() throws Exception {
void test01() throws Exception {
String testCase = "test-xml-01";
boolean res = this.workerXmlToHtml( new File( "src/test/resources/dev/"+testCase+"."+DocConfig.TYPE_XML ),
new File( BasicFacadeTest.BASIC_OUTPUT_PATH, testCase+"."+DocConfig.TYPE_HTML) );
Assert.assertTrue( res );
Assertions.assertTrue( res );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
import org.fugerit.java.doc.base.facade.DocFacade;
import org.fugerit.java.doc.base.model.DocBase;
import org.fugerit.java.doc.mod.openpdf.ext.PdfTypeHandler;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import test.org.fugerit.java.doc.sample.facade.BasicFacadeTest;

public class TestItext2 extends DevHelper {
class TestItext2 extends DevHelper {

@Test
public void test01FoPdf() throws Exception {
void test01FoPdf() throws Exception {
Locale.setDefault( Locale.UK );
String testCase = "test-xml-01";
String type = DocConfig.TYPE_PDF;
Expand All @@ -32,7 +32,7 @@ public void test01FoPdf() throws Exception {
DocBase doc = DocFacade.parse( input );
handler.handle( DocInput.newInput( type, doc) , DocOutput.newOutput( output ) );
}
Assert.assertTrue( true );
Assertions.assertTrue( true );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@

import org.fugerit.java.doc.base.config.DocTypeHandler;
import org.fugerit.java.doc.base.typehandler.markdown.SimpleMarkdownExtTypeHandler;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import test.org.fugerit.java.doc.sample.facade.BasicFacadeTest;

public class TestMarkdown01 extends DevHelper {
class TestMarkdown01 extends DevHelper {

@Test
public void test01() throws Exception {
void test01() throws Exception {
Locale.setDefault( Locale.UK );
String testCase = "test-xml-01";
DocTypeHandler handler = SimpleMarkdownExtTypeHandler.HANDLER;
boolean res = this.workerXmlToHandler( new File( "src/test/resources/dev/"+testCase+".xml" ),
new File( BasicFacadeTest.BASIC_OUTPUT_PATH, testCase+"."+handler.getType() ), handler );
Assert.assertTrue( res );
Assertions.assertTrue( res );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,42 @@
import org.fugerit.java.doc.base.config.DocTypeHandler;
import org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandler;
import org.fugerit.java.doc.mod.fop.PdfFopTypeHandler;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import test.org.fugerit.java.doc.sample.facade.BasicFacadeTest;

public class TestXml01 extends DevHelper {
class TestXml01 extends DevHelper {

//@Test
public void test01() throws Exception {
void test01() throws Exception {
Locale.setDefault( Locale.UK );
String testCase = "test-xml-01";
DocTypeHandler handler = PdfFopTypeHandler.HANDLER;
boolean res = this.workerXmlToHandler( new File( "src/test/resources/dev/"+testCase+".xml" ),
new File( BasicFacadeTest.BASIC_OUTPUT_PATH, testCase+"."+handler.getType() ), handler );
Assert.assertTrue( res );
Assertions.assertTrue( res );
}

@Test
public void test01FoPdf() throws Exception {
void test01FoPdf() throws Exception {
Locale.setDefault( Locale.UK );
String testCase = "test-xml-01";
DocTypeHandler handler = PdfFopTypeHandler.HANDLER;
boolean res = this.workerXmlToFoToPdf( new File( "src/test/resources/dev/"+testCase+".xml" ),
new File( BasicFacadeTest.BASIC_OUTPUT_PATH, testCase+".fo" ),
new File( BasicFacadeTest.BASIC_OUTPUT_PATH, testCase+"."+handler.getType() ) );
Assert.assertTrue( res );
Assertions.assertTrue( res );
}

@Test
public void test01Html() throws Exception {
void test01Html() throws Exception {
Locale.setDefault( Locale.UK );
String testCase = "test-xml-01";
DocTypeHandler handler = FreeMarkerHtmlTypeHandler.HANDLER;
boolean res = this.workerXmlToHandler( new File( "src/test/resources/dev/"+testCase+".xml" ),
new File( BasicFacadeTest.BASIC_OUTPUT_PATH, testCase+"."+handler.getType() ), handler );
Assert.assertTrue( res );
Assertions.assertTrue( res );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.fugerit.java.doc.base.parser.DocValidationResult;
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfig;
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -51,11 +51,11 @@ public class BasicFacadeTest {
private boolean validate;

public BasicFacadeTest() {
this( "basic", DocConfig.TYPE_PDF, DocConfig.TYPE_XLS, DocConfig.TYPE_HTML );
this.setup( "basic", DocConfig.TYPE_PDF, DocConfig.TYPE_XLS, DocConfig.TYPE_HTML );
this.validate = VALIDATE_DEFAULT;
}

protected BasicFacadeTest( String nameBase, String ...typeList ) {
protected void setup( String nameBase, String ...typeList ) {
this.checkpoints = Checkpoints.newInstance( CheckpointFormatHelper.DEFAULT_DECORATION );
this.nameBase = nameBase;
this.types = new ArrayList<>();
Expand Down Expand Up @@ -164,7 +164,7 @@ public void produce( File outputFolder, String facadeId, DocBase doc, Reader rea
}

@Test
public void produce() throws Exception {
void produce() throws Exception {
File baseFile = new File(BASIC_OUTPUT_PATH);
if (!baseFile.exists()) {
logger.info("Create base path : {} ({})", baseFile.mkdirs(), baseFile.getCanonicalPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import org.fugerit.java.doc.base.config.DocConfig;

public class TestAutodocHelper extends BasicFacadeTest {
class TestAutodocHelper extends BasicFacadeTest {

public TestAutodocHelper() {
super( "autodoc_helper", DocConfig.TYPE_XML, DocConfig.TYPE_PDF, DocConfig.TYPE_XLSX, DocConfig.TYPE_HTML );
super.setup( "autodoc_helper", DocConfig.TYPE_XML, DocConfig.TYPE_PDF, DocConfig.TYPE_XLSX, DocConfig.TYPE_HTML );
}

}
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package test.org.fugerit.java.doc.sample.facade;

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

import org.fugerit.java.core.io.StreamIO;
import org.fugerit.java.core.util.collection.ListMapStringKey;
import org.fugerit.java.doc.sample.facade.DocCatalogEntry;
import org.fugerit.java.doc.sample.facade.DocCatalogSample;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestDocCatalogSample {
class TestDocCatalogSample {

private static final Logger logger = LoggerFactory.getLogger( TestDocCatalogSample.class );

@Test
public void testConfig() {
void testConfig() {
try {
DocCatalogSample catalog = DocCatalogSample.getInstance();
assertNotNull( "catalog must exists", catalog );
assertNotNull( catalog );
ListMapStringKey<DocCatalogEntry> list = catalog.getPlaygroundCoreCatalog();
DocCatalogEntry entry = list.get( "default" );
assertNotNull( "default entry must exists", entry );
assertNotNull( entry );
String content = StreamIO.readString( catalog.entryReader(entry) );
logger.info( "entry -> {}, content -> {}", entry, content );
assertNotNull( "entry content must exists", content );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
import org.fugerit.java.doc.base.facade.DocFacadeSource;
import org.fugerit.java.doc.base.kotlin.parse.DocKotlinParser;
import org.fugerit.java.doc.base.parser.DocParser;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

@Slf4j
public class TestDocFacadeSource {
class TestDocFacadeSource {

@Test
public void testKotlinYaml() {
void testKotlinYaml() {
DocParser docParser = DocFacadeSource.getInstance().getParserForSource( DocFacadeSource.SOURCE_TYPE_YAML );
log.info( "docParser yaml : {}", docParser );
Assert.assertNotNull( docParser );
Assertions.assertNotNull( docParser );
}

@Test
public void testKotlinSource() {
void testKotlinSource() {
DocParser docParser = DocFacadeSource.getInstance().getParserForSource( DocFacadeSource.SOURCE_TYPE_KOTLIN );
log.info( "docParser kotlin : {}", docParser );
Assert.assertNotNull( docParser );
Assertions.assertNotNull( docParser );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import org.fugerit.java.doc.base.config.DocConfig;

public class TestIntro01 extends BasicFacadeTest {
class TestIntro01 extends BasicFacadeTest {

public TestIntro01() {
super( "intro_01", DocConfig.TYPE_XML, DocConfig.TYPE_PDF, DocConfig.TYPE_XLS, DocConfig.TYPE_HTML );
super.setup( "intro_01", DocConfig.TYPE_XML, DocConfig.TYPE_PDF, DocConfig.TYPE_XLS, DocConfig.TYPE_HTML );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import org.fugerit.java.doc.base.config.DocConfig;

public class TestIntro01Json extends BasicFacadeTest {
class TestIntro01Json extends BasicFacadeTest {

public TestIntro01Json() {
super( "intro_01.json", DocConfig.TYPE_MD, DocConfig.TYPE_HTML, DocConfig.TYPE_PDF, DocConfig.TYPE_FO );
//super( "intro_01.json", DocConfig.TYPE_MD );
super.setup( "intro_01.json", DocConfig.TYPE_MD, DocConfig.TYPE_HTML, DocConfig.TYPE_PDF, DocConfig.TYPE_FO );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import org.fugerit.java.doc.base.config.DocConfig;

public class TestIntro01Yaml extends BasicFacadeTest {
class TestIntro01Yaml extends BasicFacadeTest {

public TestIntro01Yaml() {
super( "intro_01.yaml", DocConfig.TYPE_MD, DocConfig.TYPE_HTML, DocConfig.TYPE_PDF, DocConfig.TYPE_FO );
super.setup( "intro_01.yaml", DocConfig.TYPE_MD, DocConfig.TYPE_HTML, DocConfig.TYPE_PDF, DocConfig.TYPE_FO );
}

}
Loading