]> source.dussan.org Git - jgit.git/commitdiff
Pull up method for creating DirCacheEntry into RepositoryTestCase 86/8386/1
authorRobin Stocker <robin@nibor.org>
Sun, 28 Oct 2012 13:25:11 +0000 (14:25 +0100)
committerRobin Stocker <robin@nibor.org>
Sun, 28 Oct 2012 13:25:11 +0000 (14:25 +0100)
Change-Id: I6e6522289553137df1a46ceeb52f461e9d25a290

org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/ForPathTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java

index 60408054be7ce68e4777af14f307f95de2033a77..16051bf6813790e66e759e820c20d0e56a800d60 100644 (file)
@@ -473,4 +473,22 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase {
                        throw new RuntimeException(e);
                }
        }
+
+       protected DirCacheEntry createEntry(final String path, final FileMode mode) {
+               return createEntry(path, mode, DirCacheEntry.STAGE_0, path);
+       }
+
+       protected DirCacheEntry createEntry(final String path, final FileMode mode,
+                       final String content) {
+               return createEntry(path, mode, DirCacheEntry.STAGE_0, content);
+       }
+
+       protected DirCacheEntry createEntry(final String path, final FileMode mode,
+                       final int stage, final String content) {
+               final DirCacheEntry entry = new DirCacheEntry(path, stage);
+               entry.setFileMode(mode);
+               entry.setObjectId(new ObjectInserter.Formatter().idFor(
+                               Constants.OBJ_BLOB, Constants.encode(content)));
+               return entry;
+       }
 }
index ff9f1883481b4c4e830dcbc184842ec573041f83..8b4a5f4dbc1a33a6f799d99662935a6bce6be3d5 100644 (file)
 
 package org.eclipse.jgit.merge;
 
-import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheBuilder;
-import org.eclipse.jgit.dircache.DirCacheEntry;
 import org.eclipse.jgit.lib.CommitBuilder;
