16
16
*/
17
17
package org .apache .logging .log4j .taglib ;
18
18
19
- import static org .junit .Assert .assertEquals ;
19
+ import static org .junit .jupiter . api . Assertions .assertEquals ;
20
20
21
21
import java .io .ByteArrayOutputStream ;
22
22
import java .io .OutputStreamWriter ;
26
26
import javax .servlet .jsp .JspWriter ;
27
27
import javax .servlet .jsp .PageContext ;
28
28
import javax .servlet .jsp .tagext .Tag ;
29
- import org .junit .Before ;
30
- import org .junit .Test ;
29
+ import org .junit .jupiter . api . BeforeEach ;
30
+ import org .junit .jupiter . api . Test ;
31
31
import org .springframework .mock .web .MockJspWriter ;
32
32
import org .springframework .mock .web .MockPageContext ;
33
33
@@ -41,7 +41,7 @@ public class DumpTagTest {
41
41
private MockPageContext context ;
42
42
private DumpTag tag ;
43
43
44
- @ Before
44
+ @ BeforeEach
45
45
public void setUp () {
46
46
this .output = new ByteArrayOutputStream ();
47
47
this .writer = new OutputStreamWriter (this .output , UTF8 );
@@ -62,11 +62,11 @@ public JspWriter getOut() {
62
62
@ Test
63
63
public void testDoEndTagDefaultPageScopeNoAttributes () throws Exception {
64
64
final int returnValue = this .tag .doEndTag ();
65
- assertEquals ("The return value is not correct." , Tag . EVAL_PAGE , returnValue );
65
+ assertEquals (Tag . EVAL_PAGE , returnValue , "The return value is not correct." );
66
66
67
67
this .writer .flush ();
68
68
final String output = new String (this .output .toByteArray (), UTF8 );
69
- assertEquals ("The output is not correct." , " <dl></dl>" , output );
69
+ assertEquals ("<dl></dl>" , output , "The output is not correct." );
70
70
}
71
71
72
72
@ Test
@@ -76,16 +76,16 @@ public void testDoEndTagDefaultPageScope() throws Exception {
76
76
this .context .setAttribute ("badAttribute03" , "skippedValue03" , PageContext .SESSION_SCOPE );
77
77
78
78
final int returnValue = this .tag .doEndTag ();
79
- assertEquals ("The return value is not correct." , Tag . EVAL_PAGE , returnValue );
79
+ assertEquals (Tag . EVAL_PAGE , returnValue , "The return value is not correct." );
80
80
81
81
this .writer .flush ();
82
82
final String output = new String (this .output .toByteArray (), UTF8 );
83
83
assertEquals (
84
- "The output is not correct." ,
85
84
"<dl>" + "<dt><code>testAttribute01</code></dt><dd><code>testValue01</code></dd>"
86
85
+ "<dt><code>anotherAttribute02</code></dt><dd><code>finalValue02</code></dd>"
87
86
+ "</dl>" ,
88
- output );
87
+ output ,
88
+ "The output is not correct." );
89
89
}
90
90
91
91
@ Test
@@ -94,11 +94,11 @@ public void testDoEndTagSessionScopeNoAttributes() throws Exception {
94
94
95
95
this .tag .setScope ("session" );
96
96
final int returnValue = this .tag .doEndTag ();
97
- assertEquals ("The return value is not correct." , Tag . EVAL_PAGE , returnValue );
97
+ assertEquals (Tag . EVAL_PAGE , returnValue , "The return value is not correct." );
98
98
99
99
this .writer .flush ();
100
100
final String output = new String (this .output .toByteArray (), UTF8 );
101
- assertEquals ("The output is not correct." , " <dl></dl>" , output );
101
+ assertEquals ("<dl></dl>" , output , "The output is not correct." );
102
102
}
103
103
104
104
@ Test
@@ -109,15 +109,15 @@ public void testDoEndTagSessionScope() throws Exception {
109
109
110
110
this .tag .setScope ("session" );
111
111
final int returnValue = this .tag .doEndTag ();
112
- assertEquals ("The return value is not correct." , Tag . EVAL_PAGE , returnValue );
112
+ assertEquals (Tag . EVAL_PAGE , returnValue , "The return value is not correct." );
113
113
114
114
this .writer .flush ();
115
115
final String output = new String (this .output .toByteArray (), UTF8 );
116
116
assertEquals (
117
- "The output is not correct." ,
118
117
"<dl>" + "<dt><code>coolAttribute01</code></dt><dd><code>weirdValue01</code></dd>"
119
118
+ "<dt><code>testAttribute02</code></dt><dd><code>testValue02</code></dd>"
120
119
+ "</dl>" ,
121
- output );
120
+ output ,
121
+ "The output is not correct." );
122
122
}
123
123
}
0 commit comments