Skip to content

Commit

Permalink
Merge pull request #2789 from ControlSystemStudio/Issue_2788
Browse files Browse the repository at this point in the history
Update test to succeed in Github actions
  • Loading branch information
shroffk authored Aug 28, 2023
2 parents 74cb08d + 0e2cb35 commit d08d075
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static org.phoebus.framework.util.ResourceParser.PV_SCHEMA;
import static org.phoebus.framework.util.ResourceParser.createResourceURI;
Expand All @@ -38,8 +39,7 @@ public class ResourceParserTest
private static final String OS = System.getProperty("os.name").toLowerCase();

@Test
public void checkFileToURI() throws Exception
{
public void checkFileToURI() throws Exception {
// File URL
URI uri = createResourceURI("file:/some/file/path");
System.out.println(uri);
Expand Down Expand Up @@ -88,13 +88,10 @@ public void checkFileToURI() throws Exception
System.out.println(bogus);
assertThat(bogus.exists(), equalTo(false));

try
{
try {
getContent(uri);
fail("Read nonexisting file?");
}
catch (Exception ex)
{
} catch (Exception ex) {
// Good, caught it
}

Expand All @@ -104,8 +101,8 @@ public void checkFileToURI() throws Exception
assertThat(uri, not(nullValue()));
assertThat(new File(uri).getCanonicalFile(), equalTo(spacey.getCanonicalFile()));
assertThat(uri.getScheme(), equalTo("file"));
if(OS.indexOf("win") >= 0) {
assertThat(uri.toString(), equalTo("file:/C:/some/dir%20with%20space/file.abc"));
if (OS.indexOf("win") >= 0) {
assertTrue(uri.toString().matches("file:/[a-zA-Z]:/some/dir%20with%20space/file.abc"));
} else {
assertThat(uri.toString(), equalTo("file:/some/dir%20with%20space/file.abc"));
}
Expand Down

0 comments on commit d08d075

Please sign in to comment.