Browse Source

Reuse Git object created in setUp

Removes unneeded calls to Git.wrap in test cases where a valid
Git object already exists as an instance variable.

Change-Id: Id0e032d7886dfa6a3288321503a02743413f707d
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
stable-2.0
Kevin Sawicki 13 years ago committed by Chris Aniszczyk
parent
commit
fb2113d766
  1. 18
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashApplyCommandTest.java

18
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashApplyCommandTest.java

@ -109,7 +109,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
File addedFile = writeTrashFile(addedPath, "content2"); File addedFile = writeTrashFile(addedPath, "content2");
git.add().addFilepattern(addedPath).call(); git.add().addFilepattern(addedPath).call();
RevCommit stashed = Git.wrap(db).stashCreate().call(); RevCommit stashed = git.stashCreate().call();
assertNotNull(stashed); assertNotNull(stashed);
assertFalse(addedFile.exists()); assertFalse(addedFile.exists());
@ -134,7 +134,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
public void indexDelete() throws Exception { public void indexDelete() throws Exception {
git.rm().addFilepattern("file.txt").call(); git.rm().addFilepattern("file.txt").call();
RevCommit stashed = Git.wrap(db).stashCreate().call(); RevCommit stashed = git.stashCreate().call();
assertNotNull(stashed); assertNotNull(stashed);
assertEquals("content", read(committedFile)); assertEquals("content", read(committedFile));
@ -158,7 +158,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
public void workingDirectoryModify() throws Exception { public void workingDirectoryModify() throws Exception {
writeTrashFile("file.txt", "content2"); writeTrashFile("file.txt", "content2");
RevCommit stashed = Git.wrap(db).stashCreate().call(); RevCommit stashed = git.stashCreate().call();
assertNotNull(stashed); assertNotNull(stashed);
assertEquals("content", read(committedFile)); assertEquals("content", read(committedFile));
@ -187,7 +187,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
writeTrashFile(path, "content2"); writeTrashFile(path, "content2");
RevCommit stashed = Git.wrap(db).stashCreate().call(); RevCommit stashed = git.stashCreate().call();
assertNotNull(stashed); assertNotNull(stashed);
assertEquals("content", read(subfolderFile)); assertEquals("content", read(subfolderFile));
@ -213,7 +213,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
git.add().addFilepattern("file.txt").call(); git.add().addFilepattern("file.txt").call();
writeTrashFile("file.txt", "content3"); writeTrashFile("file.txt", "content3");
RevCommit stashed = Git.wrap(db).stashCreate().call(); RevCommit stashed = git.stashCreate().call();
assertNotNull(stashed); assertNotNull(stashed);
assertEquals("content", read(committedFile)); assertEquals("content", read(committedFile));
@ -240,7 +240,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
git.add().addFilepattern("file.txt").call(); git.add().addFilepattern("file.txt").call();
writeTrashFile("file.txt", "content"); writeTrashFile("file.txt", "content");
RevCommit stashed = Git.wrap(db).stashCreate().call(); RevCommit stashed = git.stashCreate().call();
assertNotNull(stashed); assertNotNull(stashed);
assertEquals("content", read(committedFile)); assertEquals("content", read(committedFile));
@ -269,7 +269,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
FileUtils.delete(added); FileUtils.delete(added);
assertFalse(added.exists()); assertFalse(added.exists());
RevCommit stashed = Git.wrap(db).stashCreate().call(); RevCommit stashed = git.stashCreate().call();
assertNotNull(stashed); assertNotNull(stashed);
assertFalse(added.exists()); assertFalse(added.exists());
@ -296,7 +296,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
FileUtils.delete(committedFile); FileUtils.delete(committedFile);
assertFalse(committedFile.exists()); assertFalse(committedFile.exists());
RevCommit stashed = Git.wrap(db).stashCreate().call(); RevCommit stashed = git.stashCreate().call();
assertNotNull(stashed); assertNotNull(stashed);
assertEquals("content", read(committedFile)); assertEquals("content", read(committedFile));
@ -323,7 +323,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
File addedFile = writeTrashFile(addedPath, "content2"); File addedFile = writeTrashFile(addedPath, "content2");
git.add().addFilepattern(addedPath).call(); git.add().addFilepattern(addedPath).call();
RevCommit stashed = Git.wrap(db).stashCreate().call(); RevCommit stashed = git.stashCreate().call();
assertNotNull(stashed); assertNotNull(stashed);
assertTrue(committedFile.exists()); assertTrue(committedFile.exists());
assertFalse(addedFile.exists()); assertFalse(addedFile.exists());

Loading…
Cancel
Save