Browse Source

MergeCommandTest: Use JUnit's assume to check preconditions

Using the assume method, instead of just returning, will cause the
test to be marked as skipped rather than passed on systems where
the precondition is not satisfied.

Change-Id: I13672371f6cd3c481a0a6247e0eaed3aac6d766e
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
tags/v4.3.0.201603230630-rc1
David Pursehouse 8 years ago
parent
commit
61bb701eeb

+ 3
- 4
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java View File

import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;


import java.io.File; import java.io.File;
import java.util.Iterator; import java.util.Iterator;


@Test @Test
public void testFileModeMerge() throws Exception { public void testFileModeMerge() throws Exception {
if (!FS.DETECTED.supportsExecute())
return;
// Only Java6 // Only Java6
assumeTrue(FS.DETECTED.supportsExecute());
try (Git git = new Git(db)) { try (Git git = new Git(db)) {
writeTrashFile("mergeableMode", "a"); writeTrashFile("mergeableMode", "a");
setExecutable(git, "mergeableMode", false); setExecutable(git, "mergeableMode", false);


@Test @Test
public void testFileModeMergeWithDirtyWorkTree() throws Exception { public void testFileModeMergeWithDirtyWorkTree() throws Exception {
if (!FS.DETECTED.supportsExecute())
return;
// Only Java6 (or set x bit in index) // Only Java6 (or set x bit in index)
assumeTrue(FS.DETECTED.supportsExecute());


try (Git git = new Git(db)) { try (Git git = new Git(db)) {
writeTrashFile("mergeableButDirty", "a"); writeTrashFile("mergeableButDirty", "a");

Loading…
Cancel
Save