Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
StaticNodesParserTest to pass on Windows (#1183)
Browse files Browse the repository at this point in the history
  • Loading branch information
rain-on authored Mar 28, 2019
1 parent 8a3974a commit a0f55c7
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Files;
Expand Down Expand Up @@ -61,21 +62,20 @@ public class StaticNodesParserTest {
@Rule public TemporaryFolder testFolder = new TemporaryFolder();

@Test
public void validFileLoadsWithExpectedEnodes() throws IOException {
public void validFileLoadsWithExpectedEnodes() throws IOException, URISyntaxException {
final URL resource = StaticNodesParserTest.class.getResource("valid_static_nodes.json");
final Path path = Paths.get(resource.getPath());

final Set<EnodeURL> enodes = StaticNodesParser.fromPath(path);
final File validFile = new File(resource.getFile());
final Set<EnodeURL> enodes = StaticNodesParser.fromPath(validFile.toPath());

assertThat(enodes).containsExactly(validFileItems.toArray(new EnodeURL[validFileItems.size()]));
}

@Test
public void invalidFileThrowsAnException() {
final URL resource = StaticNodesParserTest.class.getResource("invalid_static_nodes.json");
final Path path = Paths.get(resource.getPath());
final File invalidFile = new File(resource.getFile());

assertThatThrownBy(() -> StaticNodesParser.fromPath(path))
assertThatThrownBy(() -> StaticNodesParser.fromPath(invalidFile.toPath()))
.isInstanceOf(IllegalArgumentException.class);
}

Expand Down

0 comments on commit a0f55c7

Please sign in to comment.