Skip to content

Commit 7bd0b63

Browse files
author
Peter Lamby
committed
WICKET-6993 - Adjust test cases for new format
1 parent 7ebb24c commit 7bd0b63

File tree

5 files changed

+43
-43
lines changed

5 files changed

+43
-43
lines changed

wicket-core/src/test/java/org/apache/wicket/core/request/mapper/BasicResourceReferenceMapperTest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void decode1()
8383
@Test
8484
void decode1A()
8585
{
86-
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference1?en");
86+
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference1?2~ennullnull");
8787
IRequestHandler handler = encoder.mapRequest(getRequest(url));
8888
// assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class); // TODO use hamcrest or assertj
8989
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler)handler;
@@ -120,7 +120,7 @@ void decode2()
120120
@Test
121121
void decode2A()
122122
{
123-
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference1?-style&p1=v1&p2=v2");
123+
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference1?null5~stylenull&p1=v1&p2=v2");
124124
IRequestHandler handler = encoder.mapRequest(getRequest(url));
125125
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
126126
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler)handler;
@@ -139,7 +139,7 @@ void decode2A()
139139
@Test
140140
void decode3()
141141
{
142-
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference2/name2?en_EN");
142+
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference2/name2?5~en_ENnullnull");
143143
IRequestHandler handler = encoder.mapRequest(getRequest(url));
144144
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
145145
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
@@ -158,7 +158,7 @@ void decode3()
158158
@Test
159159
void decode3A()
160160
{
161-
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference2/name2?en_EN-style");
161+
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference2/name2?5~en_EN5~stylenull");
162162
IRequestHandler handler = encoder.mapRequest(getRequest(url));
163163
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
164164
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler)handler;
@@ -188,7 +188,7 @@ void decode3B()
188188
void decode4()
189189
{
190190
Url url = Url
191-
.parse("wicket/resource/" + CLASS_NAME + "/reference2/name2?en_EN&p1=v1&p2=v2");
191+
.parse("wicket/resource/" + CLASS_NAME + "/reference2/name2?5~en_ENnullnull&p1=v1&p2=v2");
192192
IRequestHandler handler = encoder.mapRequest(getRequest(url));
193193
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
194194
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler)handler;
@@ -206,7 +206,7 @@ void decode4()
206206
@Test
207207
void decode5()
208208
{
209-
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference3?-style");
209+
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference3?null5~stylenull");
210210
IRequestHandler handler = encoder.mapRequest(getRequest(url));
211211
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
212212
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler)handler;
@@ -224,7 +224,7 @@ void decode5()
224224
@Test
225225
void decode6()
226226
{
227-
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference3?-style&p1=v1&p2=v2");
227+
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference3?null5~stylenull&p1=v1&p2=v2");
228228
IRequestHandler handler = encoder.mapRequest(getRequest(url));
229229
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
230230
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler)handler;
@@ -244,7 +244,7 @@ void decode6()
244244
@Test
245245
void decode7()
246246
{
247-
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference4?en-style");
247+
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference4?2~en5~stylenull");
248248
IRequestHandler handler = encoder.mapRequest(getRequest(url));
249249
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
250250
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler)handler;
@@ -262,7 +262,7 @@ void decode7()
262262
@Test
263263
void decode7A()
264264
{
265-
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference4?sk");
265+
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference4?2~sknullnull");
266266
IRequestHandler handler = encoder.mapRequest(getRequest(url));
267267
assertNull(handler);
268268
}
@@ -273,7 +273,7 @@ void decode7A()
273273
@Test
274274
void decode8()
275275
{
276-
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference4?en-style&p1=v1&p2=v2");
276+
Url url = Url.parse("wicket/resource/" + CLASS_NAME + "/reference4?2~en5~stylenull&p1=v1&p2=v2");
277277
IRequestHandler handler = encoder.mapRequest(getRequest(url));
278278
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
279279
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler)handler;
@@ -293,7 +293,7 @@ void decode8()
293293
void decode9()
294294
{
295295
Url url = Url.parse("wicket/resource/" + CLASS_NAME
296-
+ "/reference5?en--variation&p1=v1&p2=v2");
296+
+ "/reference5?2~ennull9~variation&p1=v1&p2=v2");
297297
IRequestHandler handler = encoder.mapRequest(getRequest(url));
298298
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
299299
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler)handler;
@@ -313,7 +313,7 @@ void decode9()
313313
void decode10()
314314
{
315315
Url url = Url.parse("wicket/resource/" + CLASS_NAME
316-
+ "/reference6?en-style-variation&p1=v1&p2=v2");
316+
+ "/reference6?2~en5~style9~variation&p1=v1&p2=v2");
317317
IRequestHandler handler = encoder.mapRequest(getRequest(url));
318318
assertThat(handler).isInstanceOf(ResourceReferenceRequestHandler.class);
319319
ResourceReferenceRequestHandler h = (ResourceReferenceRequestHandler)handler;
@@ -375,7 +375,7 @@ void encode3()
375375
ResourceReferenceRequestHandler handler = new ResourceReferenceRequestHandler(reference2,
376376
null);
377377
Url url = encoder.mapHandler(handler);
378-
assertEquals("wicket/resource/" + CLASS_NAME + "/reference2/name2?en_EN", url.toString());
378+
assertEquals("wicket/resource/" + CLASS_NAME + "/reference2/name2?5~en_ENnullnull", url.toString());
379379
}
380380

