Skip to content

[fj-doc-lib-autodoc] migrate junit4 to junit5 #352 #355

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 1 commit into from
Mar 26, 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-lib-autodoc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,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,14 +1,14 @@
package test.org.fugerit.java.doc.lib.autodoc;

import org.fugerit.java.doc.lib.autodoc.AutodocModule;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class TestAutodocModule {
class TestAutodocModule {

@Test
public void testModule() {
Assert.assertEquals( AutodocModule.CURRENT_VERSION , new AutodocModule().getVersion() );
void testModule() {
Assertions.assertEquals( AutodocModule.CURRENT_VERSION , new AutodocModule().getVersion() );
}

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

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

import java.io.File;
import java.io.FileOutputStream;
Expand All @@ -9,18 +9,18 @@
import org.fugerit.java.doc.lib.autodoc.detail.model.AutodocDetail;
import org.fugerit.java.doc.lib.autodoc.facade.AutodocDetailFacade;
import org.fugerit.java.doc.lib.autodoc.parser.model.AutodocModel;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestAutodocDetailFacade {
class TestAutodocDetailFacade {

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

private static final String TARGET = "target/autodoc-detail.xml";

@Test
public void testParseXsdModel() {
void testParseXsdModel() {
try ( FileOutputStream fos = new FileOutputStream( new File( TARGET ) ) ) {
AutodocModel autodocModel = VenusAutodocFacade.parseLast();
AutodocDetail autodocDetail = AutodocDetailFacade.populateStub(autodocModel);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package test.org.fugerit.java.doc.lib.autodoc.facade;

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

import java.io.File;
import java.io.FileOutputStream;

import org.fugerit.java.doc.lib.autodoc.AutodocDocConfig;
import org.fugerit.java.doc.lib.autodoc.VenusAutodocFacade;
import org.fugerit.java.doc.lib.autodoc.parser.model.AutodocModel;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestAutodocDocConfig {
class TestAutodocDocConfig {

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

Expand All @@ -21,7 +21,7 @@ public class TestAutodocDocConfig {
//private static final String TARGET = "target/doc_xsd_config_ref.html";

@Test
public void testParseXsdModel() {
void testParseXsdModel() {
try ( FileOutputStream fos = new FileOutputStream( new File( TARGET ) ) ) {
AutodocModel autodocModel = VenusAutodocFacade.parseLast();
AutodocDocConfig docConfig = AutodocDocConfig.newConfig();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package test.org.fugerit.java.doc.lib.autodoc.facade;

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

import java.io.File;
import java.io.FileInputStream;
Expand All @@ -10,11 +10,11 @@
import org.fugerit.java.doc.lib.autodoc.detail.AutodocDetailModel;
import org.fugerit.java.doc.lib.autodoc.detail.model.AutodocDetail;
import org.fugerit.java.doc.lib.autodoc.facade.AutodocDetailFacade;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestAutodocDocConfigDetail {
class TestAutodocDocConfigDetail {

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

Expand All @@ -23,7 +23,7 @@ public class TestAutodocDocConfigDetail {
private static final String TARGET = "target/autodoc_detail.html";

@Test
public void testGenerateAutodocDetail() {
void testGenerateAutodocDetail() {
try ( FileInputStream fis = new FileInputStream( new File( SOURCE ) );
FileOutputStream fos = new FileOutputStream( new File( TARGET ) ) ) {
AutodocDetail autodocDetail = AutodocDetailFacade.unmarshal( fis );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
import org.fugerit.java.doc.lib.autodoc.AutodocDocConfig;
import org.fugerit.java.doc.lib.autodoc.facade.XsdParserFacade;
import org.fugerit.java.doc.lib.autodoc.parser.model.AutodocModel;
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.io.FileOutputStream;
import java.util.Properties;

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

@Slf4j
public class TestAutodocDocSchemaConfig {
class TestAutodocDocSchemaConfig {

private static final String TARGET = "target";

Expand All @@ -31,7 +31,7 @@ private static AutodocModel parseSample1() throws ConfigException {
}

@Test
public void testParseXsdModel() {
void testParseXsdModel() {
File outputFile = new File( TARGET, "xsd_ref_sample_1.html" );
try ( FileOutputStream fos = new FileOutputStream( outputFile ) ) {
AutodocModel autodocModel = parseSample1();
Expand All @@ -40,7 +40,7 @@ public void testParseXsdModel() {
docConfig.processAutodocSchemaHtmlDefault(autodocModel, fos, params);
autodocModel.getTypes().forEach( t -> log.info( "key : {}", t.getKey() ) );
autodocModel.getSimpleTypes().forEach( st -> log.info( "note : {}", st.getNote() ) );
Assert.assertTrue( outputFile.exists() );
Assertions.assertTrue( outputFile.exists() );
} catch (Exception e) {
String message = "Error : "+e;
log.error( message, e );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package test.org.fugerit.java.doc.lib.autodoc.facade;

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

import java.io.File;
import java.io.FileOutputStream;
Expand All @@ -9,18 +9,18 @@
import org.fugerit.java.doc.lib.autodoc.AutodocDocConfig;
import org.fugerit.java.doc.lib.autodoc.VenusFreemarkerAutodocFacade;
import org.fugerit.java.doc.lib.autodoc.parser.model.AutodocModel;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestFreemarkerAutodocDocConfig {
class TestFreemarkerAutodocDocConfig {

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

private static final String TARGET = "../fj-doc-freemarker/src/main/docs/fdp_xsd_config_ref.html";

@Test
public void testParseXsdModel() {
void testParseXsdModel() {
try ( FileOutputStream fos = new FileOutputStream( new File( TARGET ) );
FileOutputStream fosSchema = new FileOutputStream( new File( "target/test-schema.html" ) ) ) {
AutodocModel autodocModel = VenusFreemarkerAutodocFacade.parseLast();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package test.org.fugerit.java.doc.lib.autodoc.facade;

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

import java.io.File;
import java.io.FileOutputStream;
Expand All @@ -15,15 +15,15 @@
import org.fugerit.java.doc.lib.autodoc.parser.model.AutodocModel;
import org.fugerit.java.doc.lib.simpletable.SimpleTableDocConfig;
import org.fugerit.java.doc.lib.simpletable.model.SimpleTable;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TestXsdParserFacade {
class TestXsdParserFacade {

@Test
public void testParseXsdModel() {
void testParseXsdModel() {
DocTypeHandler handler = FreeMarkerHtmlTypeHandler.HANDLER;
try ( FileOutputStream fos = new FileOutputStream( new File( "target/autodoc."+handler.getType() ) ) ) {
AutodocModel autodocModel = VenusAutodocFacade.parseLast();
Expand Down Expand Up @@ -66,7 +66,7 @@ private static AutodocModel parseCustom() throws ConfigException {
}

@Test
public void testParseXsdModelCustom() {
void testParseXsdModelCustom() {
DocTypeHandler handler = FreeMarkerHtmlTypeHandler.HANDLER;
try ( FileOutputStream fos = new FileOutputStream( new File( "target/autodoc."+handler.getType() ) ) ) {
AutodocModel autodocModel = parseCustom();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
import java.util.ArrayList;

import org.fugerit.java.doc.lib.autodoc.fun.AnnotationAsSingleStringFun;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import freemarker.template.TemplateModelException;

public class TestAnnotationAsSingleStringFun {
class TestAnnotationAsSingleStringFun {

@Test
public void testNoParam() {
void testNoParam() {
AnnotationAsSingleStringFun fun = new AnnotationAsSingleStringFun();
Assert.assertThrows( TemplateModelException.class , () -> fun.exec( new ArrayList<String>() ) );
Assertions.assertThrows( TemplateModelException.class , () -> fun.exec( new ArrayList<String>() ) );
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package test.org.fugerit.java.doc.lib.autodoc.meta;

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

import java.io.ByteArrayOutputStream;
import java.io.File;
Expand All @@ -18,7 +18,7 @@
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class GenerateDocHelper {
class GenerateDocHelper {

protected boolean docWorker( String sourcePath, String destPath, DocTypeHandler handler ) {
boolean ok = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package test.org.fugerit.java.doc.lib.autodoc.meta;

import org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandler;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class TestGenerateDocMetaInfo extends GenerateDocHelper {
class TestGenerateDocMetaInfo extends GenerateDocHelper {

@Test
public void generateHtml() {
void generateHtml() {
boolean ok = this.docWorker( "docs/meta_xml/adm_standard_meta_info.xml" , "../docs/html/doc_meta_info.html", FreeMarkerHtmlTypeHandler.HANDLER_UTF8 );
Assert.assertTrue( ok );
Assertions.assertTrue( ok );
}

}
Loading