@ -44,7 +44,6 @@ package org.eclipse.jgit.api;
import static org.junit.Assert.assertEquals ;
import static org.junit.Assert.assertEquals ;
import static org.junit.Assert.assertNotNull ;
import static org.junit.Assert.assertNotNull ;
import static org.junit.Assert.fail ;
import java.io.File ;
import java.io.File ;
import java.util.Collection ;
import java.util.Collection ;
@ -79,13 +78,11 @@ public class LsRemoteCommandTest extends RepositoryTestCase {
}
}
@Test
@Test
public void testLsRemote ( ) {
public void testLsRemote ( ) throws Exception {
try {
File directory = createTempDirectory ( "testRepository" ) ;
File directory = createTempDirectory ( "testRepository" ) ;
CloneCommand command = Git . cloneRepository ( ) ;
CloneCommand command = Git . cloneRepository ( ) ;
command . setDirectory ( directory ) ;
command . setDirectory ( directory ) ;
command . setURI ( "file://"
command . setURI ( "file://" + git . getRepository ( ) . getWorkTree ( ) . getPath ( ) ) ;
+ git . getRepository ( ) . getWorkTree ( ) . getPath ( ) ) ;
command . setCloneAllBranches ( true ) ;
command . setCloneAllBranches ( true ) ;
Git git2 = command . call ( ) ;
Git git2 = command . call ( ) ;
addRepoToClose ( git2 . getRepository ( ) ) ;
addRepoToClose ( git2 . getRepository ( ) ) ;
@ -95,19 +92,14 @@ public class LsRemoteCommandTest extends RepositoryTestCase {
Collection < Ref > refs = lsRemoteCommand . call ( ) ;
Collection < Ref > refs = lsRemoteCommand . call ( ) ;
assertNotNull ( refs ) ;
assertNotNull ( refs ) ;
assertEquals ( 6 , refs . size ( ) ) ;
assertEquals ( 6 , refs . size ( ) ) ;
} catch ( Exception e ) {
fail ( e . getMessage ( ) ) ;
}
}
}
@Test
@Test
public void testLsRemoteWithTags ( ) {
public void testLsRemoteWithTags ( ) throws Exception {
try {
File directory = createTempDirectory ( "testRepository" ) ;
File directory = createTempDirectory ( "testRepository" ) ;
CloneCommand command = Git . cloneRepository ( ) ;
CloneCommand command = Git . cloneRepository ( ) ;
command . setDirectory ( directory ) ;
command . setDirectory ( directory ) ;
command . setURI ( "file://"
command . setURI ( "file://" + git . getRepository ( ) . getWorkTree ( ) . getPath ( ) ) ;
+ git . getRepository ( ) . getWorkTree ( ) . getPath ( ) ) ;
command . setCloneAllBranches ( true ) ;
command . setCloneAllBranches ( true ) ;
Git git2 = command . call ( ) ;
Git git2 = command . call ( ) ;
addRepoToClose ( git2 . getRepository ( ) ) ;
addRepoToClose ( git2 . getRepository ( ) ) ;
@ -117,19 +109,14 @@ public class LsRemoteCommandTest extends RepositoryTestCase {
Collection < Ref > refs = lsRemoteCommand . call ( ) ;
Collection < Ref > refs = lsRemoteCommand . call ( ) ;
assertNotNull ( refs ) ;
assertNotNull ( refs ) ;
assertEquals ( 3 , refs . size ( ) ) ;
assertEquals ( 3 , refs . size ( ) ) ;
} catch ( Exception e ) {
fail ( e . getMessage ( ) ) ;
}
}
}
@Test
@Test
public void testLsRemoteWithHeads ( ) {
public void testLsRemoteWithHeads ( ) throws Exception {
try {
File directory = createTempDirectory ( "testRepository" ) ;
File directory = createTempDirectory ( "testRepository" ) ;
CloneCommand command = Git . cloneRepository ( ) ;
CloneCommand command = Git . cloneRepository ( ) ;
command . setDirectory ( directory ) ;
command . setDirectory ( directory ) ;
command . setURI ( "file://"
command . setURI ( "file://" + git . getRepository ( ) . getWorkTree ( ) . getPath ( ) ) ;
+ git . getRepository ( ) . getWorkTree ( ) . getPath ( ) ) ;
command . setCloneAllBranches ( true ) ;
command . setCloneAllBranches ( true ) ;
Git git2 = command . call ( ) ;
Git git2 = command . call ( ) ;
addRepoToClose ( git2 . getRepository ( ) ) ;
addRepoToClose ( git2 . getRepository ( ) ) ;
@ -139,9 +126,6 @@ public class LsRemoteCommandTest extends RepositoryTestCase {
Collection < Ref > refs = lsRemoteCommand . call ( ) ;
Collection < Ref > refs = lsRemoteCommand . call ( ) ;
assertNotNull ( refs ) ;
assertNotNull ( refs ) ;
assertEquals ( 2 , refs . size ( ) ) ;
assertEquals ( 2 , refs . size ( ) ) ;
} catch ( Exception e ) {
fail ( e . getMessage ( ) ) ;
}
}
}
}
}