28
28
import java .io .StringWriter ;
29
29
import java .io .Writer ;
30
30
import java .net .MalformedURLException ;
31
+ import java .net .URI ;
31
32
import java .net .URISyntaxException ;
32
33
import java .net .URL ;
33
34
import java .nio .charset .StandardCharsets ;
@@ -549,20 +550,20 @@ void getQueryParamsNullTest() {
549
550
}
550
551
551
552
@ Test
552
- void getQueryParamsEmptyTest () throws MalformedURLException {
553
- URL url = new URL ("http://test.com/test" );
553
+ void getQueryParamsEmptyTest () throws MalformedURLException , URISyntaxException {
554
+ URL url = new URI ("http://test.com/test" ). toURL ( );
554
555
assertTrue (Util .getQueryParams (url ).isEmpty ());
555
556
}
556
557
557
558
@ Test
558
- void getQueryParamsEmptyTest2 () throws MalformedURLException {
559
- URL url = new URL ("http://test.com/test?" );
559
+ void getQueryParamsEmptyTest2 () throws MalformedURLException , URISyntaxException {
560
+ URL url = new URI ("http://test.com/test?" ). toURL ( );
560
561
assertTrue (Util .getQueryParams (url ).isEmpty ());
561
562
}
562
563
563
564
@ Test
564
- void getQueryParamsSingleTest () throws MalformedURLException {
565
- URL url = new URL ("http://test.com?param1=value1" );
565
+ void getQueryParamsSingleTest () throws MalformedURLException , URISyntaxException {
566
+ URL url = new URI ("http://test.com?param1=value1" ). toURL ( );
566
567
Map <String , List <String >> params = Util .getQueryParams (url );
567
568
568
569
assertEquals (1 , params .size ());
@@ -571,8 +572,8 @@ void getQueryParamsSingleTest() throws MalformedURLException {
571
572
}
572
573
573
574
@ Test
574
- void getQueryParamsMultipleTest () throws MalformedURLException {
575
- URL url = new URL ("http://test.com?param1=value1¶m2=value2" );
575
+ void getQueryParamsMultipleTest () throws MalformedURLException , URISyntaxException {
576
+ URL url = new URI ("http://test.com?param1=value1¶m2=value2" ). toURL ( );
576
577
Map <String , List <String >> params = Util .getQueryParams (url );
577
578
578
579
assertEquals (2 , params .size ());
@@ -582,8 +583,8 @@ void getQueryParamsMultipleTest() throws MalformedURLException {
582
583
}
583
584
584
585
@ Test
585
- void getQueryParamsMultipleSameTest () throws MalformedURLException {
586
- URL url = new URL ("http://test.com?param1=value1¶m1=value2" );
586
+ void getQueryParamsMultipleSameTest () throws MalformedURLException , URISyntaxException {
587
+ URL url = new URI ("http://test.com?param1=value1¶m1=value2" ). toURL ( );
587
588
Map <String , List <String >> params = Util .getQueryParams (url );
588
589
589
590
assertEquals (1 , params .size ());
@@ -592,8 +593,8 @@ void getQueryParamsMultipleSameTest() throws MalformedURLException {
592
593
}
593
594
594
595
@ Test
595
- void getQueryParamsEncodedTest () throws MalformedURLException {
596
- URL url = new URL ("http://test.com?param1=%3Fvalue%3F" );
596
+ void getQueryParamsEncodedTest () throws MalformedURLException , URISyntaxException {
597
+ URL url = new URI ("http://test.com?param1=%3Fvalue%3F" ). toURL ( );
597
598
Map <String , List <String >> params = Util .getQueryParams (url );
598
599
599
600
assertEquals (1 , params .size ());
@@ -602,17 +603,17 @@ void getQueryParamsEncodedTest() throws MalformedURLException {
602
603
}
603
604
604
605
@ Test
605
- void getQueryParamsEmptyValueTest () throws MalformedURLException {
606
- URL url = new URL ("http://test.com?param1=" );
606
+ void getQueryParamsEmptyValueTest () throws MalformedURLException , URISyntaxException {
607
+ URL url = new URI ("http://test.com?param1=" ). toURL ( );
607
608
608
609
Map <String , List <String >> params = Util .getQueryParams (url );
609
610
610
611
assertThat (params .get ("param1" ), contains ("" ));
611
612
}
612
613
613
614
@ Test
614
- void getQueryParamsEmptyAndNormalValuesCombinedTest () throws MalformedURLException {
615
- URL url = new URL ("http://test.com?param1=value1¶m2=¶m3¶m4=value4" );
615
+ void getQueryParamsEmptyAndNormalValuesCombinedTest () throws MalformedURLException , URISyntaxException {
616
+ URL url = new URI ("http://test.com?param1=value1¶m2=¶m3¶m4=value4" ). toURL ( );
616
617
617
618
Map <String , List <String >> params = Util .getQueryParams (url );
618
619
0 commit comments