Skip to content

Commit

Permalink
Fix failing test when there are spaces in the project path
Browse files Browse the repository at this point in the history
Use URI.getPath() rather than URL.getFile() to get the absolute path of
a test resource, since the latter fails to perform URL decoding. This
breaks the tests when the project root contain chars needing %-encoding.
  • Loading branch information
stejbac committed Nov 8, 2019
1 parent 2b2e2c2 commit 11860c5
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ public void call() throws Exception {
@Test
public void verifySignature() throws Exception {
URL url = this.getClass().getResource("/downloadUpdate/test.txt");
File dataFile = new File(url.getFile());
File dataFile = new File(url.toURI().getPath());
url = this.getClass().getResource("/downloadUpdate/test.txt.asc");
File sigFile = new File(url.getFile());
File sigFile = new File(url.toURI().getPath());
url = this.getClass().getResource("/downloadUpdate/F379A1C6.asc");
File pubKeyFile = new File(url.getFile());
File pubKeyFile = new File(url.toURI().getPath());

assertEquals(BisqInstaller.VerifyStatusEnum.OK, BisqInstaller.verifySignature(pubKeyFile, sigFile, dataFile));

url = this.getClass().getResource("/downloadUpdate/test_bad.txt");
dataFile = new File(url.getFile());
dataFile = new File(url.toURI().getPath());
url = this.getClass().getResource("/downloadUpdate/test_bad.txt.asc");
sigFile = new File(url.getFile());
sigFile = new File(url.toURI().getPath());
url = this.getClass().getResource("/downloadUpdate/F379A1C6.asc");
pubKeyFile = new File(url.getFile());
pubKeyFile = new File(url.toURI().getPath());

BisqInstaller.verifySignature(pubKeyFile, sigFile, dataFile);
assertEquals(BisqInstaller.VerifyStatusEnum.FAIL, BisqInstaller.verifySignature(pubKeyFile, sigFile, dataFile));
Expand Down

0 comments on commit 11860c5

Please sign in to comment.