コード例 #1
0
  @Test
  public void should_leave_a_windows_java_path_alone_when_running_on_windows() {
    String windowsPath = "C:\\Users\\Joe Blogs\\Documents\\somefile.pdf";
    if (runningOnWindows()) {
      WebElement field = mock(WebElement.class);

      FileToUpload fileToUpload = new FileToUpload(windowsPath);
      fileToUpload.to(field);

      verify(field).sendKeys(windowsPath);
    }
  }
コード例 #2
0
  @Test
  public void should_leave_a_unix_java_path_alone_when_running_on_unix() {
    String unixPath = "/home/myuser/target/test-classes/documentUpload/somefile.pdf";
    if (!runningOnWindows()) {
      WebElement field = mock(WebElement.class);

      FileToUpload fileToUpload = new FileToUpload(unixPath);
      fileToUpload.to(field);

      verify(field).sendKeys(unixPath);
    }
  }
コード例 #3
0
 @Test
 public void should_recognize_a_complex_unix_path() {
   assertThat(
       FileToUpload.isAFullWindowsPath(
           "/home/myuser/target/test-classes/documentUpload/somefile.pdf"),
       is(false));
 }
コード例 #4
0
 @Test
 public void should_recognize_a_unix_path() {
   assertThat(FileToUpload.isAFullWindowsPath("/home/john/somefile.pdf"), is(false));
 }
コード例 #5
0
 @Test
 public void should_recognize_a_simple_windows_path() {
   assertThat(FileToUpload.isAFullWindowsPath("C:\\Projects\\somefile.pdf"), is(true));
 }