package org.javacs;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;

import java.net.URL;
import org.junit.Test;

public class UrlsTest {
    
    @Test
    public void pathToUrl_whenPathStartsWithForwardSlash() throws Exception {
        URL actual = Urls.pathToUrl("/a/b/c");
        assertThat(actual.getProtocol(), equalTo("file"));
        assertThat(actual.getPath(), containsString("/a/b/c"));
    }
    
    @Test
    public void pathToUrl_whenPathStartsWithProtocol() throws Exception {
        URL actual = Urls.pathToUrl("file:///a/b/c");
        assertThat("file", equalTo(actual.getProtocol()));
        assertThat(actual.getPath(), containsString("/a/b/c"));
    }
    
    @Test
    public void pathToUrl_whenPathStartsWithDriveLetter_usingForwardSlashes()
    throws Exception {
        URL actual = Urls.pathToUrl("c:/a/b/c");
        assertThat(actual.getProtocol(), equalTo("file"));
        assertThat(actual.getPath(), containsString("/a/b/c"));
    }
    
    @Test
    public void pathToUrl_whenPathStartsWithDriveLetter_usingBackslashes()
    throws Exception {
        URL actual = Urls.pathToUrl("c:\\a\\b\\c");
        assertThat(actual.getProtocol(), equalTo("file"));
        assertThat(actual.getPath(), containsString("/a/b/c"));
    }
}

@@ -123,140 +123,8 @@
 To;%0A
-import static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.junit.Assert.assertFalse;%0A
 impo
@@ -162,16 +162,16 @@
 rtThat;%0A
+
 %0Aimport 
@@ -435,72 +435,8 @@
 ));%0A
-        assertThat(actual.getPath(), containsString(%22/a/b/c%22));%0A
     
@@ -603,24 +603,8 @@
 hat(
-%22file%22, equalTo(
 actu
@@ -623,71 +623,23 @@
 ol()
-));%0A        assertThat(actual.getPath(), containsString(%22/a/b/c
+, equalTo(%22file
 %22));
@@ -730,32 +730,40 @@
 orwardSlashes()%0A
+        
     throws Excep
@@ -761,32 +761,32 @@
 ows Exception %7B%0A
-
         URL actu
@@ -881,72 +881,8 @@
 ));%0A
-        assertThat(actual.getPath(), containsString(%22/a/b/c%22));%0A
     
@@ -969,24 +969,32 @@
 ckslashes()%0A
+        
     throws E
@@ -996,32 +996,32 @@
 ows Exception %7B%0A
-
         URL actu
@@ -1052,24 +1052,24 @@
 %5Ca%5C%5Cb%5C%5Cc%22);%0A
+
         asse
@@ -1119,72 +1119,8 @@
 ));%0A
-        assertThat(actual.getPath(), containsString(%22/a/b/c%22));%0A
     

Remove unecessary OS-dependent tests.