381381
/**
@@ -392,7 +392,7 @@ void encode4()
392392
parameters);
393393

394394
Url url = encoder.mapHandler(handler);
395-
assertEquals("wicket/resource/" + CLASS_NAME + "/reference2/name2?en_EN&p1=v1&p2=v2",
395+
assertEquals("wicket/resource/" + CLASS_NAME + "/reference2/name2?5~en_ENnullnull&p1=v1&p2=v2",
396396
url.toString());
397397
}
398398

@@ -405,7 +405,7 @@ void encode5()
405405
ResourceReferenceRequestHandler handler = new ResourceReferenceRequestHandler(reference3,
406406
null);
407407
Url url = encoder.mapHandler(handler);
408-
assertEquals("wicket/resource/" + CLASS_NAME + "/reference3?-style", url.toString());
408+
assertEquals("wicket/resource/" + CLASS_NAME + "/reference3?null5~stylenull", url.toString());
409409
}
410410

411411
/**
@@ -422,7 +422,7 @@ void encode6()
422422
parameters);
423423

424424
Url url = encoder.mapHandler(handler);
425-
assertEquals("wicket/resource/" + CLASS_NAME + "/reference3?-style&p1=v1&p2=v2",
425+
assertEquals("wicket/resource/" + CLASS_NAME + "/reference3?null5~stylenull&p1=v1&p2=v2",
426426
url.toString());
427427
}
428428

@@ -435,7 +435,7 @@ void encode7()
435435
ResourceReferenceRequestHandler handler = new ResourceReferenceRequestHandler(reference4,
436436
null);
437437
Url url = encoder.mapHandler(handler);
438-
assertEquals("wicket/resource/" + CLASS_NAME + "/reference4?en-style", url.toString());
438+
assertEquals("wicket/resource/" + CLASS_NAME + "/reference4?2~en5~stylenull", url.toString());
439439
}
440440

441441
/**
@@ -452,7 +452,7 @@ void encode8()
452452
parameters);
453453

454454
Url url = encoder.mapHandler(handler);
455-
assertEquals("wicket/resource/" + CLASS_NAME + "/reference4?en-style&p1=v1&p2=v2",
455+
assertEquals("wicket/resource/" + CLASS_NAME + "/reference4?2~en5~stylenull&p1=v1&p2=v2",
456456
url.toString());
457457
}
458458

@@ -466,7 +466,7 @@ void encode9()
466466
null);
467467

468468
Url url = encoder.mapHandler(handler);
469-
assertEquals("wicket/resource/" + CLASS_NAME + "/reference5?en--variation", url.toString());
469+
assertEquals("wicket/resource/" + CLASS_NAME + "/reference5?2~ennull9~variation", url.toString());
470470
}
471471

472472
/**

wicket-core/src/test/java/org/apache/wicket/markup/html/form/imagebutton/ImageButtonTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ void imageButton() throws Exception
3838
tester.startPage(Home.class);
3939

4040
tester.clickLink("goCanadian");
41-
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\\?en_CA\"");
41+
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\\?5~en_CAnullnull\"");
4242

4343
tester.clickLink("goChinese");
44-
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\\?zh_CN\"");
44+
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\\?5~zh_CNnullnull\"");
4545

4646
tester.clickLink("goDanish");
47-
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\\?da_DK\"");
47+
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\\?5~da_DKnullnull\"");
4848

4949
tester.clickLink("goDutch");
50-
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\\?nl_NL\"");
50+
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\\?5~nl_NLnullnull\"");
5151

5252
tester.clickLink("goGerman");
53-
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\\?de_DE\"");
53+
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\\?5~de_DEnullnull\"");
5454

5555
tester.clickLink("goUS");
5656
tester.assertContains("resource/org.apache.wicket.markup.html.form.imagebutton.Home/Beer.gif\"");

wicket-core/src/test/java/org/apache/wicket/markup/html/image/ImageTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ void test_1() throws Exception
3838
tester.startPage(Home.class);
3939

4040
tester.clickLink("goCanadian");
41-
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\\?en_CA\"");
41+
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\\?5~en_CAnullnull\"");
4242

4343
tester.clickLink("goChinese");
44-
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\\?zh_CN\"");
44+
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\\?5~zh_CNnullnull\"");
4545

4646
tester.clickLink("goDanish");
47-
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\\?da_DK\"");
47+
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\\?5~da_DKnullnull\"");
4848

4949
tester.clickLink("goDutch");
50-
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\\?nl_NL\"");
50+
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\\?5~nl_NLnullnull\"");
5151

5252
tester.clickLink("goGerman");
53-
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\\?de_DE\"");
53+
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\\?5~de_DEnullnull\"");
5454

5555
tester.clickLink("goUS");
5656
tester.assertContains("resource/org.apache.wicket.markup.html.image.Home/Beer.gif\"");

wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_1.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
<wicket:link autolink="true">
2626
<a href="./org.apache.wicket.markup.html.link.subdir.Page1">Home</a>
2727
<link href="../resource/org.apache.wicket.markup.html.link.AutolinkPage_1/test.css"/>
28-
<link href="../resource/org.apache.wicket.markup.html.link.AutolinkPage_1/test2.css?-myStyle"/>
29-
<link href="../resource/org.apache.wicket.markup.html.link.AutolinkPage_1/test3.css?de_DE"/>
30-
<link href="../resource/org.apache.wicket.markup.html.link.AutolinkPage_1/$up$/$up$/html/link/test2.css?-myStyle"/>
28+
<link href="../resource/org.apache.wicket.markup.html.link.AutolinkPage_1/test2.css?null7~myStylenull"/>
29+
<link href="../resource/org.apache.wicket.markup.html.link.AutolinkPage_1/test3.css?5~de_DEnullnull"/>
30+
<link href="../resource/org.apache.wicket.markup.html.link.AutolinkPage_1/$up$/$up$/html/link/test2.css?null7~myStylenull"/>
3131
<a href="/root/test.html">Home</a>
3232
<a href="./org.apache.wicket.markup.html.link.Page1">Home</a>
3333
<a href="http://www.google.com">Google</a>

wicket-core/src/test/java/org/apache/wicket/resource/ResourceUtilTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,30 @@ class ResourceUtilTest
3232
@Test
3333
void decodeResourceReferenceAttributesWithString() throws Exception
3434
{
35-
String urlParameter = "en_GB-style-variation";
35+
String urlParameter = "5~en_GB5~style9~variation";
3636
UrlAttributes attributes = ResourceUtil.decodeResourceReferenceAttributes(urlParameter);
3737

3838
assertEquals(Locale.UK, attributes.getLocale());
3939
assertEquals("style", attributes.getStyle());
4040
assertEquals("variation", attributes.getVariation());
4141

42-
attributes = ResourceUtil.decodeResourceReferenceAttributes("it_IT");
42+
attributes = ResourceUtil.decodeResourceReferenceAttributes("5~it_ITnullnull");
4343

4444
assertEquals(Locale.ITALY, attributes.getLocale());
4545
assertNull(attributes.getStyle());
4646
assertNull(attributes.getVariation());
4747

48-
attributes = ResourceUtil.decodeResourceReferenceAttributes("-style-variation");
48+
attributes = ResourceUtil.decodeResourceReferenceAttributes("null5~style9~variation");
4949
assertNull(attributes.getLocale());
5050
assertEquals("style", attributes.getStyle());
5151
assertEquals("variation", attributes.getVariation());
5252

53-
attributes = ResourceUtil.decodeResourceReferenceAttributes("--variation");
53+
attributes = ResourceUtil.decodeResourceReferenceAttributes("nullnull9~variation");
5454
assertNull(attributes.getLocale());
5555
assertNull(attributes.getStyle());
5656
assertEquals("variation", attributes.getVariation());
5757

58-
attributes = ResourceUtil.decodeResourceReferenceAttributes("-style");
58+
attributes = ResourceUtil.decodeResourceReferenceAttributes("null5~stylenull");
5959
assertNull(attributes.getLocale());
6060
assertEquals("style", attributes.getStyle());
6161
assertNull(attributes.getVariation());
@@ -69,13 +69,13 @@ void decodeResourceReferenceAttributesWithUrl() throws Exception
6969

7070
assertEquals(new UrlAttributes(null, null, null), attributes);
7171

72-
url = Url.parse("www.funny.url/?de_DE");
72+
url = Url.parse("www.funny.url/?5~de_DEnullnull");
7373
attributes = ResourceUtil.decodeResourceReferenceAttributes(url);
7474
assertEquals(Locale.GERMANY, attributes.getLocale());
7575
assertNull(attributes.getStyle());
7676
assertNull(attributes.getVariation());
7777

78-
url = Url.parse("www.funny.url/?-style");
78+
url = Url.parse("www.funny.url/?null5~stylenull");
7979
attributes = ResourceUtil.decodeResourceReferenceAttributes(url);
8080
assertNull(attributes.getLocale());
8181
assertEquals("style", attributes.getStyle());
@@ -90,11 +90,11 @@ void encodeResourceReferenceAttributes() throws Exception
9090

9191
attributes = new UrlAttributes(Locale.CANADA_FRENCH, "style", "variation");
9292

93-
assertEquals("fr_CA-style-variation", ResourceUtil.encodeResourceReferenceAttributes(attributes));
93+
assertEquals("5~fr_CA5~style9~variation", ResourceUtil.encodeResourceReferenceAttributes(attributes));
9494

9595
attributes = new UrlAttributes(null, null, "variation");
9696

97-
assertEquals("--variation", ResourceUtil.encodeResourceReferenceAttributes(attributes));
97+
assertEquals("nullnull9~variation", ResourceUtil.encodeResourceReferenceAttributes(attributes));
9898
}
9999

100100
@Test
@@ -136,7 +136,7 @@ void encodeResourceReferenceAttributesWithResource() throws Exception
136136
Mockito.when(resourceReference.getUrlAttributes()).thenReturn(attributes);
137137
ResourceUtil.encodeResourceReferenceAttributes(url, resourceReference);
138138

139-
assertEquals(urlString + "?fr_CA-style-variation", url.toString());
139+
assertEquals(urlString + "?5~fr_CA5~style9~variation", url.toString());
140140

141141
Mockito.reset(resourceReference);
142142

@@ -147,6 +147,6 @@ void encodeResourceReferenceAttributesWithResource() throws Exception
147147
Mockito.when(resourceReference.getUrlAttributes()).thenReturn(attributes);
148148
ResourceUtil.encodeResourceReferenceAttributes(url, resourceReference);
149149

150-
assertEquals(urlString + "?--variation", url.toString());
150+
assertEquals(urlString + "?nullnull9~variation", url.toString());
151151
}
152152
}

0 commit comments

Comments
 (0)