11/*******************************************************************************
2- * Copyright (c) 2009, 2023 IBM Corporation and others.
2+ * Copyright (c) 2009, 2025 IBM Corporation and others.
33 *
44 * This program and the accompanying materials
55 * are made available under the terms of the Eclipse Public License 2.0
1919import static org .junit .Assert .assertNotNull ;
2020
2121import java .net .MalformedURLException ;
22- import java .net .URL ;
22+ import java .net .URI ;
23+ import java .net .URISyntaxException ;
2324
2425import org .eclipse .ui .browser .IWorkbenchBrowserSupport ;
2526import org .eclipse .ui .internal .browser .WebBrowserEditorInput ;
@@ -33,73 +34,60 @@ public class TestInput {
3334 private static final String ID2 = "browser.id2" ;
3435
3536 @ Test
36- public void testCompareWithNull () throws MalformedURLException {
37- WebBrowserEditorInput input = new WebBrowserEditorInput (new URL (URL1 ),
38- 0 , ID1 );
37+ public void testCompareWithNull () throws MalformedURLException , URISyntaxException {
38+ WebBrowserEditorInput input = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 0 , ID1 );
3939 assertNotNull (input );
4040 }
4141
4242 @ Test
43- public void testCompareWithNullURL () throws MalformedURLException {
44- WebBrowserEditorInput input = new WebBrowserEditorInput (new URL (URL1 ),
45- 0 , ID1 );
46- WebBrowserEditorInput input2 = new WebBrowserEditorInput (null ,
47- 0 , ID1 );
43+ public void testCompareWithNullURL () throws MalformedURLException , URISyntaxException {
44+ WebBrowserEditorInput input = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 0 , ID1 );
45+ WebBrowserEditorInput input2 = new WebBrowserEditorInput (null , 0 , ID1 );
4846 assertNotEquals (input , input2 );
4947 assertNotEquals (input2 , input );
5048 }
5149
5250 @ Test
53- public void testCompareWithSelf () throws MalformedURLException {
54- WebBrowserEditorInput input = new WebBrowserEditorInput (new URL (URL1 ),
55- 0 , ID1 );
51+ public void testCompareWithSelf () throws MalformedURLException , URISyntaxException {
52+ WebBrowserEditorInput input = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 0 , ID1 );
5653 assertEquals (input , input );
5754 }
5855
5956 @ Test
60- public void testCompareWithSimilar () throws MalformedURLException {
61- WebBrowserEditorInput input = new WebBrowserEditorInput (new URL (URL1 ),
62- 0 , ID1 );
63- WebBrowserEditorInput input2 = new WebBrowserEditorInput (new URL (URL1 ),
64- 0 , ID1 );
57+ public void testCompareWithSimilar () throws MalformedURLException , URISyntaxException {
58+ WebBrowserEditorInput input = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 0 , ID1 );
59+ WebBrowserEditorInput input2 = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 0 , ID1 );
6560 assertEquals (input , input2 );
6661 assertEquals (input .hashCode (), input2 .hashCode ());
6762 }
6863
6964 @ Test
70- public void testCompareWithDifferentUrl () throws MalformedURLException {
71- WebBrowserEditorInput input = new WebBrowserEditorInput (new URL (URL1 ),
72- 0 , ID1 );
73- WebBrowserEditorInput input2 = new WebBrowserEditorInput (new URL (URL2 ),
74- 0 , ID1 );
65+ public void testCompareWithDifferentUrl () throws MalformedURLException , URISyntaxException {
66+ WebBrowserEditorInput input = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 0 , ID1 );
67+ WebBrowserEditorInput input2 = new WebBrowserEditorInput (new URI (URL2 ).toURL (), 0 , ID1 );
7568 assertNotEquals (input , input2 );
7669 }
7770
7871 @ Test
79- public void testCompareWithDifferentId () throws MalformedURLException {
80- WebBrowserEditorInput input = new WebBrowserEditorInput (new URL (URL1 ),
81- 0 , ID1 );
82- WebBrowserEditorInput input2 = new WebBrowserEditorInput (new URL (URL1 ),
83- 0 , ID2 );
72+ public void testCompareWithDifferentId () throws MalformedURLException , URISyntaxException {
73+ WebBrowserEditorInput input = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 0 , ID1 );
74+ WebBrowserEditorInput input2 = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 0 , ID2 );
8475 assertNotEquals (input , input2 );
8576 }
8677
8778 @ Test
88- public void testCompareWithDifferentStyle () throws MalformedURLException {
89- WebBrowserEditorInput input = new WebBrowserEditorInput (new URL (URL1 ),
90- 0 , ID1 );
91- WebBrowserEditorInput input2 = new WebBrowserEditorInput (new URL (URL1 ),
92- 1 , ID1 );
79+ public void testCompareWithDifferentStyle () throws MalformedURLException , URISyntaxException {
80+ WebBrowserEditorInput input = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 0 , ID1 );
81+ WebBrowserEditorInput input2 = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 1 , ID1 );
9382 assertEquals (input , input2 );
9483 assertEquals (input .hashCode (), input2 .hashCode ());
9584 }
9685
9786 @ Test
98- public void testCompareWithStatusbarVisible () throws MalformedURLException {
99- WebBrowserEditorInput input = new WebBrowserEditorInput (new URL (URL1 ),
100- 0 , ID1 );
101- WebBrowserEditorInput input2 = new WebBrowserEditorInput (new URL (URL1 ),
102- IWorkbenchBrowserSupport .STATUS , ID1 );
87+ public void testCompareWithStatusbarVisible () throws MalformedURLException , URISyntaxException {
88+ WebBrowserEditorInput input = new WebBrowserEditorInput (new URI (URL1 ).toURL (), 0 , ID1 );
89+ WebBrowserEditorInput input2 = new WebBrowserEditorInput (new URI (URL1 ).toURL (), IWorkbenchBrowserSupport .STATUS ,
90+ ID1 );
10391 assertNotEquals (input , input2 );
10492 }
10593
@@ -110,8 +98,8 @@ public void testHashWithNullURL() {
11098 }
11199
112100 @ Test
113- public void testHashWithNullID () throws MalformedURLException {
114- WebBrowserEditorInput input = new WebBrowserEditorInput (new URL (URL1 ), 0 , null );
101+ public void testHashWithNullID () throws MalformedURLException , URISyntaxException {
102+ WebBrowserEditorInput input = new WebBrowserEditorInput (new URI (URL1 ). toURL (), 0 , null );
115103 input .hashCode (); // Fails if exception thrown
116104 }
117105
0 commit comments