Skip to content

Commit dbbe489

Browse files
authored
Merge pull request #356 from fugerit-org/317-chore-migrate-junit4-to-junit5
[fj-doc-lib-simpletable] migrate junit4 to junit5 #353
2 parents 5145c33 + 787974c commit dbbe489

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

fj-doc-lib-simpletable/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
</dependency>
4747

4848
<dependency>
49-
<groupId>junit</groupId>
50-
<artifactId>junit</artifactId>
49+
<groupId>org.junit.jupiter</groupId>
50+
<artifactId>junit-jupiter-api</artifactId>
5151
<scope>test</scope>
5252
</dependency>
5353

fj-doc-lib-simpletable/src/test/java/test/org/fugerit/java/doc/lib/simpletable/TestSimpleTable.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import org.fugerit.java.doc.lib.simpletable.model.SimpleCell;
2020
import org.fugerit.java.doc.lib.simpletable.model.SimpleRow;
2121
import org.fugerit.java.doc.lib.simpletable.model.SimpleTable;
22-
import org.junit.Assert;
23-
import org.junit.Test;
22+
import org.junit.jupiter.api.Assertions;
23+
import org.junit.jupiter.api.Test;
2424

25-
public class TestSimpleTable {
25+
class TestSimpleTable {
2626

2727
private void testTable( SimpleTable table, SimpleTableHelper helper ) {
2828
table.addRow( helper.newHeaderRow( "H1", "H2" ) );
@@ -39,51 +39,51 @@ private void testTable( SimpleTable table, SimpleTableHelper helper ) {
3939
SafeFunction.apply( () -> {
4040
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
4141
SimpleTableDocConfig.newConfigLatest().processSimpleTable( table , FreeMarkerHtmlTypeHandler.HANDLER, baos );
42-
Assert.assertTrue( baos.toByteArray().length > 0 );
42+
Assertions.assertTrue( baos.toByteArray().length > 0 );
4343
}
4444
} );
45-
Assert.assertThrows( DocException.class , () -> {
45+
Assertions.assertThrows( DocException.class , () -> {
4646
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
4747
SimpleTableDocConfig.newConfigLatest().processSimpleTable( table , new FailTypeHandler(), baos );
48-
Assert.assertTrue( baos.toByteArray().length > 0 );
48+
Assertions.assertTrue( baos.toByteArray().length > 0 );
4949
}
5050
} );
5151
}
5252

5353
@Test
54-
public void testHelper() {
54+
void testHelper() {
5555
Integer defaultBorder = 0;
5656
SimpleTableHelper helper = SimpleTableFacade.newHelper().withDefaultBorderWidth( defaultBorder );
57-
Assert.assertEquals( defaultBorder , helper.getDefaultBorderWidth() );
57+
Assertions.assertEquals( defaultBorder , helper.getDefaultBorderWidth() );
5858
List<Integer> lcw = new ArrayList<Integer>();
59-
Assert.assertThrows( ConfigRuntimeException.class, () -> helper.newTable( lcw ) );
60-
Assert.assertThrows( ConfigRuntimeException.class, () -> helper.newTable() );
59+
Assertions.assertThrows( ConfigRuntimeException.class, () -> helper.newTable( lcw ) );
60+
Assertions.assertThrows( ConfigRuntimeException.class, () -> helper.newTable() );
6161
List<Integer> colWidths = null;
62-
Assert.assertThrows( ConfigRuntimeException.class, () -> helper.newTable( colWidths ) );
62+
Assertions.assertThrows( ConfigRuntimeException.class, () -> helper.newTable( colWidths ) );
6363
Integer[] colWidthsA = null;
64-
Assert.assertThrows( ConfigRuntimeException.class, () -> helper.newTable( colWidthsA ) );
64+
Assertions.assertThrows( ConfigRuntimeException.class, () -> helper.newTable( colWidthsA ) );
6565
Integer[] colWidths50 = { 20, 30 };
66-
Assert.assertThrows( ConfigRuntimeException.class, () -> helper.newTable( colWidths50 ) );
66+
Assertions.assertThrows( ConfigRuntimeException.class, () -> helper.newTable( colWidths50 ) );
6767
// new table ok
68-
Assert.assertNotNull( helper.newTableSingleColumn() );
68+
Assertions.assertNotNull( helper.newTableSingleColumn() );
6969
SimpleTable table = helper.newTable( 50, 50 );
7070
this.testTable(table, helper);
7171
}
7272

7373
@Test
74-
public void testFacade() {
75-
Assert.assertNotNull( SimpleTableFacade.newTable( 100 ) );
76-
Assert.assertNotNull( SimpleTableFacade.newTableSingleColumn() );
74+
void testFacade() {
75+
Assertions.assertNotNull( SimpleTableFacade.newTable( 100 ) );
76+
Assertions.assertNotNull( SimpleTableFacade.newTableSingleColumn() );
7777
List<Integer> colW = new ArrayList<>();
7878
colW.add( 100 );
79-
Assert.assertNotNull( SimpleTableFacade.newTable( colW ) );
79+
Assertions.assertNotNull( SimpleTableFacade.newTable( colW ) );
8080
}
8181

8282
@Test
83-
public void testCell() {
83+
void testCell() {
8484
SimpleCell cell = new SimpleCell( "test", 10 ).bold().bolditalic().italic().left().rigt().underline();
8585
cell.setContent( "aaaa" );
86-
Assert.assertNotNull( SimpleCell.newCell( "bbb" ) );
86+
Assertions.assertNotNull( SimpleCell.newCell( "bbb" ) );
8787
SimpleRow row = new SimpleRow();
8888
row.addCell( "cccc" );
8989
row.setHead( BooleanUtils.BOOLEAN_TRUE );

fj-doc-lib-simpletable/src/test/java/test/org/fugerit/java/doc/lib/simpletable/TestSimpleTableConfig.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,39 @@
33
import org.fugerit.java.core.cfg.ConfigException;
44
import org.fugerit.java.doc.freemarker.config.FreeMarkerConfigStep;
55
import org.fugerit.java.doc.lib.simpletable.SimpleTableDocConfig;
6-
import org.junit.Assert;
7-
import org.junit.Test;
6+
import org.junit.jupiter.api.Assertions;
7+
import org.junit.jupiter.api.Test;
88

99
import test.org.fugerit.java.BasicTest;
1010

11-
public class TestSimpleTableConfig extends BasicTest {
11+
class TestSimpleTableConfig extends BasicTest {
1212

1313
@Test
14-
public void newConfigLegacy() {
14+
void newConfigLegacy() {
1515
try {
1616
SimpleTableDocConfig config = SimpleTableDocConfig.newConfig();
17-
Assert.assertNotNull( config );
17+
Assertions.assertNotNull( config );
1818
} catch (ConfigException e) {
1919
this.failEx( e );
2020
}
2121
}
2222

2323
@Test
24-
public void newConfigLatest() {
24+
void newConfigLatest() {
2525
try {
2626
SimpleTableDocConfig config = SimpleTableDocConfig.newConfigLatest();
27-
Assert.assertNotNull( config );
27+
Assertions.assertNotNull( config );
2828
} catch (ConfigException e) {
2929
this.failEx( e );
3030
}
3131
}
3232

3333
@Test
34-
public void newConfigCustom() {
34+
void newConfigCustom() {
3535
try {
3636
SimpleTableDocConfig config = SimpleTableDocConfig.newConfig( FreeMarkerConfigStep.ATT_FREEMARKER_CONFIG_KEY_VERSION_2_3_31 );
37-
Assert.assertNotNull( config );
38-
Assert.assertNotNull( config.getConfig() );
37+
Assertions.assertNotNull( config );
38+
Assertions.assertNotNull( config.getConfig() );
3939
} catch (ConfigException e) {
4040
this.failEx( e );
4141
}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package test.org.fugerit.java.doc.lib.simpletable;
22

3-
import static org.junit.Assert.assertEquals;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
44

55
import java.util.List;
66

77
import org.fugerit.java.doc.lib.simpletable.SimpleTableFacade;
88
import org.fugerit.java.doc.lib.simpletable.SimpleTableHelper;
9-
import org.junit.Assert;
10-
import org.junit.Test;
9+
import org.junit.jupiter.api.Assertions;
10+
import org.junit.jupiter.api.Test;
1111
import org.slf4j.Logger;
1212
import org.slf4j.LoggerFactory;
1313

14-
public class TestSimpleTableHelperColumns {
14+
class TestSimpleTableHelperColumns {
1515

1616
private static final Logger logger = LoggerFactory.getLogger( TestSimpleTableHelperColumns.class );
1717

@@ -25,23 +25,23 @@ private boolean test( int columnNumber ) {
2525
size+= current;
2626
}
2727
logger.info( "Total size is {}", size );
28-
assertEquals( "Wrong columns total size", 100 , size );
28+
assertEquals( 100 , size );
2929
return 100 == size;
3030
}
3131

3232
@Test
33-
public void columns_12() {
34-
Assert.assertTrue( this.test( 12 ) );
33+
void columns_12() {
34+
Assertions.assertTrue( this.test( 12 ) );
3535
}
3636

3737
@Test
38-
public void columns_10() {
39-
Assert.assertTrue( this.test( 10 ) );
38+
void columns_10() {
39+
Assertions.assertTrue( this.test( 10 ) );
4040
}
4141

4242
@Test
43-
public void columns_8() {
44-
Assert.assertTrue( this.test( 8 ) );
43+
void columns_8() {
44+
Assertions.assertTrue( this.test( 8 ) );
4545
}
4646

4747
}

0 commit comments

Comments
 (0)