diff --git a/fj-doc-freemarker/pom.xml b/fj-doc-freemarker/pom.xml
index c45027f69..9a698fc3a 100644
--- a/fj-doc-freemarker/pom.xml
+++ b/fj-doc-freemarker/pom.xml
@@ -109,8 +109,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api
test
diff --git a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/coverage/TestFreemarkerCoverage.java b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/coverage/TestFreemarkerCoverage.java
index 4b9c1d05b..d64796c58 100644
--- a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/coverage/TestFreemarkerCoverage.java
+++ b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/coverage/TestFreemarkerCoverage.java
@@ -15,16 +15,16 @@
import org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlFragmentTypeHandlerUTF8;
import org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandler;
import org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandlerUTF8;
-import org.junit.Assert;
-import org.junit.Test;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
@Slf4j
-public class TestFreemarkerCoverage {
+class TestFreemarkerCoverage {
private final static TestEntry[] TEST_LIST = {
new TestEntry( "default_doc" , true ),
@@ -58,16 +58,16 @@ private boolean worker( String path, boolean result ) {
}
@Test
- public void test01() {
+ void test01() {
Arrays.asList( TEST_LIST ).stream().forEach( c -> {
log.info( "test -> {}", c );
- Assert.assertTrue( this.worker( "coverage/xml/"+c.getId()+".xml", c.isResult() ) );
+ Assertions.assertTrue( this.worker( "coverage/xml/"+c.getId()+".xml", c.isResult() ) );
} );
- Assert.assertTrue( Boolean.TRUE );
+ Assertions.assertTrue( Boolean.TRUE );
}
@Test
- public void testAsciidoc() {
+ void testAsciidoc() {
String docId = "asciidoc";
DocTypeHandler handler = FreeMarkerAsciidocTypeHandler.HANDLER_UTF8;
String type = DocConfig.TYPE_ADOC;
@@ -78,7 +78,7 @@ public void testAsciidoc() {
handler.handle( DocInput.newInput( handler.getType() , reader ) , DocOutput.newOutput( fos ) );
}
} );
- Assert.assertTrue( outputFile.exists() );
+ Assertions.assertTrue( outputFile.exists() );
}
}
diff --git a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreeMarkerConstants.java b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreeMarkerConstants.java
index 1121f5064..767d85b5d 100644
--- a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreeMarkerConstants.java
+++ b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreeMarkerConstants.java
@@ -2,14 +2,14 @@
import org.fugerit.java.doc.base.process.DocProcessContext;
import org.fugerit.java.doc.freemarker.config.FreeMarkerConstants;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
-public class TestFreeMarkerConstants {
+class TestFreeMarkerConstants {
@Test
- public void testFreeMarkerConstants() {
- Assert.assertNotNull(FreeMarkerConstants.getFreeMarkerMap(DocProcessContext.newContext()));
+ void testFreeMarkerConstants() {
+ Assertions.assertNotNull(FreeMarkerConstants.getFreeMarkerMap(DocProcessContext.newContext()));
}
}
diff --git a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerConfigStep.java b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerConfigStep.java
index e240161e7..1d7900f58 100644
--- a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerConfigStep.java
+++ b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerConfigStep.java
@@ -6,40 +6,40 @@
import org.fugerit.java.doc.base.process.DocProcessContext;
import org.fugerit.java.doc.base.process.DocProcessData;
import org.fugerit.java.doc.freemarker.config.FreeMarkerConfigStep;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import java.util.Properties;
-public class TestFreemarkerConfigStep {
+class TestFreemarkerConfigStep {
@Test
- public void test() throws Exception {
+ void test() throws Exception {
Properties params = new Properties();
FreeMarkerConfigStep step = new FreeMarkerConfigStep();
step.setCustomConfig( params );
DocProcessContext context = new DocProcessContext();
DocProcessData data = new DocProcessData();
- Assert.assertThrows( ConfigRuntimeException.class, () -> step.process( context, data ) ) ;
+ Assertions.assertThrows( ConfigRuntimeException.class, () -> step.process( context, data ) ) ;
params.setProperty( "id", "FJ_DOC_TEST_1" );
params.setProperty( "version", "2.3.31" );
params.setProperty( "mode", "class" );
- Assert.assertThrows( ConfigRuntimeException.class, () -> step.process( context, data ) ) ;
+ Assertions.assertThrows( ConfigRuntimeException.class, () -> step.process( context, data ) ) ;
params.setProperty( "id", "FJ_DOC_TEST_2" );
params.setProperty( "path", "/fj_doc_test/template/" );
params.setProperty( "class", "org.fugerit.java.doc.freemarker.fun.ImageBase64CLFun" );
params.setProperty( "exception-handler", "RETHROW_HANDLER" );
- Assert.assertEquals(MiniFilter.CONTINUE, step.process( context, data ) );
+ Assertions.assertEquals(MiniFilter.CONTINUE, step.process( context, data ) );
params.setProperty( "id", "FJ_DOC_TEST_3" );
params.setProperty( FreeMarkerConfigStep.ATT_FREEMARKER_CONFIG_KEY_MODE, FreeMarkerConfigStep.ATT_FREEMARKER_CONFIG_KEY_MODE_FOLDER );
params.setProperty( FreeMarkerConfigStep.ATT_FREEMARKER_CONFIG_KEY_PATH, "target" );
- Assert.assertEquals(MiniFilter.CONTINUE, step.process( context, data ) );
+ Assertions.assertEquals(MiniFilter.CONTINUE, step.process( context, data ) );
params.setProperty( "id", "FJ_DOC_TEST_4" );
params.remove( FreeMarkerConfigStep.ATT_FREEMARKER_CONFIG_KEY_CLASS );
- Assert.assertEquals(MiniFilter.CONTINUE, step.process( context, data ) );
+ Assertions.assertEquals(MiniFilter.CONTINUE, step.process( context, data ) );
params.setProperty( "id", "FJ_DOC_TEST_5" );
params.setProperty( FreeMarkerConfigStep.ATT_FREEMARKER_CONFIG_KEY_LOAD_BUNDLED_FUN, BooleanUtils.BOOLEAN_TRUE);
- Assert.assertEquals(MiniFilter.CONTINUE, step.process( context, data ) );
+ Assertions.assertEquals(MiniFilter.CONTINUE, step.process( context, data ) );
}
}
diff --git a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerDocProcessConfig.java b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerDocProcessConfig.java
index 361c054f5..9f8337194 100644
--- a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerDocProcessConfig.java
+++ b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerDocProcessConfig.java
@@ -1,6 +1,5 @@
package test.org.fugerit.java.doc.freemarker.process;
-import static org.junit.Assert.fail;
import java.io.*;
import java.time.LocalDateTime;
@@ -29,19 +28,19 @@
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfig;
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigValidator;
-import org.junit.Assert;
-import org.junit.Test;
import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import test.org.fugerit.java.BasicTest;
@Slf4j
-public class TestFreemarkerDocProcessConfig extends BasicTest {
+class TestFreemarkerDocProcessConfig extends BasicTest {
private static final String MAIN_CONFIG = "fj_doc_test/freemarker-doc-process.xml";
@Test
- public void testConfigRead001() throws Exception {
+ void testConfigRead001() throws Exception {
String[] configList = { MAIN_CONFIG, "fj_doc_test/freemarker-doc-process-1.xml", "fj_doc_test/freemarker-doc-process-2.xml", "fj_doc_test/freemarker-doc-process-3.xml" };
for ( int k=0 ;k config.fullProcess( chainIdError, context, DocConfig.TYPE_HTML, fos ) );
+ Assertions.assertThrows( ConfigRuntimeException.class, () -> config.fullProcess( chainIdError, context, DocConfig.TYPE_HTML, fos ) );
} else {
config.fullProcess( chainIdError, context, DocConfig.TYPE_HTML, fos );
}
@@ -69,7 +68,7 @@ public void testConfigRead001() throws Exception {
}
@Test
- public void testSource() throws Exception {
+ void testSource() throws Exception {
FreemarkerDocProcessConfig config = FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://"+MAIN_CONFIG );
String[] chainId = { "xml", "json", "yaml" };
for ( int k=0 ;k config.fullProcess( "not-exists", context, DocConfig.TYPE_HTML, os ) );
+ Assertions.assertThrows( ConfigRuntimeException.class, () -> config.fullProcess( "not-exists", context, DocConfig.TYPE_HTML, os ) );
}
}
@Test
- public void testSkipFM() throws Exception {
+ void testSkipFM() throws Exception {
DocProcessContext context = DocProcessContext.newContext();
DocProcessData data = new DocProcessData();
FreeMarkerConfigStep configStep = new FreeMarkerConfigStep();
@@ -103,23 +102,23 @@ public void testSkipFM() throws Exception {
FreeMarkerSkipProcessStep step = new FreeMarkerSkipProcessStep();
step.setParam01( "asciidoc-xml.ftl" );
step.process( context, data );
- Assert.assertNotNull( data.getCurrentXmlData() );
+ Assertions.assertNotNull( data.getCurrentXmlData() );
}
@Test
- public void testConfigFail01() {
- Assert.assertThrows( ConfigRuntimeException.class , () -> FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://not-exists.xml" ) );
+ void testConfigFail01() {
+ Assertions.assertThrows( ConfigRuntimeException.class , () -> FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://not-exists.xml" ) );
}
@Test
- public void testConfigFail02() {
+ void testConfigFail02() {
Reader reader = null;
- Assert.assertThrows( ConfigException.class , () -> FreemarkerDocProcessConfigFacade.loadConfig( reader ) );
+ Assertions.assertThrows( ConfigException.class , () -> FreemarkerDocProcessConfigFacade.loadConfig( reader ) );
}
@Test
- public void testConfigSec() {
- Assert.assertNotNull( FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://fj_doc_test/freemarker-doc-process_sec.xml" ) );
+ void testConfigSec() {
+ Assertions.assertNotNull( FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://fj_doc_test/freemarker-doc-process_sec.xml" ) );
}
@@ -138,12 +137,12 @@ private void templateTesting( FreemarkerDocProcessConfig config ) {
runTestEx( () -> {
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
// need to make it work in the future!
- Assert.assertThrows( NullPointerException.class, () -> {
+ Assertions.assertThrows( NullPointerException.class, () -> {
config.process( "test_01_inline", DocConfig.TYPE_MD, context, baos, false );
} );
}
} );
- Assert.assertThrows( ConfigException.class , () -> {
+ Assertions.assertThrows( ConfigException.class , () -> {
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
config.process( "test_01_fail", DocConfig.TYPE_MD, context, baos, false );
}
@@ -151,45 +150,45 @@ private void templateTesting( FreemarkerDocProcessConfig config ) {
}
@Test
- public void testConfigRead002() {
+ void testConfigRead002() {
FreemarkerDocProcessConfig config =
FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://fj_doc_test/freemarker-doc-process_alt.xml" );
- Assert.assertNotNull( config );
+ Assertions.assertNotNull( config );
this.templateTesting(config);
log.info( "keys : {}", config.getKeys() );
}
@Test
- public void testConfigValidate001() {
+ void testConfigValidate001() {
try ( Reader xmlReader = new InputStreamReader( ClassHelper.loadFromDefaultClassLoader( "fj_doc_test/freemarker-doc-process.xml" ) ) ) {
FreemarkerDocProcessConfigValidator.logValidation( xmlReader );
} catch (Exception e) {
String message = "Error : "+e;
log.error( message, e );
- fail(message);
+ Assertions.fail(message);
}
}
@Test
- public void testNewSimpleConfig() {
+ void testNewSimpleConfig() {
try {
- Assert.assertNotNull( FreemarkerDocProcessConfigFacade.newSimpleConfig( "simple-config-001", "/template").getChainCache( "test" ) );
+ Assertions.assertNotNull( FreemarkerDocProcessConfigFacade.newSimpleConfig( "simple-config-001", "/template").getChainCache( "test" ) );
} catch (Exception e) {
this.failEx(e);
}
}
@Test
- public void testNewSimpleConfigVersion() {
+ void testNewSimpleConfigVersion() {
try {
- Assert.assertNotNull( FreemarkerDocProcessConfigFacade.newSimpleConfig( "simple-config-002", "/template", FreeMarkerConfigStep.ATT_FREEMARKER_CONFIG_KEY_VERSION_2_3_31 ).getChainCache( "test" ) );
+ Assertions.assertNotNull( FreemarkerDocProcessConfigFacade.newSimpleConfig( "simple-config-002", "/template", FreeMarkerConfigStep.ATT_FREEMARKER_CONFIG_KEY_VERSION_2_3_31 ).getChainCache( "test" ) );
} catch (Exception e) {
this.failEx(e);
}
}
@Test
- public void testProcess() {
+ void testProcess() {
SafeFunction.apply( () -> {
FreemarkerDocProcessConfig config = FreemarkerDocProcessConfigFacade.newSimpleConfig( "simple-config-003", "/fj_doc_test/template/" );
config.getFacade().registerHandler( FreeMarkerHtmlTypeHandlerUTF8.HANDLER );
@@ -197,7 +196,7 @@ public void testProcess() {
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
DocProcessData data = config.fullProcess( "test_02" ,
DocProcessContext.newContext(), DocConfig.TYPE_HTML, baos );
- Assert.assertNotEquals( 0 , data.getCurrentXmlData().length() );
+ Assertions.assertNotEquals( 0 , data.getCurrentXmlData().length() );
}
// test process 1
// handler list :
@@ -210,27 +209,27 @@ public void testProcess() {
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
DocProcessData data = new DocProcessData();
config.process( "test_02" , DocProcessContext.newContext( "testKey", "" ), data, FreeMarkerHtmlTypeHandlerUTF8.HANDLER, DocOutput.newOutput(baos) );
- Assert.assertNotEquals( 0 , data.getCurrentXmlData().length() );
+ Assertions.assertNotEquals( 0 , data.getCurrentXmlData().length() );
File file = new File( "target/test_02_handler_"+k+".xml" );
FileIO.writeBytes( data.getCurrentXmlData().getBytes() , file );
}
}
} );
- Assert.assertTrue( Boolean.TRUE );
+ Assertions.assertTrue( Boolean.TRUE );
}
@Test
- public void testLoadConfigKo() {
+ void testLoadConfigKo() {
String fullPath = "fj_doc_test/freemarker-doc-process_ko.xml";
- Assert.assertThrows( ConfigRuntimeException.class, () -> FreemarkerDocProcessConfigFacade.loadConfigSafe( fullPath ) );
+ Assertions.assertThrows( ConfigRuntimeException.class, () -> FreemarkerDocProcessConfigFacade.loadConfigSafe( fullPath ) );
try {
FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://not-exists.xml" );
} catch (ConfigRuntimeException e) {
log.error( String.format( "Error : %s", e ), e );
- Assert.assertTrue( e.getMessage().contains( FreemarkerDocProcessConfigFacade.ERROR_CONFIG_PATH_NOT_FOUND_BASE_MESSAGE ) );
+ Assertions.assertTrue( e.getMessage().contains( FreemarkerDocProcessConfigFacade.ERROR_CONFIG_PATH_NOT_FOUND_BASE_MESSAGE ) );
}
Exception testEx = new ConfigRuntimeException( "ex1", new ConfigRuntimeException( "ex0" ) );
- Assert.assertEquals( ConfigRuntimeException.class, FreemarkerDocProcessConfigFacade.EX_CONSUMER_LOAD_CONFIG.apply( testEx ).getClass() );
+ Assertions.assertEquals( ConfigRuntimeException.class, FreemarkerDocProcessConfigFacade.EX_CONSUMER_LOAD_CONFIG.apply( testEx ).getClass() );
}
}
diff --git a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerDocProcessConfigValidator.java b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerDocProcessConfigValidator.java
index 8bcd61b2d..be0fa0af7 100644
--- a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerDocProcessConfigValidator.java
+++ b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerDocProcessConfigValidator.java
@@ -1,7 +1,5 @@
package test.org.fugerit.java.doc.freemarker.process;
-import static org.junit.Assert.fail;
-
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
@@ -10,25 +8,26 @@
import org.fugerit.java.core.xml.XMLException;
import org.fugerit.java.core.xml.sax.SAXParseResult;
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigValidator;
-import org.junit.Assert;
-import org.junit.Test;
+
import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import test.org.fugerit.java.helpers.io.ReaderFail;
@Slf4j
-public class TestFreemarkerDocProcessConfigValidator {
+class TestFreemarkerDocProcessConfigValidator {
private static final String VALID_XML_PATH = "fj_doc_test/freemarker-doc-process.xml";
private void failEx( Exception e ) {
String message = "Error : "+e.getMessage();
log.error( message, e );
- fail( message );
+ Assertions.fail( message );
}
@Test
- public void testValidate() {
+ void testValidate() {
String fullPath = VALID_XML_PATH;
log.info( "validate -> {}", fullPath );
try ( InputStream is = ClassHelper.loadFromDefaultClassLoader( fullPath );
@@ -37,14 +36,14 @@ public void testValidate() {
boolean ok = result.isPartialSuccess();
FreemarkerDocProcessConfigValidator.logResult(result);
log.info( "Validation result {}", ok );
- Assert.assertTrue( ok );
+ Assertions.assertTrue( ok );
} catch (Exception e) {
this.failEx(e);
}
}
@Test
- public void testValidateVersion() {
+ void testValidateVersion() {
String fullPath = VALID_XML_PATH;
log.info( "validate -> {}", fullPath );
try ( InputStream is = ClassHelper.loadFromDefaultClassLoader( fullPath );
@@ -53,76 +52,76 @@ public void testValidateVersion() {
boolean ok = result.isPartialSuccess();
FreemarkerDocProcessConfigValidator.logResult(result);
log.info( "Validation result {}", ok );
- Assert.assertTrue( ok );
+ Assertions.assertTrue( ok );
} catch (Exception e) {
this.failEx(e);
}
}
@Test
- public void testValidateLoggerKo() {
+ void testValidateLoggerKo() {
String fullPath = "fj_doc_test/freemarker-doc-process_ko.xml";
log.info( "validate -> {}", fullPath );
try ( InputStream is = ClassHelper.loadFromDefaultClassLoader( fullPath );
Reader reader = new InputStreamReader(is)) {
boolean ok = FreemarkerDocProcessConfigValidator.logValidation(reader);
log.info( "Validation result {}", ok );
- Assert.assertTrue( !ok );
+ Assertions.assertTrue( !ok );
} catch (Exception e) {
this.failEx(e);
}
}
@Test
- public void testValidateLoggerOk() {
+ void testValidateLoggerOk() {
String fullPath = VALID_XML_PATH;
log.info( "validate -> {}", fullPath );
try ( InputStream is = ClassHelper.loadFromDefaultClassLoader( fullPath );
Reader reader = new InputStreamReader(is)) {
boolean ok = FreemarkerDocProcessConfigValidator.logValidation(reader);
log.info( "Validation result {}", ok );
- Assert.assertTrue( ok );
+ Assertions.assertTrue( ok );
} catch (Exception e) {
this.failEx(e);
}
}
@Test
- public void testValidateFail() {
- Assert.assertThrows( XMLException.class, () -> {
+ void testValidateFail() {
+ Assertions.assertThrows( XMLException.class, () -> {
try ( Reader reader = new ReaderFail() ) {
SAXParseResult result = FreemarkerDocProcessConfigValidator.validate( reader );
- fail( "Should not get here : "+result );
+ Assertions.fail( "Should not get here : "+result );
}
} );
}
@Test
- public void testValidateVersionFail() {
- Assert.assertThrows( XMLException.class, () -> {
+ void testValidateVersionFail() {
+ Assertions.assertThrows( XMLException.class, () -> {
try ( Reader reader = new ReaderFail() ) {
SAXParseResult result = FreemarkerDocProcessConfigValidator.validateVersion( reader );
- fail( "Should not get here : "+result );
+ Assertions.fail( "Should not get here : "+result );
}
} );
}
@Test
- public void testValidateLoggerFail() {
- Assert.assertThrows( XMLException.class, () -> {
+ void testValidateLoggerFail() {
+ Assertions.assertThrows( XMLException.class, () -> {
try ( Reader reader = new ReaderFail() ) {
boolean result = FreemarkerDocProcessConfigValidator.logValidation( reader );
- fail( "Should not get here : "+result );
+ Assertions.fail( "Should not get here : "+result );
}
} );
}
@Test
- public void testGetXsdVersion() {
- Assert.assertThrows( XMLException.class, () -> {
+ void testGetXsdVersion() {
+ Assertions.assertThrows( XMLException.class, () -> {
try ( Reader reader = new ReaderFail() ) {
String result = FreemarkerDocProcessConfigValidator.getXsdVersion(reader);
- fail( "Should not get here : "+result );
+ Assertions.fail( "Should not get here : "+result );
}
} );
}
diff --git a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerGenerateStub.java b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerGenerateStub.java
index d0349515d..5699d4918 100644
--- a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerGenerateStub.java
+++ b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerGenerateStub.java
@@ -1,28 +1,27 @@
package test.org.fugerit.java.doc.freemarker.process;
-import static org.junit.Assert.fail;
-
import java.io.File;
import java.io.FileWriter;
import java.io.Writer;
import java.util.Properties;
import org.fugerit.java.doc.freemarker.tool.GenerateStub;
-import org.junit.Test;
import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
@Slf4j
-public class TestFreemarkerGenerateStub {
+class TestFreemarkerGenerateStub {
@Test
- public void testGenerateStub() {
+ void testGenerateStub() {
try ( Writer writer = new FileWriter( new File( "target/freemarker-doc-process-config-stub.xml" ) ) ) {
GenerateStub.generate(writer, new Properties() );
} catch (Exception e) {
String message = "Error : "+e;
log.error( message, e );
- fail(message);
+ Assertions.fail(message);
}
}
diff --git a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerKotlinStep.java b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerKotlinStep.java
index 45e0f3625..7af66109d 100644
--- a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerKotlinStep.java
+++ b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerKotlinStep.java
@@ -2,16 +2,14 @@
import lombok.extern.slf4j.Slf4j;
import org.fugerit.java.core.cfg.ConfigRuntimeException;
-import org.fugerit.java.core.lang.helpers.BooleanUtils;
import org.fugerit.java.doc.base.kotlin.parse.DocKotlinParser;
import org.fugerit.java.doc.base.process.DocProcessContext;
import org.fugerit.java.doc.base.process.DocProcessData;
import org.fugerit.java.doc.freemarker.config.FreeMarkerComplexProcessStep;
import org.fugerit.java.doc.freemarker.config.FreeMarkerConstants;
import org.fugerit.java.doc.freemarker.config.FreeMarkerKotlinStep;
-import org.fugerit.java.doc.json.parse.DocJsonParser;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.HashMap;
@@ -19,22 +17,22 @@
import java.util.Properties;
@Slf4j
-public class TestFreemarkerKotlinStep {
+class TestFreemarkerKotlinStep {
private static final String KTS_PATH_SAMPLE = "coverage/kts/document-kotlin.kts";
@Test
- public void testKotlinStep() throws Exception {
+ void testKotlinStep() throws Exception {
DocProcessContext context = DocProcessContext.newContext(FreeMarkerConstants.ATT_FREEMARKER_MAP, new HashMap<>() );
DocProcessData data = new DocProcessData();
// fail no parser
FreeMarkerKotlinStep stepFailNoParser = new FreeMarkerKotlinStep( -1 );
stepFailNoParser.setCustomConfig( new Properties() );
- Assert.assertThrows( ConfigRuntimeException.class, () -> stepFailNoParser.process(context, data ) );
+ Assertions.assertThrows( ConfigRuntimeException.class, () -> stepFailNoParser.process(context, data ) );
// fail no kts
FreeMarkerKotlinStep stepFailNoKtsPath = new FreeMarkerKotlinStep();
stepFailNoKtsPath.setCustomConfig( new Properties() );
- Assert.assertThrows( ConfigRuntimeException.class, () -> stepFailNoKtsPath.process(context, data ) );
+ Assertions.assertThrows( ConfigRuntimeException.class, () -> stepFailNoKtsPath.process(context, data ) );
// test ok
FreeMarkerKotlinStep stepOk = new FreeMarkerKotlinStep();
Properties customConfig = new Properties();
@@ -45,14 +43,14 @@ public void testKotlinStep() throws Exception {
stepOk.getCustomConfig().setProperty( FreeMarkerComplexProcessStep.ATT_MAP_ATTS, "listPeople" );
log.info( "customConfig >> : {}", stepOk.getCustomConfig() );
stepOk.process( context.withAtt( "listPeople", listPeople ), data );
- Assert.assertNotNull( data.getCurrentXmlData() );
+ Assertions.assertNotNull( data.getCurrentXmlData() );
// test using kts-path
customConfig.setProperty( FreeMarkerKotlinStep.ATT_KTS_PATH, KTS_PATH_SAMPLE );
stepOk.process( context, data );
- Assert.assertNotNull( data.getCurrentXmlData() );
+ Assertions.assertNotNull( data.getCurrentXmlData() );
// convert test
- Assert.assertThrows( ConfigRuntimeException.class, () -> FreeMarkerKotlinStep.convertOrExceptiopn( stepOk ) );
- Assert.assertNotNull( FreeMarkerKotlinStep.convertOrExceptiopn( new DocKotlinParser() ) );
+ Assertions.assertThrows( ConfigRuntimeException.class, () -> FreeMarkerKotlinStep.convertOrExceptiopn( stepOk ) );
+ Assertions.assertNotNull( FreeMarkerKotlinStep.convertOrExceptiopn( new DocKotlinParser() ) );
}
}
diff --git a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/tool/TestFreeMarkerTemplateSyntaxyVerifier.java b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/tool/TestFreeMarkerTemplateSyntaxyVerifier.java
index 1b6a81158..d1c7b5b50 100644
--- a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/tool/TestFreeMarkerTemplateSyntaxyVerifier.java
+++ b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/tool/TestFreeMarkerTemplateSyntaxyVerifier.java
@@ -4,12 +4,11 @@
import org.fugerit.java.core.cfg.ConfigRuntimeException;
import org.fugerit.java.core.function.SafeFunction;
import org.fugerit.java.core.util.result.Result;
-import org.fugerit.java.doc.base.config.DocConfig;
import org.fugerit.java.doc.freemarker.tool.FreeMarkerTemplateSyntaxVerifier;
import org.fugerit.java.doc.freemarker.tool.verify.VerifyTemplateInfo;
import org.fugerit.java.doc.freemarker.tool.verify.VerifyTemplateOutput;
-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.BasicTest;
import java.io.File;
@@ -19,7 +18,7 @@
import java.util.function.Function;
@Slf4j
-public class TestFreeMarkerTemplateSyntaxyVerifier extends BasicTest {
+class TestFreeMarkerTemplateSyntaxyVerifier extends BasicTest {
private VerifyTemplateOutput verifyWorker(String basePath) {
return this.verifyWorker( basePath, f -> FreeMarkerTemplateSyntaxVerifier.doCreateConfigurationAndVerify( f ) );
@@ -40,30 +39,30 @@ private VerifyTemplateOutput verifyWorker(String basePath, Function {
VerifyTemplateOutput output = verifyWorker( basePath );
- Assert.assertEquals(Result.RESULT_CODE_OK, output.getResultCode());
+ Assertions.assertEquals(Result.RESULT_CODE_OK, output.getResultCode());
}
);
- Assert.assertTrue( Boolean.TRUE );
+ Assertions.assertTrue( Boolean.TRUE );
}
@Test
- public void verifyTestKo() {
+ void verifyTestKo() {
Arrays.asList( "src/test/resources/fj_doc_test/template-fail" ).forEach(
basePath -> {
VerifyTemplateOutput output = verifyWorker( basePath );
- Assert.assertEquals(Result.RESULT_CODE_KO, output.getResultCode());
+ Assertions.assertEquals(Result.RESULT_CODE_KO, output.getResultCode());
}
);
- Assert.assertTrue( Boolean.TRUE );
+ Assertions.assertTrue( Boolean.TRUE );
}
@Test
- public void verifyTemplateFilePattern() {
+ void verifyTemplateFilePattern() {
Properties params = new Properties();
params.setProperty( FreeMarkerTemplateSyntaxVerifier.PARAM_TEMPLATE_FILE_PATTERN, ".{0,}[.]ftl" );
params.setProperty( FreeMarkerTemplateSyntaxVerifier.PARAM_GENERATE_REPORT, "1" );
@@ -75,32 +74,32 @@ public void verifyTemplateFilePattern() {
basePath -> {
VerifyTemplateOutput output = this.verifyWorker( basePath,
f -> verifier.createConfigurationAndVerify( f, params ) );
- Assert.assertEquals(Result.RESULT_CODE_OK, output.getResultCode());
+ Assertions.assertEquals(Result.RESULT_CODE_OK, output.getResultCode());
}
);
// check missing report folder
params.remove( FreeMarkerTemplateSyntaxVerifier.PARAM_REPORT_OUTPUT_FOLDER );
Arrays.asList( "src/test/resources/fj_doc_test/template-fail" ).forEach(
basePath -> {
- Assert.assertThrows( ConfigRuntimeException.class, () -> this.verifyWorker( basePath,
+ Assertions.assertThrows( ConfigRuntimeException.class, () -> this.verifyWorker( basePath,
f -> verifier.createConfigurationAndVerify( f, params ) ) );
}
);
- Assert.assertTrue( Boolean.TRUE );
+ Assertions.assertTrue( Boolean.TRUE );
}
@Test
- public void checkPojo() {
- Assert.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( Result.RESULT_CODE_OK, null ) );
- Assert.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( Result.RESULT_CODE_OK, null, null ) );
- Assert.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( null, "1" ) );
- Assert.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( null, "2", null ) );
- Assert.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( null, null ) );
- Assert.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( null, null, null ) );
+ void checkPojo() {
+ Assertions.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( Result.RESULT_CODE_OK, null ) );
+ Assertions.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( Result.RESULT_CODE_OK, null, null ) );
+ Assertions.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( null, "1" ) );
+ Assertions.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( null, "2", null ) );
+ Assertions.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( null, null ) );
+ Assertions.assertThrows( NullPointerException.class, () -> new VerifyTemplateInfo( null, null, null ) );
}
@Test
- public void failReport() {
+ void failReport() {
VerifyTemplateOutput output = new VerifyTemplateOutput() {
@Override
public List getInfos() {
@@ -114,7 +113,7 @@ public List getInfos() {
Properties params = new Properties();
params.setProperty( FreeMarkerTemplateSyntaxVerifier.PARAM_GENERATE_REPORT, "1" );
params.setProperty( FreeMarkerTemplateSyntaxVerifier.PARAM_REPORT_OUTPUT_FOLDER, "target/report-fail" );
- Assert.assertThrows( ConfigRuntimeException.class, () -> verifier.generateReport( output, params ) );
+ Assertions.assertThrows( ConfigRuntimeException.class, () -> verifier.generateReport( output, params ) );
}
}
diff --git a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/tool/TestGenerateStub.java b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/tool/TestGenerateStub.java
index 60ab7d75e..8f6141fb3 100644
--- a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/tool/TestGenerateStub.java
+++ b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/tool/TestGenerateStub.java
@@ -7,15 +7,15 @@
import org.fugerit.java.core.function.SafeFunction;
import org.fugerit.java.core.lang.helpers.ClassHelper;
import org.fugerit.java.doc.freemarker.tool.GenerateStub;
-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.BasicTest;
-public class TestGenerateStub extends BasicTest {
+class TestGenerateStub extends BasicTest {
@Test
- public void genTest001() {
+ void genTest001() {
int result = SafeFunction.get( () -> {
try ( InputStream is = ClassHelper.loadFromDefaultClassLoader( "generate-stub-test/doc-process-autodoc.xml" );
StringWriter writer = new StringWriter() ) {
@@ -24,11 +24,11 @@ public void genTest001() {
return writer.toString().length();
}
} );
- Assert.assertNotEquals( 0 , result );
+ Assertions.assertNotEquals( 0 , result );
}
@Test
- public void genTest002() {
+ void genTest002() {
int result = SafeFunction.get( () -> {
try (StringWriter writer = new StringWriter() ) {
Properties props = new Properties();
@@ -37,7 +37,7 @@ public void genTest002() {
return writer.toString().length();
}
} );
- Assert.assertNotEquals( 0, result );
+ Assertions.assertNotEquals( 0, result );
}
}