-import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.FileMode;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.ObjectInserter;
@@ -81,16 +78,16 @@ public class CherryPickTest extends RepositoryTestCase {
                        final DirCacheBuilder p = treeP.builder();
                        final DirCacheBuilder t = treeT.builder();
 
-                       b.add(makeEntry("a", FileMode.REGULAR_FILE));
+                       b.add(createEntry("a", FileMode.REGULAR_FILE));
 
-                       o.add(makeEntry("a", FileMode.REGULAR_FILE));
-                       o.add(makeEntry("o", FileMode.REGULAR_FILE));
+                       o.add(createEntry("a", FileMode.REGULAR_FILE));
+                       o.add(createEntry("o", FileMode.REGULAR_FILE));
 
-                       p.add(makeEntry("a", FileMode.REGULAR_FILE, "q"));
-                       p.add(makeEntry("p-fail", FileMode.REGULAR_FILE));
+                       p.add(createEntry("a", FileMode.REGULAR_FILE, "q"));
+                       p.add(createEntry("p-fail", FileMode.REGULAR_FILE));
 
-                       t.add(makeEntry("a", FileMode.REGULAR_FILE));
-                       t.add(makeEntry("t", FileMode.REGULAR_FILE));
+                       t.add(createEntry("a", FileMode.REGULAR_FILE));
+                       t.add(createEntry("t", FileMode.REGULAR_FILE));
 
                        b.finish();
                        o.finish();
@@ -147,14 +144,14 @@ public class CherryPickTest extends RepositoryTestCase {
                        final DirCacheBuilder p = treeP.builder();
                        final DirCacheBuilder t = treeT.builder();
 
-                       b.add(makeEntry("a", FileMode.REGULAR_FILE));
+                       b.add(createEntry("a", FileMode.REGULAR_FILE));
 
-                       p.add(makeEntry("a", FileMode.REGULAR_FILE, "q"));
-                       p.add(makeEntry("p-fail", FileMode.REGULAR_FILE));
+                       p.add(createEntry("a", FileMode.REGULAR_FILE, "q"));
+                       p.add(createEntry("p-fail", FileMode.REGULAR_FILE));
 
-                       t.add(makeEntry("a", FileMode.REGULAR_FILE, "q"));
-                       t.add(makeEntry("p-fail", FileMode.REGULAR_FILE));
-                       t.add(makeEntry("t", FileMode.REGULAR_FILE));
+                       t.add(createEntry("a", FileMode.REGULAR_FILE, "q"));
+                       t.add(createEntry("p-fail", FileMode.REGULAR_FILE));
+                       t.add(createEntry("t", FileMode.REGULAR_FILE));
 
                        b.finish();
                        p.finish();
@@ -203,18 +200,4 @@ public class CherryPickTest extends RepositoryTestCase {
                odi.flush();
                return id;
        }
-
-       private DirCacheEntry makeEntry(final String path, final FileMode mode)
-                       throws Exception {
-               return makeEntry(path, mode, path);
-       }
-
-       private DirCacheEntry makeEntry(final String path, final FileMode mode,
-                       final String content) throws Exception {
-               final DirCacheEntry ent = new DirCacheEntry(path);
-               ent.setFileMode(mode);
-               ent.setObjectId(new ObjectInserter.Formatter().idFor(OBJ_BLOB,
-                               Constants.encode(content)));
-               return ent;
-       }
 }
index 45b8aa855ac5bd5f31bf1440856e82143cd36be4..81add84094b1200f800431bfe095926d6ab6988e 100644 (file)
@@ -44,7 +44,6 @@
 
 package org.eclipse.jgit.merge;
 
-import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -53,9 +52,7 @@ import java.io.IOException;
 
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheBuilder;
-import org.eclipse.jgit.dircache.DirCacheEntry;
 import org.eclipse.jgit.lib.CommitBuilder;
-import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.FileMode;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.ObjectInserter;
@@ -123,15 +120,15 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
                        final DirCacheBuilder o = treeO.builder();
                        final DirCacheBuilder t = treeT.builder();
 
-                       b.add(makeEntry("libelf-po/a", FileMode.REGULAR_FILE));
-                       b.add(makeEntry("libelf/c", FileMode.REGULAR_FILE));
+                       b.add(createEntry("libelf-po/a", FileMode.REGULAR_FILE));
+                       b.add(createEntry("libelf/c", FileMode.REGULAR_FILE));
 
-                       o.add(makeEntry("Makefile", FileMode.REGULAR_FILE));
-                       o.add(makeEntry("libelf-po/a", FileMode.REGULAR_FILE));
-                       o.add(makeEntry("libelf/c", FileMode.REGULAR_FILE));
+                       o.add(createEntry("Makefile", FileMode.REGULAR_FILE));
+                       o.add(createEntry("libelf-po/a", FileMode.REGULAR_FILE));
+                       o.add(createEntry("libelf/c", FileMode.REGULAR_FILE));
 
-                       t.add(makeEntry("libelf-po/a", FileMode.REGULAR_FILE));
-                       t.add(makeEntry("libelf/c", FileMode.REGULAR_FILE, "blah"));
+                       t.add(createEntry("libelf-po/a", FileMode.REGULAR_FILE));
+                       t.add(createEntry("libelf/c", FileMode.REGULAR_FILE, "blah"));
 
                        b.finish();
                        o.finish();
@@ -176,14 +173,14 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
                        final DirCacheBuilder o = treeO.builder();
                        final DirCacheBuilder t = treeT.builder();
 
-                       b.add(makeEntry("d/o", FileMode.REGULAR_FILE));
-                       b.add(makeEntry("d/t", FileMode.REGULAR_FILE));
+                       b.add(createEntry("d/o", FileMode.REGULAR_FILE));
+                       b.add(createEntry("d/t", FileMode.REGULAR_FILE));
 
-                       o.add(makeEntry("d/o", FileMode.REGULAR_FILE, "o !"));
-                       o.add(makeEntry("d/t", FileMode.REGULAR_FILE));
+                       o.add(createEntry("d/o", FileMode.REGULAR_FILE, "o !"));
+                       o.add(createEntry("d/t", FileMode.REGULAR_FILE));
 
-                       t.add(makeEntry("d/o", FileMode.REGULAR_FILE));
-                       t.add(makeEntry("d/t", FileMode.REGULAR_FILE, "t !"));
+                       t.add(createEntry("d/o", FileMode.REGULAR_FILE));
+                       t.add(createEntry("d/t", FileMode.REGULAR_FILE, "t !"));
 
                        b.finish();
                        o.finish();
@@ -224,14 +221,14 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
                        final DirCacheBuilder o = treeO.builder();
                        final DirCacheBuilder t = treeT.builder();
 
-                       b.add(makeEntry("d/o", FileMode.REGULAR_FILE));
-                       b.add(makeEntry("d/t", FileMode.REGULAR_FILE));
+                       b.add(createEntry("d/o", FileMode.REGULAR_FILE));
+                       b.add(createEntry("d/t", FileMode.REGULAR_FILE));
 
-                       o.add(makeEntry("d/o", FileMode.REGULAR_FILE));
-                       o.add(makeEntry("d/t", FileMode.REGULAR_FILE, "o !"));
+                       o.add(createEntry("d/o", FileMode.REGULAR_FILE));
+                       o.add(createEntry("d/t", FileMode.REGULAR_FILE, "o !"));
 
-                       t.add(makeEntry("d/o", FileMode.REGULAR_FILE, "t !"));
-                       t.add(makeEntry("d/t", FileMode.REGULAR_FILE, "t !"));
+                       t.add(createEntry("d/o", FileMode.REGULAR_FILE, "t !"));
+                       t.add(createEntry("d/t", FileMode.REGULAR_FILE, "t !"));
 
                        b.finish();
                        o.finish();
@@ -258,13 +255,13 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
                        final DirCacheBuilder o = treeO.builder();
                        final DirCacheBuilder t = treeT.builder();
 
-                       b.add(makeEntry("d/o", FileMode.REGULAR_FILE));
-                       b.add(makeEntry("d/t", FileMode.REGULAR_FILE));
+                       b.add(createEntry("d/o", FileMode.REGULAR_FILE));
+                       b.add(createEntry("d/t", FileMode.REGULAR_FILE));
 
-                       o.add(makeEntry("d", FileMode.REGULAR_FILE));
+                       o.add(createEntry("d", FileMode.REGULAR_FILE));
 
-                       t.add(makeEntry("d/o", FileMode.REGULAR_FILE));
-                       t.add(makeEntry("d/t", FileMode.REGULAR_FILE, "t !"));
+                       t.add(createEntry("d/o", FileMode.REGULAR_FILE));
+                       t.add(createEntry("d/t", FileMode.REGULAR_FILE, "t !"));
 
                        b.finish();
                        o.finish();
@@ -291,13 +288,13 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
                        final DirCacheBuilder o = treeO.builder();
                        final DirCacheBuilder t = treeT.builder();
 
-                       b.add(makeEntry("d/o", FileMode.REGULAR_FILE));
-                       b.add(makeEntry("d/t", FileMode.REGULAR_FILE));
+                       b.add(createEntry("d/o", FileMode.REGULAR_FILE));
+                       b.add(createEntry("d/t", FileMode.REGULAR_FILE));
 
-                       o.add(makeEntry("d/o", FileMode.REGULAR_FILE));
-                       o.add(makeEntry("d/t", FileMode.REGULAR_FILE, "o !"));
+                       o.add(createEntry("d/o", FileMode.REGULAR_FILE));
+                       o.add(createEntry("d/t", FileMode.REGULAR_FILE, "o !"));
 
-                       t.add(makeEntry("d", FileMode.REGULAR_FILE));
+                       t.add(createEntry("d", FileMode.REGULAR_FILE));
 
                        b.finish();
                        o.finish();
@@ -324,11 +321,11 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
                        final DirCacheBuilder o = treeO.builder();
                        final DirCacheBuilder t = treeT.builder();
 
-                       b.add(makeEntry("d", FileMode.REGULAR_FILE));
+                       b.add(createEntry("d", FileMode.REGULAR_FILE));
 
-                       o.add(makeEntry("d", FileMode.REGULAR_FILE, "o !"));
+                       o.add(createEntry("d", FileMode.REGULAR_FILE, "o !"));
 
-                       t.add(makeEntry("d/o", FileMode.REGULAR_FILE));
+                       t.add(createEntry("d/o", FileMode.REGULAR_FILE));
 
                        b.finish();
                        o.finish();
@@ -355,11 +352,11 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
                        final DirCacheBuilder o = treeO.builder();
                        final DirCacheBuilder t = treeT.builder();
 
-                       b.add(makeEntry("d", FileMode.REGULAR_FILE));
+                       b.add(createEntry("d", FileMode.REGULAR_FILE));
 
-                       o.add(makeEntry("d/o", FileMode.REGULAR_FILE));
+                       o.add(createEntry("d/o", FileMode.REGULAR_FILE));
 
-                       t.add(makeEntry("d", FileMode.REGULAR_FILE, "t !"));
+                       t.add(createEntry("d", FileMode.REGULAR_FILE, "t !"));
 
                        b.finish();
                        o.finish();
@@ -393,18 +390,4 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
                odi.flush();
                return id;
        }
