assertEquals("file:/" + resource.replace('\\', '/'), uri.toString());
resource = resource.replace('\\', '/'); if (resource.charAt(0) != '/') resource = "/" + resource;  assertEquals("file:" + resource, uri.toString());
  public void testPlatformURI() throws Exception  {    {      String resource = "platform:/resource/myProject/foo.txt";      URI uri = URI.createURI(resource);      assertTrue(uri.isPlatform());      assertEquals("platform:/resource/myProject/foo.txt", uri.toString());      assertEquals("/myProject/foo.txt", uri.toPlatformString(true));    }        {      String resource = "myProject/foo.txt";      URI uri = URI.createPlatformResourceURI(resource);      assertTrue(uri.isPlatform());      assertEquals("platform:/resource/myProject/foo.txt", uri.toString());      assertEquals("/myProject/foo.txt", uri.toPlatformString(true));    }    {      String resource = "platform:/resource/myProject/foo.txt";      URI uri = URI.createPlatformResourceURI(resource);      assertTrue(uri.isPlatform());      assertEquals("platform:/resource/platform:/resource/myProject/foo.txt", uri.toString());      assertEquals("/platform:/resource/myProject/foo.txt", uri.toPlatformString(true));    }    {      String resource = new File("myProject/foo.txt").getAbsolutePath();      URI uri = URI.createFileURI(resource);      assertFalse(uri.isPlatform());      assertTrue(uri.isFile());      assertEquals("file:/" + resource.replace('\\', '/'), uri.toString());      assertNull(uri.toPlatformString(true));    }    {      String resource = "myProject/foo.txt";      URI uri = URI.createFileURI(resource);      assertFalse(uri.isPlatform());      assertTrue(uri.isFile());      assertEquals("myProject/foo.txt", uri.toString());      assertNull(uri.toPlatformString(true));    }    String[] paths = UNENCODED_PLATFORM_PATHS;    String[] encodedURIStrings = ENCODED_PLATFORM_PATH_URIS;    for (int i = 0, len = paths.length; i < len; i++)    {      String path = paths[i];      URI uri = URI.createPlatformResourceURI(path, true);      assertEquals("Bad platform resource encode: " + path, encodedURIStrings[i], uri.toString());      assertEquals(encodedURIStrings[i].substring("platform:/resource".length()), uri.toPlatformString(false));          }  }