@@ -93,7 +93,7 @@ public HttpResponse invoke(UrlInvoker toInvoke) {
93
93
HttpResponse response = null ;
94
94
try {
95
95
response = new HttpResponse (new URI ("http://fake.om/" ), 200 , "theResponse" );
96
- } catch (URISyntaxException e ) {
96
+ } catch (final URISyntaxException e ) {
97
97
e .printStackTrace ();
98
98
}
99
99
toInvoke .setResponse (response );
@@ -104,7 +104,7 @@ public HttpResponse invoke(UrlInvoker toInvoke) {
104
104
105
105
@ Test
106
106
public void testThatEverythingCanBeRendered () throws UnsupportedEncodingException {
107
- String actual =
107
+ final String actual =
108
108
sut .getRenderedStringResolved (
109
109
"asd ${" + EVERYTHING_URL .name () + "} asd" ,
110
110
encodeFor ,
@@ -121,7 +121,7 @@ public void testThatEverythingCanBeRendered() throws UnsupportedEncodingExceptio
121
121
shouldAcceptAnyCertificate ,
122
122
securityService ));
123
123
124
- for (PrnfbVariable v : PrnfbVariable .values ()) {
124
+ for (final PrnfbVariable v : PrnfbVariable .values ()) {
125
125
if (v != EVERYTHING_URL && v != PULL_REQUEST_DESCRIPTION ) {
126
126
assertThat (actual ) //
127
127
.containsOnlyOnce (v .name () + "=${" + v .name () + "}" ) //
@@ -136,7 +136,7 @@ public void testThatEverythingCanBeRendered() throws UnsupportedEncodingExceptio
136
136
137
137
@ Test
138
138
public void testThatDollarInStringCanBeRendered () throws UnsupportedEncodingException {
139
- String actual =
139
+ final String actual =
140
140
sut .getRenderedStringResolved (
141
141
"asd ${" + PULL_REQUEST_TITLE .name () + "} asd" ,
142
142
encodeFor ,
@@ -150,7 +150,7 @@ public void testThatDollarInStringCanBeRendered() throws UnsupportedEncodingExce
150
150
151
151
@ Test
152
152
public void testThatIfAVariableChrashesOnResolveItWillBeEmpty () {
153
- String actual =
153
+ final String actual =
154
154
sut .render (
155
155
"my ${" + PULL_REQUEST_AUTHOR_EMAIL + "} string" ,
156
156
encodeFor ,
@@ -168,7 +168,7 @@ public void testThatIfAVariableChrashesResolvedToNullOnResolveItWillBeEmpty() {
168
168
.thenReturn (user );
169
169
when (pullRequest .getAuthor ().getUser ().getEmailAddress ()) //
170
170
.thenReturn (null );
171
- String actual =
171
+ final String actual =
172
172
sut .render (
173
173
"my ${" + PULL_REQUEST_AUTHOR_EMAIL + "} string" ,
174
174
encodeFor ,
@@ -196,7 +196,7 @@ public void testThatInjectionUrlCanBeRendered() throws ValidationException {
196
196
variables ,
197
197
securityService );
198
198
199
- String actual =
199
+ final String actual =
200
200
sut .render (
201
201
"my ${" + INJECTION_URL_VALUE + "} string" ,
202
202
encodeFor ,
@@ -209,7 +209,7 @@ public void testThatInjectionUrlCanBeRendered() throws ValidationException {
209
209
@ Test
210
210
public void testThatMergeCommitCanBeRenderedIfExists () {
211
211
variables .put (PULL_REQUEST_MERGE_COMMIT , Suppliers .ofInstance ("mergeHash" ));
212
- String actual =
212
+ final String actual =
213
213
sut .render (
214
214
"my ${" + PULL_REQUEST_MERGE_COMMIT + "} string" ,
215
215
encodeFor ,
@@ -221,7 +221,7 @@ public void testThatMergeCommitCanBeRenderedIfExists() {
221
221
222
222
@ Test
223
223
public void testThatMergeCommitCanBeRenderedIfNotExists () {
224
- String actual =
224
+ final String actual =
225
225
sut .render (
226
226
"my ${" + PULL_REQUEST_MERGE_COMMIT + "} string" ,
227
227
encodeFor ,
@@ -233,7 +233,7 @@ public void testThatMergeCommitCanBeRenderedIfNotExists() {
233
233
234
234
@ Test
235
235
public void testThatStringCanBeRendered () {
236
- String actual =
236
+ final String actual =
237
237
sut .render (
238
238
"my ${" + PULL_REQUEST_FROM_HASH + "} string" ,
239
239
encodeFor ,
@@ -246,7 +246,7 @@ public void testThatStringCanBeRendered() {
246
246
@ Test
247
247
public void testThatStringCanBeRenderedForUrl () {
248
248
variables .put (PULL_REQUEST_COMMENT_TEXT , Suppliers .ofInstance ("the comment" ));
249
- String actual =
249
+ final String actual =
250
250
sut .render (
251
251
"my ${" + PULL_REQUEST_COMMENT_TEXT + "} string" ,
252
252
ENCODE_FOR .URL ,
@@ -255,4 +255,17 @@ public void testThatStringCanBeRenderedForUrl() {
255
255
assertThat (actual ) //
256
256
.isEqualTo ("my the+comment string" );
257
257
}
258
+
259
+ @ Test
260
+ public void testThatStringCanBeRenderedForHtml () {
261
+ variables .put (PULL_REQUEST_COMMENT_TEXT , Suppliers .ofInstance ("the\n comment \" " ));
262
+ final String actual =
263
+ sut .render (
264
+ "my ${" + PULL_REQUEST_COMMENT_TEXT + "} string" ,
265
+ ENCODE_FOR .HTML ,
266
+ clientKeyStore ,
267
+ shouldAcceptAnyCertificate );
268
+ assertThat (actual ) //
269
+ .isEqualTo ("my the<br />comment " string" );
270
+ }
258
271
}
0 commit comments