aboutsummaryrefslogtreecommitdiff
path: root/javaparser-testing
diff options
context:
space:
mode:
authorRyan Beckett <beckett.ryan@gmail.com>2017-09-02 20:41:04 -0400
committerRyan Beckett <beckett.ryan@gmail.com>2017-09-02 20:48:54 -0400
commitb1b95ced57761caa9672bbf5c6c33cd461cda791 (patch)
tree0ed2beb328d57fe2308b96ea32f5e81b7b9aff0d /javaparser-testing
parent1c68064743a348f7466315631f4db5e1828b7b56 (diff)
downloadjavaparser-b1b95ced57761caa9672bbf5c6c33cd461cda791.tar.gz
Added facade to SourceZip.parse method.
Diffstat (limited to 'javaparser-testing')
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/utils/SourceZipTest.java19
1 files changed, 8 insertions, 11 deletions
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/utils/SourceZipTest.java b/javaparser-testing/src/test/java/com/github/javaparser/utils/SourceZipTest.java
index cc79d9eaf..d7efa460e 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/utils/SourceZipTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/utils/SourceZipTest.java
@@ -33,6 +33,7 @@ import java.util.List;
import org.junit.Test;
+import com.github.javaparser.ParseResult;
import com.github.javaparser.ast.CompilationUnit;
public class SourceZipTest {
@@ -44,26 +45,22 @@ public class SourceZipTest {
@Test
public void parseTestDirectory() throws URISyntaxException, IOException {
- List<CompilationUnit> units = new ArrayList<>();
SourceZip sourceZip = new SourceZip(testDir.resolve("test.zip"));
- sourceZip.parse((path, result) -> {
- units.add(result.getResult().get());
- });
- assertEquals(3, units.size());
+ List<Pair<Path, ParseResult<CompilationUnit>>> results = sourceZip.parse();
+ assertEquals(3, results.size());
+ List<CompilationUnit> units = new ArrayList<>();
+ for (Pair<Path, ParseResult<CompilationUnit>> pr : results)
+ units.add(pr.b.getResult().get());
assertTrue(units.stream().allMatch(unit -> !unit.getTypes().isEmpty()));
}
@Test(expected = IOException.class)
public void dirAsZipIsNotAllowed() throws IOException {
- new SourceZip(testDir.resolve("test")).parse((path, result) -> {
-
- });
+ new SourceZip(testDir.resolve("test")).parse();
}
@Test(expected = IOException.class)
public void fileAsZipIsNotAllowed() throws IOException {
- new SourceZip(testDir.resolve("test.txt")).parse((path, result) -> {
-
- });
+ new SourceZip(testDir.resolve("test.txt")).parse();
}
}