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;
return git
.apply()
- .setPatch(
- DiffFormatterReflowTest.class.getResourceAsStream(name
- + ".patch")).call();
+ .setPatch(getTestResource(name + ".patch")).call();
}
@Test
}
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
in.close();
}
}
+
+ private static InputStream getTestResource(final String patchFile) {
+ return ApplyCommandTest.class.getClassLoader()
+ .getResourceAsStream("org/eclipse/jgit/diff/" + patchFile);
+ }
}