aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2011-11-05 16:52:24 +0100
committerRobin Rosenberg <robin.rosenberg@dewire.com>2011-11-06 10:00:06 +0100
commit790ddb2983bce01d2d0b5b1049d5576fa0c136a8 (patch)
treeb15de385044a2f9de8eff812f8b1d1653958b58d /org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java
parent00235c77d6e636aac5896f0b1e76b1e43e84410f (diff)
downloadjgit-790ddb2983bce01d2d0b5b1049d5576fa0c136a8.tar.gz
jgit-790ddb2983bce01d2d0b5b1049d5576fa0c136a8.zip
Don't throw away the stack trace when tests fail
Most unexpected exceptions are completely useless yielding message like "null" or "3" or in the best cases something reasonable, but still out of context. Just declare the test as throwing an exception. That will retain the full stack trace leading to the point of failure without using a debugger or changing the code. Change-Id: Id2454d328d1aa665606ae002de2c3805fe7baa8e
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java100
1 files changed, 42 insertions, 58 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java
index 7d3a55e2af..ac563b0618 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java
@@ -44,7 +44,6 @@ package org.eclipse.jgit.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
import java.io.File;
import java.util.Collection;
@@ -79,69 +78,54 @@ public class LsRemoteCommandTest extends RepositoryTestCase {
}
@Test
- public void testLsRemote() {
- try {
- File directory = createTempDirectory("testRepository");
- CloneCommand command = Git.cloneRepository();
- command.setDirectory(directory);
- command.setURI("file://"
- + git.getRepository().getWorkTree().getPath());
- command.setCloneAllBranches(true);
- Git git2 = command.call();
- addRepoToClose(git2.getRepository());
-
-
- LsRemoteCommand lsRemoteCommand = git2.lsRemote();
- Collection<Ref> refs = lsRemoteCommand.call();
- assertNotNull(refs);
- assertEquals(6, refs.size());
- } catch (Exception e) {
- fail(e.getMessage());
- }
+ public void testLsRemote() throws Exception {
+ File directory = createTempDirectory("testRepository");
+ CloneCommand command = Git.cloneRepository();
+ command.setDirectory(directory);
+ command.setURI("file://" + git.getRepository().getWorkTree().getPath());
+ command.setCloneAllBranches(true);
+ Git git2 = command.call();
+ addRepoToClose(git2.getRepository());
+
+
+ LsRemoteCommand lsRemoteCommand = git2.lsRemote();
+ Collection<Ref> refs = lsRemoteCommand.call();
+ assertNotNull(refs);
+ assertEquals(6, refs.size());
}
@Test
- public void testLsRemoteWithTags() {
- try {
- File directory = createTempDirectory("testRepository");
- CloneCommand command = Git.cloneRepository();
- command.setDirectory(directory);
- command.setURI("file://"
- + git.getRepository().getWorkTree().getPath());
- command.setCloneAllBranches(true);
- Git git2 = command.call();
- addRepoToClose(git2.getRepository());
-
- LsRemoteCommand lsRemoteCommand = git2.lsRemote();
- lsRemoteCommand.setTags(true);
- Collection<Ref> refs = lsRemoteCommand.call();
- assertNotNull(refs);
- assertEquals(3, refs.size());
- } catch (Exception e) {
- fail(e.getMessage());
- }
+ public void testLsRemoteWithTags() throws Exception {
+ File directory = createTempDirectory("testRepository");
+ CloneCommand command = Git.cloneRepository();
+ command.setDirectory(directory);
+ command.setURI("file://" + git.getRepository().getWorkTree().getPath());
+ command.setCloneAllBranches(true);
+ Git git2 = command.call();
+ addRepoToClose(git2.getRepository());
+
+ LsRemoteCommand lsRemoteCommand = git2.lsRemote();
+ lsRemoteCommand.setTags(true);
+ Collection<Ref> refs = lsRemoteCommand.call();
+ assertNotNull(refs);
+ assertEquals(3, refs.size());
}
@Test
- public void testLsRemoteWithHeads() {
- try {
- File directory = createTempDirectory("testRepository");
- CloneCommand command = Git.cloneRepository();
- command.setDirectory(directory);
- command.setURI("file://"
- + git.getRepository().getWorkTree().getPath());
- command.setCloneAllBranches(true);
- Git git2 = command.call();
- addRepoToClose(git2.getRepository());
-
- LsRemoteCommand lsRemoteCommand = git2.lsRemote();
- lsRemoteCommand.setHeads(true);
- Collection<Ref> refs = lsRemoteCommand.call();
- assertNotNull(refs);
- assertEquals(2, refs.size());
- } catch (Exception e) {
- fail(e.getMessage());
- }
+ public void testLsRemoteWithHeads() throws Exception {
+ File directory = createTempDirectory("testRepository");
+ CloneCommand command = Git.cloneRepository();
+ command.setDirectory(directory);
+ command.setURI("file://" + git.getRepository().getWorkTree().getPath());
+ command.setCloneAllBranches(true);
+ Git git2 = command.call();
+ addRepoToClose(git2.getRepository());
+
+ LsRemoteCommand lsRemoteCommand = git2.lsRemote();
+ lsRemoteCommand.setHeads(true);
+ Collection<Ref> refs = lsRemoteCommand.call();
+ assertNotNull(refs);
+ assertEquals(2, refs.size());
}
}