Skip to content

Commit 1052add

Browse files
committed
Test fail
1 parent 9e99d9f commit 1052add

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

code-samples-fj-doc/src/main/resources/code-samples-fj-doc/template/template-fail.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</metadata>
3030
<body>
3131
<para>${docTitle!defaultTitle}</para>
32-
<para>${messageFormat(params['prop1'], 'Elrond')}</para>
32+
<para>${messageFormat(params['prop1''], 'Elrond')}</para>
3333
</body>
3434

3535
</doc>

code-samples-fj-doc/src/test/java/test/testorg/fugerit/java/codesamplesfjdoc/MessageFormatTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import lombok.extern.slf4j.Slf4j;
44
import org.fugerit.java.codesamplesfjdoc.DocHelper;
5+
import org.fugerit.java.core.cfg.ConfigRuntimeException;
56
import org.fugerit.java.doc.base.config.DocConfig;
67
import org.fugerit.java.doc.base.process.DocProcessContext;
78
import org.junit.jupiter.api.Assertions;
@@ -10,6 +11,7 @@
1011
import java.io.ByteArrayOutputStream;
1112
import java.io.IOException;
1213
import java.nio.charset.StandardCharsets;
14+
import java.text.ParseException;
1315
import java.util.Properties;
1416

1517
/**
@@ -25,8 +27,7 @@
2527
@Slf4j
2628
class MessageFormatTest {
2729

28-
@Test
29-
void test() throws IOException {
30+
private int generate() throws IOException {
3031
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
3132
// creates the doc helper
3233
DocHelper docHelper = new DocHelper();
@@ -39,10 +40,15 @@ void test() throws IOException {
3940
docHelper.getDocProcessConfig().fullProcess( "message-format", DocProcessContext.newContext( "params", params ), handlerId, baos );
4041
// print the output
4142
log.info( "html output : \n{}", new String( baos.toByteArray(), StandardCharsets.UTF_8 ) );
42-
Assertions.assertNotEquals( 0, baos.size() );
43+
return baos.size();
4344
}
4445
}
4546

47+
@Test
48+
void test() throws IOException {
49+
Assertions.assertNotEquals(0, generate() );
50+
}
51+
4652
/*
4753
* Class used to wrap data to be rendered in the document template
4854
*/

code-samples-fj-doc/src/test/java/test/testorg/fugerit/java/codesamplesfjdoc/TemplateFailTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import lombok.extern.slf4j.Slf4j;
44
import org.fugerit.java.codesamplesfjdoc.DocHelper;
5+
import org.fugerit.java.core.cfg.ConfigRuntimeException;
56
import org.fugerit.java.doc.base.config.DocConfig;
67
import org.fugerit.java.doc.base.process.DocProcessContext;
78
import org.junit.jupiter.api.Assertions;
@@ -25,8 +26,7 @@
2526
@Slf4j
2627
class TemplateFailTest {
2728

28-
@Test
29-
void test() throws IOException {
29+
private int generate() throws IOException {
3030
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
3131
// creates the doc helper
3232
DocHelper docHelper = new DocHelper();
@@ -39,10 +39,16 @@ void test() throws IOException {
3939
docHelper.getDocProcessConfig().fullProcess( "template-fail", DocProcessContext.newContext( "params", params ), handlerId, baos );
4040
// print the output
4141
log.info( "html output : \n{}", new String( baos.toByteArray(), StandardCharsets.UTF_8 ) );
42-
Assertions.assertNotEquals( 0, baos.size() );
42+
return baos.size();
4343
}
4444
}
4545

46+
47+
@Test
48+
void test() throws IOException {
49+
Assertions.assertThrows( ConfigRuntimeException.class, () -> generate() );
50+
}
51+
4652
/*
4753
* Class used to wrap data to be rendered in the document template
4854
*/

0 commit comments

Comments
 (0)