Skip to content

Commit

Permalink
Ignore testWindowsAbsoluteFilePath exception if not on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Apr 12, 2021
1 parent 29955a2 commit e05b584
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,18 @@ public void testWindowsAbsolutePath() {
@Test
public void testWindowsAbsoluteFilePath() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("file://C:\\no_way_this_file_is_found.doc");
Object value = pathEditor.getValue();
assertThat(value instanceof Path).isTrue();
Path path = (Path) value;
assertThat(!path.toFile().exists()).isTrue();
try {
pathEditor.setAsText("file://C:\\no_way_this_file_is_found.doc");
Object value = pathEditor.getValue();
assertThat(value instanceof Path).isTrue();
Path path = (Path) value;
assertThat(!path.toFile().exists()).isTrue();
}
catch (IllegalArgumentException ex) {
if (File.separatorChar == '\\') { // on Windows, otherwise silently ignore
throw ex;
}
}
}

@Test
Expand Down

0 comments on commit e05b584

Please sign in to comment.