mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 21:45:43 +01:00
fix unit tests for git commands
This commit is contained in:
@@ -37,11 +37,14 @@ import org.junit.Test;
|
||||
|
||||
import sonia.scm.repository.BrowserResult;
|
||||
import sonia.scm.repository.FileObject;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -54,9 +57,12 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testBrowse()
|
||||
public void testBrowse() throws IOException, RepositoryException
|
||||
{
|
||||
BrowserResult result = new GitBrowseCommand(
|
||||
repository,
|
||||
@@ -98,21 +104,23 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
|
||||
assertEquals("c", c.getName());
|
||||
assertEquals("c", c.getPath());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testBrowseSubDirectory()
|
||||
public void testBrowseSubDirectory() throws IOException, RepositoryException
|
||||
{
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setPath("c");
|
||||
|
||||
BrowserResult result = new GitBrowseCommand(
|
||||
repository,
|
||||
repositoryDirectory).getBrowserResult(
|
||||
request);
|
||||
|
||||
BrowserResult result = new GitBrowseCommand(repository,
|
||||
repositoryDirectory).getBrowserResult(request);
|
||||
|
||||
assertNotNull(result);
|
||||
|
||||
@@ -134,7 +142,7 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
|
||||
else if ("e.txt".equals(f.getName()))
|
||||
{
|
||||
e = f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assertNotNull(d);
|
||||
@@ -144,7 +152,6 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
|
||||
assertEquals("added file d and e in folder c", d.getDescription());
|
||||
assertTrue(d.getLength() > 0);
|
||||
checkDate(d.getLastModified());
|
||||
|
||||
assertNotNull(e);
|
||||
assertFalse(e.isDirectory());
|
||||
assertEquals("e.txt", e.getName());
|
||||
@@ -153,5 +160,4 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
|
||||
assertTrue(e.getLength() > 0);
|
||||
checkDate(e.getLastModified());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,11 +35,14 @@ package sonia.scm.repository.spi;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* TODO add not found test
|
||||
@@ -52,9 +55,12 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testCat()
|
||||
public void testCat() throws IOException, RepositoryException
|
||||
{
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
@@ -66,9 +72,12 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testSimpleCat()
|
||||
public void testSimpleCat() throws IOException, RepositoryException
|
||||
{
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
@@ -83,8 +92,12 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
private String execute(CatCommandRequest request)
|
||||
throws IOException, RepositoryException
|
||||
{
|
||||
String content = null;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
@@ -43,6 +43,10 @@ import static org.hamcrest.Matchers.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -53,9 +57,11 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAll()
|
||||
public void testGetAll() throws IOException
|
||||
{
|
||||
ChangesetPagingResult result = new GitLogCommand(
|
||||
repository,
|
||||
@@ -70,9 +76,11 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllByPath()
|
||||
public void testGetAllByPath() throws IOException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -92,9 +100,11 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllWithLimit()
|
||||
public void testGetAllWithLimit() throws IOException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -149,9 +159,11 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void testGetRange()
|
||||
public void testGetRange() throws IOException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user