-
-       private DirCacheEntry makeEntry(final String path, final FileMode mode)
-                       throws Exception {
-               return makeEntry(path, mode, path);
-       }
-
-       private DirCacheEntry makeEntry(final String path, final FileMode mode,
-                       final String content) throws Exception {
-               final DirCacheEntry ent = new DirCacheEntry(path);
-               ent.setFileMode(mode);
-               ent.setObjectId(new ObjectInserter.Formatter().idFor(OBJ_BLOB,
-                               Constants.encode(content)));
-               return ent;
-       }
 }
index e8b2785b7ddd3c69a995bb139a1c67cf0daa11e8..7dd343b9f5b7d0ab7a7fdb54d5aa749434332086 100644 (file)
@@ -49,7 +49,6 @@ import static org.junit.Assert.assertEquals;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheBuilder;
 import org.eclipse.jgit.dircache.DirCacheEntry;
-import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.FileMode;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.ObjectInserter;
@@ -65,15 +64,6 @@ public class ForPathTest extends RepositoryTestCase {
 
        private static final FileMode EXECUTABLE_FILE = FileMode.EXECUTABLE_FILE;
 
-       private DirCacheEntry makeEntry(final String path, final FileMode mode)
-                       throws Exception {
-               final DirCacheEntry ent = new DirCacheEntry(path);
-               ent.setFileMode(mode);
-               ent.setObjectId(new ObjectInserter.Formatter().idFor(
-                               Constants.OBJ_BLOB, Constants.encode(path)));
-               return ent;
-       }
-
        @Test
        public void testFindObjects() throws Exception {
                final DirCache tree0 = DirCache.newInCore();
@@ -81,13 +71,13 @@ public class ForPathTest extends RepositoryTestCase {
                ObjectReader or = db.newObjectReader();
                ObjectInserter oi = db.newObjectInserter();
 
-               DirCacheEntry aDotB = makeEntry("a.b", EXECUTABLE_FILE);
+               DirCacheEntry aDotB = createEntry("a.b", EXECUTABLE_FILE);
                b0.add(aDotB);
-               DirCacheEntry aSlashB = makeEntry("a/b", REGULAR_FILE);
+               DirCacheEntry aSlashB = createEntry("a/b", REGULAR_FILE);
                b0.add(aSlashB);
-               DirCacheEntry aSlashCSlashD = makeEntry("a/c/d", REGULAR_FILE);
+               DirCacheEntry aSlashCSlashD = createEntry("a/c/d", REGULAR_FILE);
                b0.add(aSlashCSlashD);
-               DirCacheEntry aZeroB = makeEntry("a0b", SYMLINK);
+               DirCacheEntry aZeroB = createEntry("a0b", SYMLINK);
                b0.add(aZeroB);
                b0.finish();
                assertEquals(4, tree0.getEntryCount());
index 707e6c9dfa012c8a4e06cedeb8bfd7ac63ad163d..3f37e867975d74e4d40e0dc794809d6b2a313be6 100644 (file)
@@ -49,11 +49,8 @@ import static org.junit.Assert.assertTrue;
 
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheBuilder;
-import org.eclipse.jgit.dircache.DirCacheEntry;
 import org.eclipse.jgit.dircache.DirCacheIterator;
-import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.FileMode;
-import org.eclipse.jgit.lib.ObjectInserter;
 import org.eclipse.jgit.lib.RepositoryTestCase;
 import org.junit.Test;
 
@@ -76,10 +73,10 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
                        final DirCacheBuilder b0 = tree0.builder();
                        final DirCacheBuilder b1 = tree1.builder();
 
-                       b0.add(makeEntry("a", REGULAR_FILE));
-                       b0.add(makeEntry("a.b", EXECUTABLE_FILE));
-                       b1.add(makeEntry("a/b", REGULAR_FILE));
-                       b0.add(makeEntry("a0b", SYMLINK));
+                       b0.add(createEntry("a", REGULAR_FILE));
+                       b0.add(createEntry("a.b", EXECUTABLE_FILE));
+                       b1.add(createEntry("a/b", REGULAR_FILE));
+                       b0.add(createEntry("a0b", SYMLINK));
 
                        b0.finish();
                        b1.finish();
@@ -107,10 +104,10 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
                        final DirCacheBuilder b0 = tree0.builder();
                        final DirCacheBuilder b1 = tree1.builder();
 
-                       b0.add(makeEntry("a", REGULAR_FILE));
-                       b0.add(makeEntry("a.b", EXECUTABLE_FILE));
-                       b1.add(makeEntry("a/b", REGULAR_FILE));
-                       b0.add(makeEntry("a0b", SYMLINK));
+                       b0.add(createEntry("a", REGULAR_FILE));
+                       b0.add(createEntry("a.b", EXECUTABLE_FILE));
+                       b1.add(createEntry("a/b", REGULAR_FILE));
+                       b0.add(createEntry("a0b", SYMLINK));
 
                        b0.finish();
                        b1.finish();
@@ -142,11 +139,11 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
                        final DirCacheBuilder b0 = tree0.builder();
                        final DirCacheBuilder b1 = tree1.builder();
 
-                       b0.add(makeEntry("a", REGULAR_FILE));
-                       b0.add(makeEntry("a.b", EXECUTABLE_FILE));
-                       b1.add(makeEntry("a.b", EXECUTABLE_FILE));
-                       b1.add(makeEntry("a/b", REGULAR_FILE));
-                       b0.add(makeEntry("a0b", SYMLINK));
+                       b0.add(createEntry("a", REGULAR_FILE));
+                       b0.add(createEntry("a.b", EXECUTABLE_FILE));
+                       b1.add(createEntry("a.b", EXECUTABLE_FILE));
+                       b1.add(createEntry("a/b", REGULAR_FILE));
+                       b0.add(createEntry("a0b", SYMLINK));
 
                        b0.finish();
                        b1.finish();
@@ -178,11 +175,11 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
                        final DirCacheBuilder b0 = tree0.builder();
                        final DirCacheBuilder b1 = tree1.builder();
 
-                       b0.add(makeEntry("a", REGULAR_FILE));
-                       b1.add(makeEntry("a.b", EXECUTABLE_FILE));
-                       b1.add(makeEntry("a/b", REGULAR_FILE));
-                       b0.add(makeEntry("a0b", SYMLINK));
-                       b1.add(makeEntry("a0b", SYMLINK));
+                       b0.add(createEntry("a", REGULAR_FILE));
+                       b1.add(createEntry("a.b", EXECUTABLE_FILE));
+                       b1.add(createEntry("a/b", REGULAR_FILE));
+                       b0.add(createEntry("a0b", SYMLINK));
+                       b1.add(createEntry("a0b", SYMLINK));
 
                        b0.finish();
                        b1.finish();
@@ -214,12 +211,12 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
                        final DirCacheBuilder b0 = tree0.builder();
                        final DirCacheBuilder b1 = tree1.builder();
 
-                       b0.add(makeEntry("0", REGULAR_FILE));
-                       b0.add(makeEntry("a", REGULAR_FILE));
-                       b1.add(makeEntry("0", REGULAR_FILE));
-                       b1.add(makeEntry("a.b", REGULAR_FILE));
-                       b1.add(makeEntry("a/b", REGULAR_FILE));
-                       b1.add(makeEntry("a/c/e", REGULAR_FILE));
+                       b0.add(createEntry("0", REGULAR_FILE));
+                       b0.add(createEntry("a", REGULAR_FILE));
+                       b1.add(createEntry("0", REGULAR_FILE));
+                       b1.add(createEntry("a.b", REGULAR_FILE));
+                       b1.add(createEntry("a/b", REGULAR_FILE));
+                       b1.add(createEntry("a/c/e", REGULAR_FILE));
 
                        b0.finish();
                        b1.finish();
@@ -249,15 +246,6 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
                assertFalse(tw.isDirectoryFileConflict());
        }
 
-       private DirCacheEntry makeEntry(final String path, final FileMode mode)
-                       throws Exception {
-               final DirCacheEntry ent = new DirCacheEntry(path);
-               ent.setFileMode(mode);
-               ent.setObjectId(new ObjectInserter.Formatter().idFor(
-                               Constants.OBJ_BLOB, Constants.encode(path)));
-               return ent;
-       }
-
        private static void assertModes(final String path, final FileMode mode0,
                        final FileMode mode1, final TreeWalk tw) throws Exception {
                assertTrue("has " + path, tw.next());
index e80d4853367a8c38b5fcede3a9c7bc99746b1a4a..ddb31b14d1c46a5b97e29baab356bac1bf381281 100644 (file)
@@ -53,9 +53,7 @@ import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheBuilder;
 import org.eclipse.jgit.dircache.DirCacheEntry;
 import org.eclipse.jgit.dircache.DirCacheIterator;
-import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.FileMode;
-import org.eclipse.jgit.lib.ObjectInserter;
 import org.eclipse.jgit.lib.RepositoryTestCase;
 import org.junit.Test;
 
@@ -183,11 +181,7 @@ public class PostOrderTreeWalkTest extends RepositoryTestCase {
        }
 
        private DirCacheEntry makeFile(final String path) throws Exception {
-               final DirCacheEntry ent = new DirCacheEntry(path);
-               ent.setFileMode(REGULAR_FILE);
-               ent.setObjectId(new ObjectInserter.Formatter().idFor(
-                               Constants.OBJ_BLOB, Constants.encode(path)));
-               return ent;
+               return createEntry(path, REGULAR_FILE);
        }
 
        private static void assertModes(final String path, final FileMode mode0,