Skip to content

Commit 76eae37

Browse files
committed
[fj-doc-base] migrate junit4 to junit5 #318
1 parent 37245fb commit 76eae37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+463
-466
lines changed

fj-doc-base/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,22 @@
8181
</dependency>
8282

8383
<dependency>
84-
<groupId>junit</groupId>
85-
<artifactId>junit</artifactId>
84+
<groupId>org.junit.jupiter</groupId>
85+
<artifactId>junit-jupiter-api</artifactId>
8686
<scope>test</scope>
8787
</dependency>
8888

8989
<dependency>
9090
<groupId>org.fugerit.java</groupId>
91-
<artifactId>fj-test-helper8</artifactId>
91+
<artifactId>fj-test-helper-core</artifactId>
9292
<scope>test</scope>
9393
<exclusions>
9494
<exclusion>
9595
<groupId>*</groupId>
9696
<artifactId>*</artifactId>
9797
</exclusion>
9898
</exclusions>
99-
</dependency>
99+
</dependency>
100100

101101
</dependencies>
102102

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
package test.org.fugerit.java.doc.base.config;
22

33
import org.fugerit.java.doc.base.config.DocCharsetProvider;
4-
import org.junit.Assert;
5-
import org.junit.Test;
64

75
import lombok.extern.slf4j.Slf4j;
6+
import org.junit.jupiter.api.Assertions;
7+
import org.junit.jupiter.api.Test;
88

