public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase
Modifier and Type | Field and Description |
---|---|
protected org.eclipse.jgit.lib.Repository |
db
Test repository, initialized for this test case.
|
ASSUME_UNCHANGED, author, committer, CONTENT, CONTENT_ID, LENGTH, mockSystemReader, MOD_TIME, SMUDGE
Constructor and Description |
---|
CLIRepositoryTestCase() |
Modifier and Type | Method and Description |
---|---|
protected void |
assertArrayOfLinesEquals(String[] expected,
String[] actual) |
protected void |
assertStringArrayEquals(String expected,
String[] actual) |
protected String |
cmdString(String... cmds) |
static boolean |
contains(List<String> lines,
String str) |
protected void |
deleteTrashFile(String name) |
protected String |
escapeJava(String line) |
protected String[] |
execute(String... cmds)
Executes specified git commands (with arguments), throws exception and
stops execution on first command which output contains a 'fatal:' error
|
protected String[] |
executeAndPrint(String... cmds)
Execute the given commands and print the output to stdout.
|
protected String[] |
executeAndPrintTestCode(String... cmds)
Execute the given commands and print test code comparing expected and
actual output.
|
protected String[] |
executeUnchecked(String... cmds)
Executes specified git commands (with arguments)
|
protected String |
read(File file) |
void |
setUp() |
static String |
toString(List<String> lines) |
static String |
toString(String... lines) |
protected Path |
writeLink(String link,
String target) |
protected File |
writeTrashFile(String name,
String data) |
addRepoToClose, createBareRepository, createRepository, createRepository, createTempDirectory, createTempFile, createUniqueTestGitDir, createWorkRepository, getCeilings, getTemporaryDirectory, indexState, recursiveDelete, runHook, tearDown, tick, write, write
protected org.eclipse.jgit.lib.Repository db
public void setUp() throws Exception
setUp
in class LocalDiskRepositoryTestCase
Exception
protected String[] executeUnchecked(String... cmds) throws Exception
cmds
- each string argument must be a valid git command line, e.g.
"git branch -h"Exception
protected String[] execute(String... cmds) throws Exception
cmds
- each string argument must be a valid git command line, e.g.
"git branch -h"Exception
protected Path writeLink(String link, String target) throws Exception
link
- the path of the symbolic link to createtarget
- the target of the symbolic linkException
protected File writeTrashFile(String name, String data) throws IOException
IOException
protected String read(File file) throws IOException
read
in class LocalDiskRepositoryTestCase
IOException
protected void deleteTrashFile(String name) throws IOException
IOException
protected String[] executeAndPrint(String... cmds) throws Exception
execute(String...)
when preparing
a test case: the command is executed and then its output is printed on
stdout, thus making it easier to prepare the correct command and expected
output for the test case.cmds
- The commands to executeexecute(String...)
Exception
protected String[] executeAndPrintTestCode(String... cmds) throws Exception
execute(String...)
when preparing a test case: the command is
executed and test code is generated using the command output as a
template of what is expected. The code generated is printed on stdout and
can be pasted in the test case function.cmds
- The commands to executeexecute(String...)
Exception
protected void assertArrayOfLinesEquals(String[] expected, String[] actual)
Copyright © 2019 Eclipse JGit Project. All rights reserved.