Skip to content

[fj-doc-mod-openpdf-ext] migrate junit4 to junit5 #370 #372

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-mod-poi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,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
Expand Up @@ -12,18 +12,18 @@
import org.fugerit.java.doc.base.model.DocCell;
import org.fugerit.java.doc.mod.poi.PoiUtils;
import org.fugerit.java.doc.mod.poi.WorkbookHelper;
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;

@Slf4j
public class TestPOIUtils {
class TestPOIUtils {


@Test
public void xlsxFormatStyle() {
Assert.assertTrue( SafeFunction.get( () -> {
void xlsxFormatStyle() {
Assertions.assertTrue( SafeFunction.get( () -> {
boolean ok = Boolean.TRUE;
PoiUtils.xlsxFormatStyle(null, null, null);
PoiUtils.xlsxFormatStyle(null, new XSSFCellStyle( null), null );
Expand All @@ -32,17 +32,17 @@ public void xlsxFormatStyle() {
}

@Test
public void xlsxFontStyle() {
Assert.assertTrue( SafeFunction.get( () -> {
void xlsxFontStyle() {
Assertions.assertTrue( SafeFunction.get( () -> {
boolean ok = Boolean.TRUE;
PoiUtils.xlsxFontStyle(null, null, null);
return ok;
} ) );
}

@Test
public void lsxFormat() {
Assert.assertTrue( SafeFunction.get( () -> {
void lsxFormat() {
Assertions.assertTrue( SafeFunction.get( () -> {
boolean ok = Boolean.TRUE;
try ( InputStream is = ClassHelper.loadFromDefaultClassLoader( "coverage/xls_as_xls.xls" );
HSSFWorkbook workbook = new HSSFWorkbook( is ) ) {
Expand All @@ -56,9 +56,9 @@ public void lsxFormat() {
}

@Test
public void testFindColor() {
void testFindColor() {
Short test = 31;
Assert.assertEquals( test, SafeFunction.get( () -> {
Assertions.assertEquals( test, SafeFunction.get( () -> {
try ( InputStream is = ClassHelper.loadFromDefaultClassLoader( "coverage/xls_as_xls.xls" );
HSSFWorkbook workbook = new HSSFWorkbook( is ) ) {
short index = PoiUtils.findClosestColorIndex( workbook , "#dddddd" );
Expand All @@ -69,15 +69,15 @@ public void testFindColor() {
}

@Test
public void testNewHelper() {
void testNewHelper() {
SafeFunction.apply( () -> {
try ( InputStream is = ClassHelper.loadFromDefaultClassLoader( "coverage/xls_as_xls.xls" );
WorkbookHelper helper = PoiUtils.newHelper( false , is ) ) {
log.info( "test 1 -> {}", helper.getIndexedColorMap() );
Assert.assertNotNull( helper );
Assertions.assertNotNull( helper );
}
} );
Assert.assertNotNull( SafeFunction.get( () -> {
Assertions.assertNotNull( SafeFunction.get( () -> {
try ( InputStream is = ClassHelper.loadFromDefaultClassLoader( "coverage/xlsx_as_xlsx.xlsx" );
WorkbookHelper helper = PoiUtils.newHelper( true , is ) ) {
log.info( "test 2 -> {}", helper.getIndexedColorMap() );
Expand All @@ -89,10 +89,10 @@ public void testNewHelper() {
private static final IOException FAIL_EX = new IOException( "scenario exception" );

@Test
public void testAutoresizeFailhandler() {
void testAutoresizeFailhandler() {
PoiUtils.autoresizeFailHandler( false ).accept( FAIL_EX );
Consumer<Exception> exHandlerFail = PoiUtils.autoresizeFailHandler( true );
Assert.assertThrows( ConfigRuntimeException.class , () -> exHandlerFail.accept( FAIL_EX ) );
Assertions.assertThrows( ConfigRuntimeException.class , () -> exHandlerFail.accept( FAIL_EX ) );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import org.fugerit.java.doc.base.config.DocTypeHandler;
import org.fugerit.java.doc.mod.poi.XlsPoiTypeHandler;
import org.fugerit.java.doc.mod.poi.XlsxPoiTypeHandler;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class TestPoiCoverage {
class TestPoiCoverage {

private final static String[] TEST_LIST = { "default_doc", "default_doc_alt", "default_doc_fail1" };

Expand All @@ -37,11 +37,11 @@ private boolean worker( String path ) {
}

@Test
public void test01() {
void test01() {
Arrays.asList( TEST_LIST ).stream().forEach( c -> {
Assert.assertTrue( this.worker( "coverage/xml/"+c+".xml" ) );
Assertions.assertTrue( this.worker( "coverage/xml/"+c+".xml" ) );
} );
Assert.assertTrue( Boolean.TRUE );
Assertions.assertTrue( Boolean.TRUE );
}

}
Loading