diff options
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DiffCommandTest.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DiffCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DiffCommandTest.java index 16a3d608f0..1aa74e8914 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DiffCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DiffCommandTest.java @@ -43,6 +43,8 @@ package org.eclipse.jgit.api; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.io.ByteArrayOutputStream; import java.io.File; @@ -222,6 +224,23 @@ public class DiffCommandTest extends RepositoryTestCase { assertEquals(expected.toString(), actual); } + @Test + public void testNoOutputStreamSet() throws Exception { + File file = writeTrashFile("test.txt", "a"); + assertTrue(file.setLastModified(file.lastModified() - 5000)); + Git git = new Git(db); + git.add().addFilepattern(".").call(); + write(file, "b"); + + List<DiffEntry> diffs = git.diff().call(); + assertNotNull(diffs); + assertEquals(1, diffs.size()); + DiffEntry diff = diffs.get(0); + assertEquals(ChangeType.MODIFY, diff.getChangeType()); + assertEquals("test.txt", diff.getOldPath()); + assertEquals("test.txt", diff.getNewPath()); + } + private AbstractTreeIterator getTreeIterator(String name) throws IOException { final ObjectId id = db.resolve(name); |