You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/03/31 21:53:23 UTC

[GitHub] [netbeans] lbownik commented on a change in pull request #3902: improved tests for BaseUtilities.toFile & BaseUtitities.toURI

lbownik commented on a change in pull request #3902:
URL: https://github.com/apache/netbeans/pull/3902#discussion_r840044650



##########
File path: platform/openide.util/test/unit/src/org/openide/util/BaseUtilitiesTest.java
##########
@@ -111,31 +112,106 @@ public void testIsJavaIdentifier() throws Exception {
         assertFalse(BaseUtilities.isJavaIdentifier("some.thing"));
     }
 
-    public void testFileURI() throws Exception {
-        if (BaseUtilities.isWindows()) {
-            assertFileURI("C:\\some\\path #1", "file:/C:/some/path%20%231");
-            assertEquals(new File("C:\\some\\path"), BaseUtilities.toFile(new URI("file:/C:/some/path")));
-            assertEquals(new File("C:\\some\\path"), BaseUtilities.toFile(new URI("file:///C:/some/path")));
-            assertEquals(new File("C:\\some\\path"), BaseUtilities.toFile(new URI("file:/C:/some/path/")));
-            assertFileURI("\\\\server\\share\\path", "file://server/share/path");
-            assertEquals(new File("\\\\server\\share\\path"), BaseUtilities.toFile(new URI("file:////server/share/path")));
-            assertEquals(new File("\\\\server\\share\\path #1"), BaseUtilities.toFile(new URI("file:////server/share/path%20%231")));
-        } else {
-            assertFileURI("/some/path #1", "file:/some/path%20%231");
-            assertEquals(new File("/some/path"), BaseUtilities.toFile(new URI("file:/some/path")));
-            assertEquals(new File("/some/path"), BaseUtilities.toFile(new URI("file:///some/path")));
-            assertEquals(new File("/some/path"), BaseUtilities.toFile(new URI("file:/some/path/")));
+    //--------------------------------------------------------------------------
+    public void test_toFile_throwsNullPonter_whenArgumentIsNull()
+            throws Exception {
+
+        try {
+            toFile(null);
+            fail();
+        } catch (final NullPointerException e) {
+            return;
+        }
+    }
+    
+    //--------------------------------------------------------------------------
+    public void test_toFile_throwsIllegalArgument_whenGivenNonFileURI()
+            throws Exception {
+
+        try {
+            toFile(new URI("http://example.com"));
+            fail();
+        } catch (final IllegalArgumentException e) {
+            return;

Review comment:
       my mistake - I realized it as well




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists