|
15 | 15 | */ |
16 | 16 | package com.github.difflib.algorithm.jgit; |
17 | 17 |
|
18 | | -import static com.github.difflib.DiffUtilsTest.readStringListFromInputStream; |
19 | | -import com.github.difflib.TestConstants; |
20 | 18 | import com.github.difflib.algorithm.DiffAlgorithmListener; |
21 | 19 | import com.github.difflib.patch.Patch; |
22 | 20 | import com.github.difflib.patch.PatchFailedException; |
| 21 | +import java.io.BufferedReader; |
23 | 22 | import java.io.IOException; |
| 23 | +import java.io.InputStream; |
| 24 | +import java.io.InputStreamReader; |
| 25 | +import java.nio.charset.Charset; |
| 26 | +import java.nio.charset.StandardCharsets; |
24 | 27 | import java.util.ArrayList; |
25 | 28 | import java.util.List; |
| 29 | +import static java.util.stream.Collectors.toList; |
26 | 30 | import java.util.zip.ZipFile; |
27 | 31 | import org.junit.After; |
28 | 32 | import org.junit.AfterClass; |
@@ -58,7 +62,7 @@ public void tearDown() { |
58 | 62 |
|
59 | 63 | @Test |
60 | 64 | public void testPossibleDiffHangOnLargeDatasetDnaumenkoIssue26() throws IOException, PatchFailedException { |
61 | | - ZipFile zip = new ZipFile(TestConstants.MOCK_FOLDER + "/large_dataset1.zip"); |
| 65 | + ZipFile zip = new ZipFile("target/test-classes/mocks/large_dataset1.zip"); |
62 | 66 | List<String> original = readStringListFromInputStream(zip.getInputStream(zip.getEntry("ta"))); |
63 | 67 | List<String> revised = readStringListFromInputStream(zip.getInputStream(zip.getEntry("tb"))); |
64 | 68 |
|
@@ -88,4 +92,11 @@ public void diffEnd() { |
88 | 92 | assertEquals(246579, logdata.size()); |
89 | 93 | } |
90 | 94 |
|
| 95 | + public static List<String> readStringListFromInputStream(InputStream is) throws IOException { |
| 96 | + try (BufferedReader reader = new BufferedReader( |
| 97 | + new InputStreamReader(is, Charset.forName(StandardCharsets.UTF_8.name())))) { |
| 98 | + |
| 99 | + return reader.lines().collect(toList()); |
| 100 | + } |
| 101 | + } |
91 | 102 | } |
0 commit comments