99
@Slf4j
10-
public class TestDocCharsetProvider {
10+
class TestDocCharsetProvider {
1111

1212
@Test
13-
public void testProvider() {
13+
void testProvider() {
1414
DocCharsetProvider.setDefaultProvider( DocCharsetProvider.getDefaultProvider() );
1515
log.info( "test : {}", DocCharsetProvider.getDefaultProvider() );
16-
Assert.assertNotNull( DocCharsetProvider.getDefaultProvider() );
16+
Assertions.assertNotNull( DocCharsetProvider.getDefaultProvider() );
1717
}
1818

1919
}

fj-doc-base/src/test/java/test/org/fugerit/java/doc/base/config/TestDocException.java

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,109 +4,109 @@
44
import java.sql.SQLException;
55

66
import org.fugerit.java.doc.base.config.DocException;
7-
import org.junit.Assert;
8-
import org.junit.Test;
7+
import org.junit.jupiter.api.Assertions;
8+
import org.junit.jupiter.api.Test;
99

1010
import lombok.extern.slf4j.Slf4j;
1111

1212
@Slf4j
13-
public class TestDocException {
13+
class TestDocException {
1414

1515
@Test
16-
public void testApplySilent() throws DocException {
16+
void testApplySilent() throws DocException {
1717
boolean ok = true;
1818
DocException.applySilent( () -> { throw new IOException( "junit test scenario" ); } );
19-
Assert.assertTrue( ok );
19+
Assertions.assertTrue( ok );
2020
}
2121

2222
@Test
23-
public void testGetSilent() throws DocException {
23+
void testGetSilent() throws DocException {
2424
Object result = DocException.getSilent( () -> { throw new IOException( "junit test scenario" ); } );
25-
Assert.assertNull( result );
25+
Assertions.assertNull( result );
2626
}
2727

2828
@Test
29-
public void testApplyEX() {
30-
Assert.assertThrows( DocException.class ,() -> DocException.apply( () -> { throw new IOException( "junit test scenario" ); } ) );
29+
void testApplyEX() {
30+
Assertions.assertThrows( DocException.class ,() -> DocException.apply( () -> { throw new IOException( "junit test scenario" ); } ) );
3131
}
3232

3333
@Test
34-
public void testGetEX() {
35-
Assert.assertThrows( DocException.class ,() -> DocException.get( () -> { throw new IOException( "junit test scenario" ); } ) );
34+
void testGetEX() {
35+
Assertions.assertThrows( DocException.class ,() -> DocException.get( () -> { throw new IOException( "junit test scenario" ); } ) );
3636
}
3737

3838
@Test
39-
public void testApplyEXMessage() {
40-
Assert.assertThrows( DocException.class ,() -> DocException.applyWithMessage( () -> { throw new IOException( "junit test scenario" ); }, "test message" ) );
39+
void testApplyEXMessage() {
40+
Assertions.assertThrows( DocException.class ,() -> DocException.applyWithMessage( () -> { throw new IOException( "junit test scenario" ); }, "test message" ) );
4141
}
4242

4343
@Test
44-
public void testGetEXMessage() {
45-
Assert.assertThrows( DocException.class ,() -> DocException.getWithMessage( () -> { throw new IOException( "junit test scenario" ); }, "test message" ) );
44+
void testGetEXMessage() {
45+
Assertions.assertThrows( DocException.class ,() -> DocException.getWithMessage( () -> { throw new IOException( "junit test scenario" ); }, "test message" ) );
4646
}
4747

4848
@Test
49-
public void testApplyEXMessageOk() throws DocException {
49+
void testApplyEXMessageOk() throws DocException {
5050
boolean ok = true;
5151
DocException.applyWithMessage( () -> log.info( "test ok" ) , "test message" );
52-
Assert.assertTrue( ok );
52+
Assertions.assertTrue( ok );
5353
}
5454

5555
@Test
56-
public void testGetEXMessageOk() throws DocException {
57-
Assert.assertNotNull( DocException.getWithMessage( () -> "test ok" , "test message" ) );
56+
void testGetEXMessageOk() throws DocException {
57+
Assertions.assertNotNull( DocException.getWithMessage( () -> "test ok" , "test message" ) );
5858
}
5959

6060
@Test
61-
public void testApply() throws DocException {
61+
void testApply() throws DocException {
6262
DocException.apply( () -> log.info( "apply ok" ) );
63-
Assert.assertThrows( DocException.class ,() -> DocException.apply( () -> { throw new SQLException( "junit test scenario" ); } ) );
63+
Assertions.assertThrows( DocException.class ,() -> DocException.apply( () -> { throw new SQLException( "junit test scenario" ); } ) );
6464
}
6565

6666
@Test
67-
public void testGet() throws DocException {
68-
Assert.assertNotNull( DocException.get( () -> "ok" ) );
69-
Assert.assertThrows( DocException.class ,() -> DocException.get( () -> { throw new SQLException( "junit test scenario" ); } ) );
67+
void testGet() throws DocException {
68+
Assertions.assertNotNull( DocException.get( () -> "ok" ) );
69+
Assertions.assertThrows( DocException.class ,() -> DocException.get( () -> { throw new SQLException( "junit test scenario" ); } ) );
7070
}
7171

7272
@Test
73-
public void testEx1() {
74-
Assert.assertNotNull( new DocException() );
73+
void testEx1() {
74+
Assertions.assertNotNull( new DocException() );
7575
}
7676

7777
@Test
78-
public void testEx2() {
79-
Assert.assertNotNull( new DocException( "a" ) );
78+
void testEx2() {
79+
Assertions.assertNotNull( new DocException( "a" ) );
8080
}
8181

8282
@Test
83-
public void testEx3() {
84-
Assert.assertNotNull( new DocException( new SQLException( "b" ) ) );
83+
void testEx3() {
84+
Assertions.assertNotNull( new DocException( new SQLException( "b" ) ) );
8585
}
8686

8787
@Test
88-
public void testEx4() {
89-
Assert.assertNotNull( new DocException( "c", new SQLException( "d" ) ) );
88+
void testEx4() {
89+
Assertions.assertNotNull( new DocException( "c", new SQLException( "d" ) ) );
9090
}
9191

9292
@Test
93-
public void testEx5() {
94-
Assert.assertNotNull( DocException.convertEx( "e" , new SQLException( "f" ) ) );
93+
void testEx5() {
94+
Assertions.assertNotNull( DocException.convertEx( "e" , new SQLException( "f" ) ) );
9595
}
9696

9797
@Test
98-
public void testEx6() {
99-
Assert.assertNotNull( DocException.convertEx( "g" , new DocException( "g" ) ) );
98+
void testEx6() {
99+
Assertions.assertNotNull( DocException.convertEx( "g" , new DocException( "g" ) ) );
100100
}
101101

102102
@Test
103-
public void testEx7() {
104-
Assert.assertNotNull( DocException.convertExMethod( "e" , new SQLException( "f" ) ) );
103+
void testEx7() {
104+
Assertions.assertNotNull( DocException.convertExMethod( "e" , new SQLException( "f" ) ) );
105105
}
106106

107107
@Test
108-
public void testEx8() {
109-
Assert.assertNotNull( new DocException( "code", "e" , new SQLException( "f" ) ).getCode() );
108+
void testEx8() {
109+
Assertions.assertNotNull( new DocException( "code", "e" , new SQLException( "f" ) ).getCode() );
110110
}
111111

112112
}

fj-doc-base/src/test/java/test/org/fugerit/java/doc/base/config/TestDocInput.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,35 @@
66
import org.fugerit.java.doc.base.config.DocInput;
77
import org.fugerit.java.doc.base.facade.DocFacadeSource;
88
import org.fugerit.java.doc.base.model.DocBase;
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

1212
import lombok.extern.slf4j.Slf4j;
1313

1414
@Slf4j
15-
public class TestDocInput {
15+
class TestDocInput {
1616

1717
@Test
18-
public void test1() {
18+
void test1() {
1919
DocInput docInput = new DocInput( DocConfig.TYPE_PDF , new DocBase(), null );
2020
log.info( "docInput : {}" , docInput );
21-
Assert.assertNotNull( docInput.getDoc() );
21+
Assertions.assertNotNull( docInput.getDoc() );
2222
}
2323

2424
@Test
25-
public void test2() {
25+
void test2() {
2626
try ( StringReader reader = new StringReader( "<doc/>" ) ) {
2727
DocInput docInput = DocInput.newInput( DocConfig.TYPE_PDF , reader, DocFacadeSource.SOURCE_TYPE_XML );
2828
log.info( "docInput : {}" , docInput );
29-
Assert.assertNotNull( docInput.getDoc() );
29+
Assertions.assertNotNull( docInput.getDoc() );
3030
}
3131
}
3232

3333
@Test
34-
public void test3() {
34+
void test3() {
3535
DocInput docInput = new DocInput( DocConfig.TYPE_PDF , null, null );
3636
log.info( "docInput : {}" , docInput );
37-
Assert.assertNull( docInput.getDoc() );
37+
Assertions.assertNull( docInput.getDoc() );
3838
}
3939

4040
}

fj-doc-base/src/test/java/test/org/fugerit/java/doc/base/config/TestDocOutput.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
import java.io.IOException;
55

66
import org.fugerit.java.doc.base.config.DocOutput;
7-
import org.junit.Assert;
8-
import org.junit.Test;
7+
import org.junit.jupiter.api.Assertions;
8+
import org.junit.jupiter.api.Test;
99

1010
import lombok.extern.slf4j.Slf4j;
1111

1212
@Slf4j
13-
public class TestDocOutput {
13+
class TestDocOutput {
1414

1515
@Test
16-
public void test1() throws IOException {
16+
void test1() throws IOException {
1717
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
1818
DocOutput docOutput = DocOutput.newOutput( baos );
1919
log.info( "docOutput : {}" , docOutput );
20-
Assert.assertNotNull( docOutput.getResult() );
20+
Assertions.assertNotNull( docOutput.getResult() );
2121
}
2222

2323
}

fj-doc-base/src/test/java/test/org/fugerit/java/doc/base/config/TestDocTypeHandlerDecorator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@
66
import org.fugerit.java.core.xml.XMLException;
77
import org.fugerit.java.core.xml.dom.DOMIO;
88
import org.fugerit.java.doc.base.typehandler.markdown.SimpleMarkdownBasicTypeHandlerUTF8;
9-
import org.junit.Assert;
10-
import org.junit.Test;
119

1210
import lombok.extern.slf4j.Slf4j;
11+
import org.junit.jupiter.api.Assertions;
12+
import org.junit.jupiter.api.Test;
1313

1414
@Slf4j
15-
public class TestDocTypeHandlerDecorator {
15+
class TestDocTypeHandlerDecorator {
1616

1717
@Test
18-
public void test1() throws ConfigException, XMLException {
18+
void test1() throws ConfigException, XMLException {
1919
SimpleMarkdownBasicTypeHandlerUTF8 handler = new SimpleMarkdownBasicTypeHandlerUTF8();
2020
log.info( "handler : {}", handler );
2121
try ( StringReader reader = new StringReader( "<config/>" ) ) {
2222
handler.configure( DOMIO.loadDOMDoc( reader ).getDocumentElement() );
2323
}
24-
Assert.assertNotNull( handler.unwrap() );
24+
Assertions.assertNotNull( handler.unwrap() );
2525
}
2626

2727
}

fj-doc-base/src/test/java/test/org/fugerit/java/doc/base/config/TestDocTypeHandlerDefault.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,39 @@
88
import org.fugerit.java.core.cfg.ConfigException;
99
import org.fugerit.java.doc.base.config.DocConfig;
1010
import org.fugerit.java.doc.base.config.DocTypeHandlerDefault;
11-
import org.junit.Assert;
12-
import org.junit.Test;
11+
import org.junit.jupiter.api.Assertions;
12+
import org.junit.jupiter.api.Test;
1313

1414
import lombok.extern.slf4j.Slf4j;
1515

1616
@Slf4j
17-
public class TestDocTypeHandlerDefault {
17+
class TestDocTypeHandlerDefault {
1818

1919

2020

2121
@Test
22-
public void test1() throws Exception {
22+
void test1() throws Exception {
2323
TestHandler handler = new TestHandler();
2424
log.info( "handler format : {}", handler.getFormat() );
25-
Assert.assertEquals( TestHandler.FORMAT , handler.getFormat() );
25+
Assertions.assertEquals( TestHandler.FORMAT , handler.getFormat() );
2626
handler.handle(null, null);
2727
try ( InputStream is = new ByteArrayInputStream( "test=val".getBytes() ) ) {
28-
Assert.assertThrows( ConfigException.class , () -> handler.configureProperties( is ) );
28+
Assertions.assertThrows( ConfigException.class , () -> handler.configureProperties( is ) );
2929
}
3030
Properties config = new Properties();
31-
Assert.assertThrows( ConfigException.class , () -> handler.configure( config ) );
31+
Assertions.assertThrows( ConfigException.class , () -> handler.configure( config ) );
3232
try ( InputStream is = new ByteArrayInputStream( "<handler><config charset='utf-8'/></handler>".getBytes() ) ) {
3333
handler.configureXML( is );
3434
}
3535
try ( InputStream is = new ByteArrayInputStream( "<handler><docHandlerCustomConfig custom-att='att'/></handler>".getBytes() ) ) {
3636
handler.configureXML( is );
3737
}
3838
try ( InputStream is = new ByteArrayInputStream( "<config>".getBytes() ) ) {
39-
Assert.assertThrows( ConfigException.class , () -> handler.configureXML( is ) );
39+
Assertions.assertThrows( ConfigException.class , () -> handler.configureXML( is ) );
4040
}
4141
String customId = UUID.randomUUID().toString();
4242
handler.setCustomId( customId );
43-
Assert.assertEquals( customId, handler.getCustomId() );
43+
Assertions.assertEquals( customId, handler.getCustomId() );
4444
}
4545

4646
}

0 commit comments

Comments
 (0)