View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.juneau.utils;
18  
19  import static org.apache.juneau.TestUtils.*;
20  import static org.apache.juneau.UriRelativity.*;
21  import static org.apache.juneau.UriResolution.*;
22  import static org.junit.jupiter.api.Assertions.*;
23  
24  import org.apache.juneau.*;
25  import org.junit.jupiter.params.*;
26  import org.junit.jupiter.params.provider.*;
27  
28  /**
29   * Verifies that the resolveUri() methods in UriContext work correctly.
30   */
31  class UriContextResolutionCombo_Test extends TestBase {
32  
33  	private static final Tester[] TESTERS = {
34  
35  		// Happy cases - All URL parts known.
36  		tester(	/* 0 */
37  			"Happy-1a",
38  			input(
39  				"http://host:port","/context","/resource","/path",
40  				"http://foo.com:123/foobar"
41  			),
42  			results(
43  				"http://foo.com:123/foobar",
44  				"http://foo.com:123/foobar",
45  				"http://foo.com:123/foobar",
46  				"http://foo.com:123/foobar",
47  				"http://foo.com:123/foobar",
48  				"http://foo.com:123/foobar"
49  			)
50  		),
51  		tester(	/* 1 */
52  			"Happy-2",
53  			input(
54  				"http://host:port","/context","/resource","/path",
55  				"http://foo.com:123"
56  			),
57  			results(
58  				"http://foo.com:123",
59  				"http://foo.com:123",
60  				"http://foo.com:123",
61  				"http://foo.com:123",
62  				"http://foo.com:123",
63  				"http://foo.com:123"
64  			)
65  		),
66  		tester(	/* 2 */
67  			"Happy-3",
68  			input(
69  				"http://host:port","/context","/resource","/path",
70  				"/foobar"
71  			),
72  			results(
73  				"http://host:port/foobar",
74  				"http://host:port/foobar",
75  				"/foobar",
76  				"/foobar",
77  				"/foobar",
78  				"/foobar"
79  			)
80  		),
81  		tester(	/* 3 */
82  			"Happy-4",
83  			input(
84  				"http://host:port","/context","/resource","/path",
85  				"/"
86  			),
87  			results(
88  				"http://host:port",
89  				"http://host:port",
90  				"/",
91  				"/",
92  				"/",
93  				"/"
94  			)
95  		),
96  		tester(	/* 4 */
97  			"Happy-5",
98  			input(
99  				"http://host:port","/context","/resource","/path",
100 				"foobar"
101 			),
102 			results(
103 				"http://host:port/context/resource/foobar",
104 				"http://host:port/context/resource/foobar",
105 				"/context/resource/foobar",
106 				"/context/resource/foobar",
107 				"foobar",
108 				"foobar"
109 			)
110 		),
111 		tester(	/* 5 */
112 			"Happy-6",
113 			input(
114 				"http://host:port","/context","/resource","/path",
115 				""
116 			),
117 			results(
118 				"http://host:port/context/resource",
119 				"http://host:port/context/resource/path",
120 				"/context/resource",
121 				"/context/resource/path",
122 				"",
123 				""
124 			)
125 		),
126 		tester(	/* 6 */
127 			"Happy-7",
128 			input(
129 				"http://host:port","/context","/resource","/path",
130 				"context:/foo"
131 			),
132 			results(
133 				"http://host:port/context/foo",
134 				"http://host:port/context/foo",
135 				"/context/foo",
136 				"/context/foo",
137 				"/context/foo",
138 				"/context/foo"
139 			)
140 		),
141 		tester(	/* 7 */
142 			"Happy-8",
143 			input(
144 				"http://host:port","/context","/resource","/path",
145 				"context:/"
146 			),
147 			results(
148 				"http://host:port/context",
149 				"http://host:port/context",
150 				"/context",
151 				"/context",
152 				"/context",
153 				"/context"
154 			)
155 		),
156 		tester(	/* 8 */
157 			"Happy-9",
158 			input(
159 				"http://host:port","/context","/resource","/path",
160 				"servlet:/foo"
161 			),
162 			results(
163 				"http://host:port/context/resource/foo",
164 				"http://host:port/context/resource/foo",
165 				"/context/resource/foo",
166 				"/context/resource/foo",
167 				"/context/resource/foo",
168 				"/context/resource/foo"
169 			)
170 		),
171 		tester(	/* 9 */
172 			"Happy-10",
173 			input(
174 				"http://host:port","/context","/resource","/path",
175 				"servlet:/"
176 			),
177 			results(
178 				"http://host:port/context/resource",
179 				"http://host:port/context/resource",
180 				"/context/resource",
181 				"/context/resource",
182 				"/context/resource",
183 				"/context/resource"
184 			)
185 		),
186 
187 		// Multiple context and resource parts
188 		tester(	/* 10 */
189 			"MultiContextResource-1",
190 			input(
191 				"http://host:port","/c1/c2","/r1/r2","/p1/p2",
192 				"http://foo.com:123/foobar"
193 			),
194 			results(
195 				"http://foo.com:123/foobar",
196 				"http://foo.com:123/foobar",
197 				"http://foo.com:123/foobar",
198 				"http://foo.com:123/foobar",
199 				"http://foo.com:123/foobar",
200 				"http://foo.com:123/foobar"
201 			)
202 		),
203 		tester(	/* 11 */
204 			"MultiContextResource-2",
205 			input(
206 				"http://host:port","/c1/c2","/r1/r2","/p1/p2",
207 				"http://foo.com:123"
208 			),
209 			results(
210 				"http://foo.com:123",
211 				"http://foo.com:123",
212 				"http://foo.com:123",
213 				"http://foo.com:123",
214 				"http://foo.com:123",
215 				"http://foo.com:123"
216 			)
217 		),
218 		tester(	/* 12 */
219 			"MultiContextResource-3",
220 			input(
221 				"http://host:port","/c1/c2","/r1/r2","/p1/p2",
222 				"/foobar"
223 			),
224 			results(
225 				"http://host:port/foobar",
226 				"http://host:port/foobar",
227 				"/foobar",
228 				"/foobar",
229 				"/foobar",
230 				"/foobar"
231 			)
232 		),
233 		tester(	/* 13 */
234 			"MultiContextResource-4",
235 			input(
236 				"http://host:port","/c1/c2","/r1/r2","/p1/p2",
237 				"/"
238 			),
239 			results(
240 				"http://host:port",
241 				"http://host:port",
242 				"/",
243 				"/",
244 				"/",
245 				"/"
246 			)
247 		),
248 		tester(	/* 14 */
249 			"MultiContextResource-5",
250 			input(
251 				"http://host:port","/c1/c2","/r1/r2","/p1/p2",
252 				"foobar"
253 			),
254 			results(
255 				"http://host:port/c1/c2/r1/r2/foobar",
256 				"http://host:port/c1/c2/r1/r2/p1/foobar",
257 				"/c1/c2/r1/r2/foobar",
258 				"/c1/c2/r1/r2/p1/foobar",
259 				"foobar",
260 				"foobar"
261 			)
262 		),
263 		tester(	/* 15 */
264 			"MultiContextResource-6",
265 			input(
266 				"http://host:port","/c1/c2","/r1/r2","/p1/p2",
267 				""
268 			),
269 			results(
270 				"http://host:port/c1/c2/r1/r2",
271 				"http://host:port/c1/c2/r1/r2/p1/p2",
272 				"/c1/c2/r1/r2",
273 				"/c1/c2/r1/r2/p1/p2",
274 				"",
275 				""
276 			)
277 		),
278 		tester(	/* 16 */
279 			"MultiContextResource-7",
280 			input(
281 				"http://host:port","/c1/c2","/r1/r2","/p1/p2",
282 				"context:/foo"
283 			),
284 			results(
285 				"http://host:port/c1/c2/foo",
286 				"http://host:port/c1/c2/foo",
287 				"/c1/c2/foo",
288 				"/c1/c2/foo",
289 				"/c1/c2/foo",
290 				"/c1/c2/foo"
291 			)
292 		),
293 		tester(	/* 17 */
294 			"MultiContextResource-8",
295 			input(
296 				"http://host:port","/c1/c2","/r1/r2","/p1/p2",
297 				"context:/"
298 			),
299 			results(
300 				"http://host:port/c1/c2",
301 				"http://host:port/c1/c2",
302 				"/c1/c2",
303 				"/c1/c2",
304 				"/c1/c2",
305 				"/c1/c2"
306 			)
307 		),
308 		tester(	/* 18 */
309 			"MultiContextResource-9",
310 			input(
311 				"http://host:port","/c1/c2","/r1/r2","/p1/p2",
312 				"servlet:/foo"
313 			),
314 			results(
315 				"http://host:port/c1/c2/r1/r2/foo",
316 				"http://host:port/c1/c2/r1/r2/foo",
317 				"/c1/c2/r1/r2/foo",
318 				"/c1/c2/r1/r2/foo",
319 				"/c1/c2/r1/r2/foo",
320 				"/c1/c2/r1/r2/foo"
321 			)
322 		),
323 		tester(	/* 19 */
324 			"MultiContextResource-10",
325 			input(
326 				"http://host:port","/c1/c2","/r1/r2","/p1/p2",
327 				"servlet:/"
328 			),
329 			results(
330 				"http://host:port/c1/c2/r1/r2",
331 				"http://host:port/c1/c2/r1/r2",
332 				"/c1/c2/r1/r2",
333 				"/c1/c2/r1/r2",
334 				"/c1/c2/r1/r2",
335 				"/c1/c2/r1/r2"
336 			)
337 		),
338 
339 		// No authority given
340 		tester(	/* 20 */
341 			"NoAuthority-1",
342 			input(
343 				"","/context","/resource","/path",
344 				"http://foo.com:123/foobar"
345 			),
346 			results(
347 				"http://foo.com:123/foobar",
348 				"http://foo.com:123/foobar",
349 				"http://foo.com:123/foobar",
350 				"http://foo.com:123/foobar",
351 				"http://foo.com:123/foobar",
352 				"http://foo.com:123/foobar"
353 			)
354 		),
355 		tester(	/* 21 */
356 			"NoAuthority-2",
357 			input(
358 				"","/context","/resource","/path",
359 				"http://foo.com:123"
360 			),
361 			results(
362 				"http://foo.com:123",
363 				"http://foo.com:123",
364 				"http://foo.com:123",
365 				"http://foo.com:123",
366 				"http://foo.com:123",
367 				"http://foo.com:123"
368 			)
369 		),
370 		tester(	/* 22 */
371 			"NoAuthority-3",
372 			input(
373 				"","/context","/resource","/path",
374 				"/foobar"
375 			),
376 			results(
377 				"/foobar",
378 				"/foobar",
379 				"/foobar",
380 				"/foobar",
381 				"/foobar",
382 				"/foobar"
383 			)
384 		),
385 		tester(	/* 23 */
386 			"NoAuthority-4",
387 			input(
388 				"","/context","/resource","/path",
389 				"/"
390 			),
391 			results(
392 				"/",
393 				"/",
394 				"/",
395 				"/",
396 				"/",
397 				"/"
398 			)
399 		),
400 		tester(	/* 24 */
401 			"NoAuthority-5",
402 			input(
403 				"","/context","/resource","/path",
404 				"foobar"
405 			),
406 			results(
407 				"/context/resource/foobar",
408 				"/context/resource/foobar",
409 				"/context/resource/foobar",
410 				"/context/resource/foobar",
411 				"foobar",
412 				"foobar"
413 			)
414 		),
415 		tester(	/* 25 */
416 			"NoAuthority-6",
417 			input(
418 				"","/context","/resource","/path",
419 				""
420 			),
421 			results(
422 				"/context/resource",
423 				"/context/resource/path",
424 				"/context/resource",
425 				"/context/resource/path",
426 				"",
427 				""
428 			)
429 		),
430 		tester(	/* 26 */
431 			"NoAuthority-7",
432 			input(
433 				"","/context","/resource","/path",
434 				"context:/foo"
435 			),
436 			results(
437 				"/context/foo",
438 				"/context/foo",
439 				"/context/foo",
440 				"/context/foo",
441 				"/context/foo",
442 				"/context/foo"
443 			)
444 		),
445 		tester(	/* 27 */
446 			"NoAuthority-8",
447 			input(
448 				"","/context","/resource","/path",
449 				"context:/"
450 			),
451 			results(
452 				"/context",
453 				"/context",
454 				"/context",
455 				"/context",
456 				"/context",
457 				"/context"
458 			)
459 		),
460 		tester(	/* 28 */
461 			"NoAuthority-9",
462 			input(
463 				"","/context","/resource","/path",
464 				"servlet:/foo"
465 			),
466 			results(
467 				"/context/resource/foo",
468 				"/context/resource/foo",
469 				"/context/resource/foo",
470 				"/context/resource/foo",
471 				"/context/resource/foo",
472 				"/context/resource/foo"
473 			)
474 		),
475 		tester(	/* 29 */
476 			"NoAuthority-10",
477 			input(
478 				"","/context","/resource","/path",
479 				"servlet:/"
480 			),
481 			results(
482 				"/context/resource",
483 				"/context/resource",
484 				"/context/resource",
485 				"/context/resource",
486 				"/context/resource",
487 				"/context/resource"
488 			)
489 		),
490 
491 		// No authority or context given
492 		tester(	/* 30 */
493 			"NoAuthorityOrContext-1",
494 			input(
495 				"","","/resource","/path",
496 				"http://foo.com:123/foobar"
497 			),
498 			results(
499 				"http://foo.com:123/foobar",
500 				"http://foo.com:123/foobar",
501 				"http://foo.com:123/foobar",
502 				"http://foo.com:123/foobar",
503 				"http://foo.com:123/foobar",
504 				"http://foo.com:123/foobar"
505 			)
506 		),
507 		tester(	/* 31 */
508 			"NoAuthorityOrContext-2",
509 			input(
510 				"","","/resource","/path",
511 				"http://foo.com:123"
512 			),
513 			results(
514 				"http://foo.com:123",
515 				"http://foo.com:123",
516 				"http://foo.com:123",
517 				"http://foo.com:123",
518 				"http://foo.com:123",
519 				"http://foo.com:123"
520 			)
521 		),
522 		tester(	/* 32 */
523 			"NoAuthorityOrContext-3",
524 			input(
525 				"","","/resource","/path",
526 				"/foobar"
527 			),
528 			results(
529 				"/foobar",
530 				"/foobar",
531 				"/foobar",
532 				"/foobar",
533 				"/foobar",
534 				"/foobar"
535 			)
536 		),
537 		tester(	/* 33 */
538 			"NoAuthorityOrContext-4",
539 			input(
540 				"","","/resource","/path",
541 				"/"
542 			),
543 			results(
544 				"/",
545 				"/",
546 				"/",
547 				"/",
548 				"/",
549 				"/"
550 			)
551 		),
552 		tester(	/* 34 */
553 			"NoAuthorityOrContext-5",
554 			input(
555 				"","","/resource","/path",
556 				"foobar"
557 			),
558 			results(
559 				"/resource/foobar",
560 				"/resource/foobar",
561 				"/resource/foobar",
562 				"/resource/foobar",
563 				"foobar",
564 				"foobar"
565 			)
566 		),
567 		tester(	/* 35 */
568 			"NoAuthorityOrContext-6",
569 			input(
570 				"","","/resource","/path",
571 				""
572 			),
573 			results(
574 				"/resource",
575 				"/resource/path",
576 				"/resource",
577 				"/resource/path",
578 				"",
579 				""
580 			)
581 		),
582 		tester(	/* 36 */
583 			"NoAuthorityOrContext-7",
584 			input(
585 				"","","/resource","/path",
586 				"context:/foo"
587 			),
588 			results(
589 				"/foo",
590 				"/foo",
591 				"/foo",
592 				"/foo",
593 				"/foo",
594 				"/foo"
595 			)
596 		),
597 		tester(	/* 37 */
598 			"NoAuthorityOrContext-8",
599 			input(
600 				"","","/resource","/path",
601 				"context:/"
602 			),
603 			results(
604 				"/",
605 				"/",
606 				"/",
607 				"/",
608 				"/",
609 				"/"
610 			)
611 		),
612 		tester(	/* 38 */
613 			"NoAuthorityOrContext-9",
614 			input(
615 				"","","/resource","/path",
616 				"servlet:/foo"
617 			),
618 			results(
619 				"/resource/foo",
620 				"/resource/foo",
621 				"/resource/foo",
622 				"/resource/foo",
623 				"/resource/foo",
624 				"/resource/foo"
625 			)
626 		),
627 		tester(	/* 39 */
628 			"NoAuthorityOrContext-10",
629 			input(
630 				"","","/resource","/path",
631 				"servlet:/"
632 			),
633 			results(
634 				"/resource",
635 				"/resource",
636 				"/resource",
637 				"/resource",
638 				"/resource",
639 				"/resource"
640 			)
641 		),
642 
643 		// No authority or context or resource given
644 		tester(	/* 40 */
645 			"NoAuthorityOrContextOrResource-1",
646 			input(
647 				"","","","/path",
648 				"http://foo.com:123/foobar"
649 			),
650 			results(
651 				"http://foo.com:123/foobar",
652 				"http://foo.com:123/foobar",
653 				"http://foo.com:123/foobar",
654 				"http://foo.com:123/foobar",
655 				"http://foo.com:123/foobar",
656 				"http://foo.com:123/foobar"
657 			)
658 		),
659 		tester(	/* 41 */
660 			"NoAuthorityOrContextOrResource-2",
661 			input(
662 				"","","","/path",
663 				"http://foo.com:123"
664 			),
665 			results(
666 				"http://foo.com:123",
667 				"http://foo.com:123",
668 				"http://foo.com:123",
669 				"http://foo.com:123",
670 				"http://foo.com:123",
671 				"http://foo.com:123"
672 			)
673 		),
674 		tester(	/* 42 */
675 			"NoAuthorityOrContextOrResource-3",
676 			input(
677 				"","","","/path",
678 				"/foobar"
679 			),
680 			results(
681 				"/foobar",
682 				"/foobar",
683 				"/foobar",
684 				"/foobar",
685 				"/foobar",
686 				"/foobar"
687 			)
688 		),
689 		tester(	/* 43 */
690 			"NoAuthorityOrContextOrResource-4",
691 			input(
692 				"","","","/path",
693 				"/"
694 			),
695 			results(
696 				"/",
697 				"/",
698 				"/",
699 				"/",
700 				"/",
701 				"/"
702 			)
703 		),
704 		tester(	/* 44 */
705 			"NoAuthorityOrContextOrResource-5",
706 			input(
707 				"","","","/path",
708 				"foobar"
709 			),
710 			results(
711 				"/foobar",
712 				"/foobar",
713 				"/foobar",
714 				"/foobar",
715 				"foobar",
716 				"foobar"
717 			)
718 		),
719 		tester(	/* 45 */
720 			"NoAuthorityOrContextOrResource-6",
721 			input(
722 				"","","","/path",
723 				""
724 			),
725 			results(
726 				"/",
727 				"/path",
728 				"/",
729 				"/path",
730 				"",
731 				""
732 			)
733 		),
734 		tester(	/* 46 */
735 			"NoAuthorityOrContextOrResource-7",
736 			input(
737 				"","","","/path",
738 				"context:/foo"
739 			),
740 			results(
741 				"/foo",
742 				"/foo",
743 				"/foo",
744 				"/foo",
745 				"/foo",
746 				"/foo"
747 			)
748 		),
749 		tester(	/* 47 */
750 			"NoAuthorityOrContextOrResource-8",
751 			input(
752 				"","","","/path",
753 				"context:/"
754 			),
755 			results(
756 				"/",
757 				"/",
758 				"/",
759 				"/",
760 				"/",
761 				"/"
762 			)
763 		),
764 		tester(	/* 48 */
765 			"NoAuthorityOrContextOrResource-9",
766 			input(
767 				"","","","/path",
768 				"servlet:/foo"
769 			),
770 			results(
771 				"/foo",
772 				"/foo",
773 				"/foo",
774 				"/foo",
775 				"/foo",
776 				"/foo"
777 			)
778 		),
779 		tester(	/* 49 */
780 			"NoAuthorityOrContextOrResource-10",
781 			input(
782 				"","","","/path",
783 				"servlet:/"
784 			),
785 			results(
786 				"/",
787 				"/",
788 				"/",
789 				"/",
790 				"/",
791 				"/"
792 			)
793 		),
794 
795 		// No context or resource given.
796 		tester(	/* 50 */
797 			"NoContextOrResource-1",
798 			input(
799 				"http://host:port","","","/path",
800 				"http://foo.com:123/foobar"
801 			),
802 			results(
803 				"http://foo.com:123/foobar",
804 				"http://foo.com:123/foobar",
805 				"http://foo.com:123/foobar",
806 				"http://foo.com:123/foobar",
807 				"http://foo.com:123/foobar",
808 				"http://foo.com:123/foobar"
809 			)
810 		),
811 		tester(	/* 51 */
812 			"NoContextOrResource-2",
813 			input(
814 				"http://host:port","","","/path",
815 				"http://foo.com:123"
816 			),
817 			results(
818 				"http://foo.com:123",
819 				"http://foo.com:123",
820 				"http://foo.com:123",
821 				"http://foo.com:123",
822 				"http://foo.com:123",
823 				"http://foo.com:123"
824 			)
825 		),
826 		tester(	/* 52 */
827 			"NoContextOrResource-3",
828 			input(
829 				"http://host:port","","","/path",
830 				"/foobar"
831 			),
832 			results(
833 				"http://host:port/foobar",
834 				"http://host:port/foobar",
835 				"/foobar",
836 				"/foobar",
837 				"/foobar",
838 				"/foobar"
839 			)
840 		),
841 		tester(	/* 53 */
842 			"NoContextOrResource-4",
843 			input(
844 				"http://host:port","","","/path",
845 				"/"
846 			),
847 			results(
848 				"http://host:port",
849 				"http://host:port",
850 				"/",
851 				"/",
852 				"/",
853 				"/"
854 			)
855 		),
856 		tester(	/* 54 */
857 			"NoContextOrResource-5",
858 			input(
859 				"http://host:port","","","/path",
860 				"foobar"
861 			),
862 			results(
863 				"http://host:port/foobar",
864 				"http://host:port/foobar",
865 				"/foobar",
866 				"/foobar",
867 				"foobar",
868 				"foobar"
869 			)
870 		),
871 		tester(	/* 55 */
872 			"NoContextOrResource-6",
873 			input(
874 				"http://host:port","","","/path",
875 				""
876 			),
877 			results(
878 				"http://host:port",
879 				"http://host:port/path",
880 				"/",
881 				"/path",
882 				"",
883 				""
884 			)
885 		),
886 		tester(	/* 56 */
887 			"NoContextOrResource-7",
888 			input(
889 				"http://host:port","","","/path",
890 				"context:/foo"
891 			),
892 			results(
893 				"http://host:port/foo",
894 				"http://host:port/foo",
895 				"/foo",
896 				"/foo",
897 				"/foo",
898 				"/foo"
899 			)
900 		),
901 		tester(	/* 57 */
902 			"NoContextOrResource-8",
903 			input(
904 				"http://host:port","","","/path",
905 				"context:/"
906 			),
907 			results(
908 				"http://host:port",
909 				"http://host:port",
910 				"/",
911 				"/",
912 				"/",
913 				"/"
914 			)
915 		),
916 		tester(	/* 58 */
917 			"NoContextOrResource-9",
918 			input(
919 				"http://host:port","","","/path",
920 				"servlet:/foo"
921 			),
922 			results(
923 				"http://host:port/foo",
924 				"http://host:port/foo",
925 				"/foo",
926 				"/foo",
927 				"/foo",
928 				"/foo"
929 			)
930 		),
931 		tester(	/* 59 */
932 			"NoContextOrResource-10",
933 			input(
934 				"http://host:port","","","/path",
935 				"servlet:/"
936 			),
937 			results(
938 				"http://host:port",
939 				"http://host:port",
940 				"/",
941 				"/",
942 				"/",
943 				"/"
944 			)
945 		)
946 	};
947 
948 	private static class Tester {
949 		final String label;
950 		final Input input;
951 		final Results results;
952 
953 		Tester(String label, Input input, Results results) {
954 			this.label = label;
955 			this.input = input;
956 			this.results = results;
957 		}
958 	}
959 
960 	private static class Input {
961 		final String uri;
962 		final String authority, context, resource, path;
963 
964 		Input(String authority, String context, String resource, String path, String uri) {
965 			this.authority = authority;
966 			this.context = context;
967 			this.resource = resource;
968 			this.path = path;
969 			this.uri = uri;
970 		}
971 	}
972 
973 	private static class Results {
974 		final String aResource, aPathInfo, rrResource, rrPathInfo, nResource, nPathInfo;
975 
976 		public Results(String aResource, String aPathInfo, String rrResource, String rrPathInfo, String nResource, String nPathInfo) {
977 			this.aResource = aResource;
978 			this.aPathInfo = aPathInfo;
979 			this.rrResource = rrResource;
980 			this.rrPathInfo = rrPathInfo;
981 			this.nResource = nResource;
982 			this.nPathInfo = nPathInfo;
983 		}
984 	}
985 
986 	public static Tester tester(String label, Input input, Results results) {
987 		return new Tester(label, input, results);
988 	}
989 
990 	public static Input input(String authority, String context, String resource, String path, String uri) {
991 		return new Input(authority, context, resource, path, uri);
992 	}
993 
994 	public static Results results(String eAbsResource, String eAbsPathInfo, String eRrResource, String eRrPathInfo, String eNoneResource, String eNonePathInfo) {
995 		return new Results(eAbsResource, eAbsPathInfo, eRrResource, eRrPathInfo, eNoneResource, eNonePathInfo);
996 	}
997 
998 	static Tester[] testers() {
999 		return TESTERS;
1000 	}
1001 
1002 	@ParameterizedTest
1003 	@MethodSource("testers")
1004 	void a01_testAbsoluteResource(Tester t) {
1005 		var x = UriResolver.of(ABSOLUTE, RESOURCE, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).resolve(t.input.uri);
1006 		assertEquals(t.results.aResource, x, fms("{0}: testAbsolute() failed", t.label));
1007 	}
1008 
1009 	@ParameterizedTest
1010 	@MethodSource("testers")
1011 	void a02_testAppendAbsoluteResource(Tester t) {
1012 		var x = UriResolver.of(ABSOLUTE, RESOURCE, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).append(new StringBuilder(), t.input.uri);
1013 		assertString(t.results.aResource, x, fms("{0}: testAbsolute() failed", t.label));
1014 	}
1015 
1016 	@ParameterizedTest
1017 	@MethodSource("testers")
1018 	void a03_testAbsolutePathInfo(Tester t) {
1019 		var x = UriResolver.of(ABSOLUTE, PATH_INFO, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).resolve(t.input.uri);
1020 		assertEquals(t.results.aPathInfo, x, fms("{0}: testAbsolute() failed", t.label));
1021 	}
1022 
1023 	@ParameterizedTest
1024 	@MethodSource("testers")
1025 	void a04_testAppendAbsolutePathInfo(Tester t) {
1026 		var x = UriResolver.of(ABSOLUTE, PATH_INFO, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).append(new StringBuilder(), t.input.uri);
1027 		assertString(t.results.aPathInfo, x, fms("{0}: testAbsolute() failed", t.label));
1028 	}
1029 
1030 	@ParameterizedTest
1031 	@MethodSource("testers")
1032 	void a05_testRootRelativeResource(Tester t) {
1033 		var x = UriResolver.of(ROOT_RELATIVE, RESOURCE, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).resolve(t.input.uri);
1034 		assertEquals(t.results.rrResource, x, fms("{0}: testAbsolute() failed", t.label));
1035 	}
1036 
1037 	@ParameterizedTest
1038 	@MethodSource("testers")
1039 	void a06_testAppendRootRelativeResource(Tester t) {
1040 		var x = UriResolver.of(ROOT_RELATIVE, RESOURCE, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).append(new StringBuilder(), t.input.uri);
1041 		assertString(t.results.rrResource, x, fms("{0}: testAbsolute() failed", t.label));
1042 	}
1043 
1044 	@ParameterizedTest
1045 	@MethodSource("testers")
1046 	void a07_testRootRelativePathInfo(Tester t) {
1047 		var x = UriResolver.of(ROOT_RELATIVE, PATH_INFO, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).resolve(t.input.uri);
1048 		assertEquals(t.results.rrPathInfo, x, fms("{0}: testAbsolute() failed", t.label));
1049 	}
1050 
1051 	@ParameterizedTest
1052 	@MethodSource("testers")
1053 	void a08_testAppendRootRelativePathInfo(Tester t) {
1054 		var x = UriResolver.of(ROOT_RELATIVE, PATH_INFO, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).append(new StringBuilder(), t.input.uri);
1055 		assertString(t.results.rrPathInfo, x, fms("{0}: testAbsolute() failed", t.label));
1056 	}
1057 
1058 	@ParameterizedTest
1059 	@MethodSource("testers")
1060 	void a09_testNoneResource(Tester t) {
1061 		var x = UriResolver.of(NONE, RESOURCE, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).resolve(t.input.uri);
1062 		assertEquals(t.results.nResource, x, fms("{0}: testAbsolute() failed", t.label));
1063 	}
1064 
1065 	@ParameterizedTest
1066 	@MethodSource("testers")
1067 	void a10_testAppendNoneResource(Tester t) {
1068 		var x = UriResolver.of(NONE, RESOURCE, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).append(new StringBuilder(), t.input.uri);
1069 		assertString(t.results.nResource, x, fms("{0}: testAbsolute() failed", t.label));
1070 	}
1071 
1072 	@ParameterizedTest
1073 	@MethodSource("testers")
1074 	void a11_testNonePathInfo(Tester t) {
1075 		var x = UriResolver.of(NONE, PATH_INFO, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).resolve(t.input.uri);
1076 		assertEquals(t.results.nPathInfo, x, fms("{0}: testAbsolute() failed", t.label));
1077 	}
1078 
1079 	@ParameterizedTest
1080 	@MethodSource("testers")
1081 	void a12_testAppendNonePathInfo(Tester t) {
1082 		var x = UriResolver.of(NONE, PATH_INFO, UriContext.of(t.input.authority, t.input.context, t.input.resource, t.input.path)).append(new StringBuilder(), t.input.uri);
1083 		assertString(t.results.nPathInfo, x, fms("{0}: testAbsolute() failed", t.label));
1084 	}
1085 }