diff options
author | Chris Aniszczyk <caniszczyk@gmail.com> | 2010-10-10 16:41:08 -0400 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2010-10-10 16:41:08 -0400 |
commit | ae22630bd84022b495196c4deccc76a346b9a3a1 (patch) | |
tree | 8b9ae455520f2f32fca778b032eac6710d84bc5c /org.eclipse.jgit.test | |
parent | 7bdef4583bd9aad6e4cb9e51543bdc3c0fb26db4 (diff) | |
parent | 1739af643e35efc29fa5f4828ae87941821b94b2 (diff) | |
download | jgit-ae22630bd84022b495196c4deccc76a346b9a3a1.tar.gz jgit-ae22630bd84022b495196c4deccc76a346b9a3a1.zip |
Merge "Cleanup RefUpdateTest"
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java index a8a6d9d823..4e2e14a6f5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java @@ -51,22 +51,18 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.RefRename; import org.eclipse.jgit.lib.RefUpdate; +import org.eclipse.jgit.lib.RefUpdate.Result; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.SampleDataRepositoryTestCase; -import org.eclipse.jgit.lib.RefUpdate.Result; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; -import org.eclipse.jgit.storage.file.FileRepository; -import org.eclipse.jgit.storage.file.LockFile; -import org.eclipse.jgit.storage.file.RefDirectory; -import org.eclipse.jgit.storage.file.RefDirectoryUpdate; -import org.eclipse.jgit.storage.file.ReflogReader; public class RefUpdateTest extends SampleDataRepositoryTestCase { @@ -103,9 +99,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { public void testNoCacheObjectIdSubclass() throws IOException { final String newRef = "refs/heads/abc"; final RefUpdate ru = updateRef(newRef); - final RevCommit newid = new RevCommit(ru.getNewObjectId()) { - // empty - }; + final SubclassedId newid = new SubclassedId(ru.getNewObjectId()); ru.setNewObjectId(newid); Result update = ru.update(); assertEquals(Result.NEW, update); @@ -131,19 +125,11 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { throws IOException { final String newRef = "refs/heads/z"; final RefUpdate ru = updateRef(newRef); - final RevCommit newid = new RevCommit(ru.getNewObjectId()) { - // empty - }; - ru.setNewObjectId(newid); Result update = ru.update(); assertEquals(Result.NEW, update); // end setup final String newRef2 = "refs/heads/z/a"; final RefUpdate ru2 = updateRef(newRef2); - final RevCommit newid2 = new RevCommit(ru2.getNewObjectId()) { - // empty - }; - ru.setNewObjectId(newid2); Result update2 = ru2.update(); assertEquals(Result.LOCK_FAILURE, update2); assertEquals(1, db.getReflogReader("refs/heads/z").getReverseEntries().size()); @@ -154,10 +140,6 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { throws IOException { final String newRef = "refs/heads/master/x"; final RefUpdate ru = updateRef(newRef); - final RevCommit newid = new RevCommit(ru.getNewObjectId()) { - // empty - }; - ru.setNewObjectId(newid); Result update = ru.update(); assertEquals(Result.LOCK_FAILURE, update); assertNull(db.getReflogReader("refs/heads/master/x")); @@ -168,19 +150,11 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { throws IOException { final String newRef = "refs/heads/z/a"; final RefUpdate ru = updateRef(newRef); - final RevCommit newid = new RevCommit(ru.getNewObjectId()) { - // empty - }; - ru.setNewObjectId(newid); Result update = ru.update(); assertEquals(Result.NEW, update); // end setup final String newRef2 = "refs/heads/z"; final RefUpdate ru2 = updateRef(newRef2); - final RevCommit newid2 = new RevCommit(ru2.getNewObjectId()) { - // empty - }; - ru.setNewObjectId(newid2); Result update2 = ru2.update(); assertEquals(Result.LOCK_FAILURE, update2); assertEquals(1, db.getReflogReader("refs/heads/z/a").getReverseEntries().size()); @@ -192,10 +166,6 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { throws IOException { final String newRef = "refs/heads/prefix"; final RefUpdate ru = updateRef(newRef); - final RevCommit newid = new RevCommit(ru.getNewObjectId()) { - // empty - }; - ru.setNewObjectId(newid); Result update = ru.update(); assertEquals(Result.LOCK_FAILURE, update); assertNull(db.getReflogReader("refs/heads/prefix")); @@ -853,4 +823,10 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { update.setNewObjectId(newId); refs.log(update, msg, true); } + + private static class SubclassedId extends ObjectId { + SubclassedId(AnyObjectId src) { + super(src); + } + } } |