diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2009-10-02 18:54:20 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2009-10-05 12:17:11 -0700 |
commit | 3ce8c91e759ee1a9fca1d7b3cb2646b76388de6c (patch) | |
tree | f1d4d36dc9bea0841b0fd105c539a45375792b81 /org.eclipse.jgit.test | |
parent | 1640812b89b6adffce580ec0472c266f6fcc0403 (diff) | |
download | jgit-3ce8c91e759ee1a9fca1d7b3cb2646b76388de6c.tar.gz jgit-3ce8c91e759ee1a9fca1d7b3cb2646b76388de6c.zip |
Move setupReflog test function to only test that cares
Only one test class actually needs this function, so instead of
us inheriting it down into every test, move it to that one class.
Change-Id: I5700ca48df4177153f2b3861dec7c538c621e775
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java | 22 | ||||
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java | 19 |
2 files changed, 22 insertions, 19 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java index dae7cb8955..1f2f25d5e2 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java @@ -44,6 +44,10 @@ package org.eclipse.jgit.lib; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; import java.text.SimpleDateFormat; import java.util.List; @@ -173,4 +177,22 @@ public class ReflogReaderTest extends RepositoryTestCase { assertEquals(0, db.getReflogReader("master").getReverseEntries().size()); assertNull(db.getReflogReader("master").getLastEntry()); } + + private void setupReflog(String logName, byte[] data) + throws FileNotFoundException, IOException { + File logfile = new File(db.getDirectory(), logName); + if (!logfile.getParentFile().mkdirs() + && !logfile.getParentFile().isDirectory()) { + throw new IOException( + "oops, cannot create the directory for the test reflog file" + + logfile); + } + FileOutputStream fileOutputStream = new FileOutputStream(logfile); + try { + fileOutputStream.write(data); + } finally { + fileOutputStream.close(); + } + } + } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java index 2870e4126a..ac8881b1fc 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java @@ -46,7 +46,6 @@ package org.eclipse.jgit.lib; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; @@ -326,22 +325,4 @@ public abstract class RepositoryTestCase extends TestCase { repositoriesToClose.add(newRepo); return newRepo; } - - protected void setupReflog(String logName, byte[] data) - throws FileNotFoundException, IOException { - File logfile = new File(db.getDirectory(), logName); - if (!logfile.getParentFile().mkdirs() - && !logfile.getParentFile().isDirectory()) { - throw new IOException( - "oops, cannot create the directory for the test reflog file" - + logfile); - } - FileOutputStream fileOutputStream = new FileOutputStream(logfile); - try { - fileOutputStream.write(data); - } finally { - fileOutputStream.close(); - } - } - } |