mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
improve exception handling
This commit is contained in:
@@ -38,6 +38,7 @@ import com.aragost.javahg.Changeset;
|
||||
import org.junit.Test;
|
||||
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -57,9 +58,11 @@ public class HgIncomingCommandTest extends IncomingOutgoingTestBase
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetIncomingChangesets() throws IOException
|
||||
public void testGetIncomingChangesets()
|
||||
throws IOException, RepositoryException
|
||||
{
|
||||
writeNewFile(outgoing, outgoingDirectory, "a.txt", "Content of file a.txt");
|
||||
writeNewFile(outgoing, outgoingDirectory, "b.txt", "Content of file b.txt");
|
||||
@@ -84,6 +87,56 @@ public class HgIncomingCommandTest extends IncomingOutgoingTestBase
|
||||
assertChangesetsEqual(c2, cpr.getChangesets().get(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetIncomingChangesetsWithEmptyRepository()
|
||||
throws RepositoryException
|
||||
{
|
||||
HgIncomingCommand cmd = createIncomingCommand();
|
||||
IncomingCommandRequest request = new IncomingCommandRequest();
|
||||
|
||||
request.setRemoteRepository(outgoingRepository);
|
||||
|
||||
ChangesetPagingResult cpr = cmd.getIncomingChangesets(request);
|
||||
|
||||
assertNotNull(cpr);
|
||||
assertEquals(0, cpr.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test(expected = RepositoryException.class)
|
||||
public void testGetIncomingChangesetsWithUnrelatedRepository()
|
||||
throws IOException, RepositoryException
|
||||
{
|
||||
writeNewFile(outgoing, outgoingDirectory, "a.txt", "Content of file a.txt");
|
||||
writeNewFile(outgoing, outgoingDirectory, "b.txt", "Content of file b.txt");
|
||||
|
||||
commit(outgoing, "added a and b");
|
||||
|
||||
writeNewFile(incoming, incomingDirectory, "c.txt", "Content of file c.txt");
|
||||
writeNewFile(incoming, incomingDirectory, "d.txt", "Content of file d.txt");
|
||||
|
||||
commit(incoming, "added c and d");
|
||||
|
||||
HgIncomingCommand cmd = createIncomingCommand();
|
||||
IncomingCommandRequest request = new IncomingCommandRequest();
|
||||
|
||||
request.setRemoteRepository(outgoingRepository);
|
||||
|
||||
cmd.getIncomingChangesets(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user