summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2017-11-01 16:23:32 -0700
committerJonathan Tan <jonathantanmy@google.com>2017-11-01 17:51:41 -0700
commit5ea57ba1b5b02dd69b7ff66a346e62c94cd277ed (patch)
tree6056edc4d2f5821e817576df6c067b5e7398c2bb
parent0c5ea86af336da3cc5967467f3917ce9e7244102 (diff)
downloadjgit-5ea57ba1b5b02dd69b7ff66a346e62c94cd277ed.tar.gz
jgit-5ea57ba1b5b02dd69b7ff66a346e62c94cd277ed.zip
UploadPackTest: construct commits in test method
In a subsequent commit, more tests will be added. This commit allows those tests to reuse fields. Change-Id: Icbd17d158cfe3ba4dacbd8a11a67f9e7607b41b3 Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
index 27c7674e9c..908bddfa97 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
@@ -32,23 +32,14 @@ public class UploadPackTest {
private InMemoryRepository client;
- private RevCommit commit0;
-
- private RevCommit commit1;
-
- private RevCommit tip;
+ private TestRepository<InMemoryRepository> remote;
@Before
public void setUp() throws Exception {
server = newRepo("server");
client = newRepo("client");
- TestRepository<InMemoryRepository> remote =
- new TestRepository<>(server);
- commit0 = remote.commit().message("0").create();
- commit1 = remote.commit().message("1").parent(commit0).create();
- tip = remote.commit().message("2").parent(commit1).create();
- remote.update("master", tip);
+ remote = new TestRepository<>(server);
}
@After
@@ -62,6 +53,11 @@ public class UploadPackTest {
@Test
public void testFetchParentOfShallowCommit() throws Exception {
+ RevCommit commit0 = remote.commit().message("0").create();
+ RevCommit commit1 = remote.commit().message("1").parent(commit0).create();
+ RevCommit tip = remote.commit().message("2").parent(commit1).create();
+ remote.update("master", tip);
+
testProtocol = new TestProtocol<>(
new UploadPackFactory<Object>() {
@Override