Browse Source

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>
stable-4.10
Jonathan Tan 7 years ago
parent
commit
5ea57ba1b5
  1. 18
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java

18
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java

@ -32,23 +32,14 @@ public class UploadPackTest {
private InMemoryRepository client; private InMemoryRepository client;
private RevCommit commit0; private TestRepository<InMemoryRepository> remote;
private RevCommit commit1;
private RevCommit tip;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
server = newRepo("server"); server = newRepo("server");
client = newRepo("client"); client = newRepo("client");
TestRepository<InMemoryRepository> remote = remote = new TestRepository<>(server);
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);
} }
@After @After
@ -62,6 +53,11 @@ public class UploadPackTest {
@Test @Test
public void testFetchParentOfShallowCommit() throws Exception { 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<>( testProtocol = new TestProtocol<>(
new UploadPackFactory<Object>() { new UploadPackFactory<Object>() {
@Override @Override

Loading…
Cancel
Save