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"));
  }
}

@@ -364,25 +364,31 @@
 sTest %7B%0A
+    
 %0A
+  
   @Test%0A
   public
@@ -371,32 +371,34 @@
 %0A    %0A    @Test%0A
+  
   public void pa
@@ -449,32 +449,36 @@
 ows Exception %7B%0A
+    
     URL actual =
@@ -496,32 +496,36 @@
 oUrl(%22/a/b/c%22);%0A
+    
     assertThat(a
@@ -559,32 +559,36 @@
 o(%22file%22));%0A    
+  
+  
 assertThat(actua
@@ -625,35 +625,43 @@
 a/b/c%22));%0A  
-%7D%0A%0A
+  %7D%0A    %0A  
   @Test%0A
   public voi
@@ -640,32 +640,34 @@
 %0A    %0A    @Test%0A
+  
   public void pa
@@ -714,32 +714,36 @@
 ows Exception %7B%0A
+    
     URL actual =
@@ -772,32 +772,36 @@
 ///a/b/c%22);%0A    
+ 
+   
 assertThat(%22file
@@ -831,32 +831,36 @@
 otocol()));%0A    
+   
+ 
 assertThat(actua
@@ -897,35 +897,43 @@
 a/b/c%22));%0A  
-%7D%0A%0A
+  %7D%0A    %0A  
   @Test%0A
   public voi
@@ -912,32 +912,34 @@
 %0A    %0A    @Test%0A
+  
   public void pa
@@ -994,34 +994,32 @@
 rdSlashes()%0A    
-  
 throws Exception
@@ -1013,32 +1013,36 @@
 ows Exception %7B%0A
+    
     URL actual =
@@ -1066,24 +1066,28 @@
 c:/a/b/c%22);%0A
+    
     assertTh
@@ -1125,32 +1125,36 @@
 o(%22file%22));%0A    
+  
+  
 assertThat(actua
@@ -1199,19 +1199,27 @@
 ;%0A  
-%7D%0A%0A
+  %7D%0A    %0A  
   @Test%0A
   pu
@@ -1214,16 +1214,18 @@
   @Test%0A
+  
   public
@@ -1293,18 +1293,16 @@
 s()%0A    
-  
 throws E
@@ -1312,24 +1312,28 @@
 ption %7B%0A    
+   
+ 
 URL actual =
@@ -1360,24 +1360,28 @@
 %5Ca%5C%5Cb%5C%5Cc%22);%0A
+    
     assertTh
@@ -1423,24 +1423,28 @@
 ile%22));%0A    
+ 
+   
 assertThat(a
@@ -1487,14 +1487,16 @@
 b/c%22));%0A
+  
   %7D%0A%7D%0A

Fix indentation