2828import java .io .StringWriter ;
2929import java .io .Writer ;
3030import java .net .MalformedURLException ;
31+ import java .net .URI ;
3132import java .net .URISyntaxException ;
3233import java .net .URL ;
3334import java .nio .charset .StandardCharsets ;
@@ -549,20 +550,20 @@ void getQueryParamsNullTest() {
549550 }
550551
551552 @ 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 ( );
554555 assertTrue (Util .getQueryParams (url ).isEmpty ());
555556 }
556557
557558 @ 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 ( );
560561 assertTrue (Util .getQueryParams (url ).isEmpty ());
561562 }
562563
563564 @ 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 ( );
566567 Map <String , List <String >> params = Util .getQueryParams (url );
567568
568569 assertEquals (1 , params .size ());
@@ -571,8 +572,8 @@ void getQueryParamsSingleTest() throws MalformedURLException {
571572 }
572573
573574 @ 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 ( );
576577 Map <String , List <String >> params = Util .getQueryParams (url );
577578
578579 assertEquals (2 , params .size ());
@@ -582,8 +583,8 @@ void getQueryParamsMultipleTest() throws MalformedURLException {
582583 }
583584
584585 @ 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 ( );
587588 Map <String , List <String >> params = Util .getQueryParams (url );
588589
589590 assertEquals (1 , params .size ());
@@ -592,8 +593,8 @@ void getQueryParamsMultipleSameTest() throws MalformedURLException {
592593 }
593594
594595 @ 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 ( );
597598 Map <String , List <String >> params = Util .getQueryParams (url );
598599
599600 assertEquals (1 , params .size ());
@@ -602,17 +603,17 @@ void getQueryParamsEncodedTest() throws MalformedURLException {
602603 }
603604
604605 @ 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 ( );
607608
608609 Map <String , List <String >> params = Util .getQueryParams (url );
609610
610611 assertThat (params .get ("param1" ), contains ("" ));
611612 }
612613
613614 @ 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 ( );
616617
617618 Map <String , List <String >> params = Util .getQueryParams (url );
618619
0 commit comments