|
|
@@ -53,7 +53,6 @@ import java.io.InputStream; |
|
|
|
|
|
|
|
import org.eclipse.jgit.api.errors.PatchApplyException; |
|
|
|
import org.eclipse.jgit.api.errors.PatchFormatException; |
|
|
|
import org.eclipse.jgit.diff.DiffFormatterReflowTest; |
|
|
|
import org.eclipse.jgit.diff.RawText; |
|
|
|
import org.eclipse.jgit.junit.RepositoryTestCase; |
|
|
|
import org.junit.Test; |
|
|
@@ -86,9 +85,7 @@ public class ApplyCommandTest extends RepositoryTestCase { |
|
|
|
|
|
|
|
return git |
|
|
|
.apply() |
|
|
|
.setPatch( |
|
|
|
DiffFormatterReflowTest.class.getResourceAsStream(name |
|
|
|
+ ".patch")).call(); |
|
|
|
.setPatch(getTestResource(name + ".patch")).call(); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
@@ -189,8 +186,7 @@ public class ApplyCommandTest extends RepositoryTestCase { |
|
|
|
} |
|
|
|
|
|
|
|
private static byte[] readFile(final String patchFile) throws IOException { |
|
|
|
final InputStream in = DiffFormatterReflowTest.class |
|
|
|
.getResourceAsStream(patchFile); |
|
|
|
final InputStream in = getTestResource(patchFile); |
|
|
|
if (in == null) { |
|
|
|
fail("No " + patchFile + " test vector"); |
|
|
|
return null; // Never happens |
|
|
@@ -206,4 +202,9 @@ public class ApplyCommandTest extends RepositoryTestCase { |
|
|
|
in.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static InputStream getTestResource(final String patchFile) { |
|
|
|
return ApplyCommandTest.class.getClassLoader() |
|
|
|
.getResourceAsStream("org/eclipse/jgit/diff/" + patchFile); |
|
|
|
} |
|
|
|
} |