-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #5
- Loading branch information
Showing
2 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/test/java/io/zenwave360/jsonrefparser/RefParserTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.zenwave360.jsonrefparser; | ||
|
||
|
||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.File; | ||
import java.net.URI; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.StandardCopyOption; | ||
import java.util.Map; | ||
|
||
/** | ||
* Test that files are not locked after parsing. | ||
*/ | ||
public class RefParserTests { | ||
|
||
|
||
private static final Logger log = LoggerFactory.getLogger(RefParserTests.class.getName()); | ||
|
||
@Test | ||
public void testParserWithUri() throws Exception { | ||
Files.copy(Path.of("src/test/resources/indexed-array.yml"), Path.of("target/indexed-array.yml"), StandardCopyOption.REPLACE_EXISTING); | ||
Map<String, Object> parsed = new $RefParser(Path.of("target/indexed-array.yml").toUri()).parse().getRefs().schema(); | ||
Files.delete(Path.of("target/indexed-array.yml")); | ||
} | ||
|
||
@Test | ||
public void testParserWithFile() throws Exception { | ||
Files.copy(Path.of("src/test/resources/indexed-array.yml"), Path.of("target/indexed-array.yml"), StandardCopyOption.REPLACE_EXISTING); | ||
Map<String, Object> parsed = new $RefParser(new File("target/indexed-array.yml")).parse().getRefs().schema(); | ||
Files.delete(Path.of("target/indexed-array.yml")); | ||
} | ||
|
||
} |