]> source.dussan.org Git - jgit.git/commitdiff
Remove a bit of repetition and casting in PackFileTest 23/27323/1
authorRoberto Tyley <roberto.tyley@gmail.com>
Sun, 25 May 2014 18:34:24 +0000 (19:34 +0100)
committerRoberto Tyley <roberto.tyley@gmail.com>
Mon, 26 May 2014 10:09:22 +0000 (11:09 +0100)
PackFileTest lives in o.e.j.internal.storage.file, so I think it's OK for
it to acknowledge the existence of FileRepository in order to avoid some
unnecessary casting, and probably nicer to avoid the repetition too.

Change-Id: I0de592a32f6178e6d6bf114848101e185b3111a1
Signed-off-by: Roberto Tyley <roberto.tyley@gmail.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java

index a19fcd9d502dc82cb3a74b87e253ff48d35db9d0..3324627e7f1e14643f0e07ade179d73789dda166 100644 (file)
@@ -95,7 +95,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
 
        private TestRng rng;
 
-       private Repository repo;
+       private FileRepository repo;
 
        private TestRepository<Repository> tr;
 
@@ -274,12 +274,9 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
                deflate(pack, delta);
                byte[] footer = digest(pack);
 
-               File packName = new File(new File(
-                               ((FileObjectDatabase) repo.getObjectDatabase()).getDirectory(),
-                               "pack"), idA.name() + ".pack");
-               File idxName = new File(new File(
-                               ((FileObjectDatabase) repo.getObjectDatabase()).getDirectory(),
-                               "pack"), idA.name() + ".idx");
+               File dir = new File(repo.getObjectDatabase().getDirectory(), "pack");
+               File packName = new File(dir, idA.name() + ".pack");
+               File idxName = new File(dir, idA.name() + ".idx");
 
                FileOutputStream f = new FileOutputStream(packName);
                try {