public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase
| Modifier and Type | Field and Description |
|---|---|
protected 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(java.lang.String[] expected,
java.lang.String[] actual) |
protected void |
assertStringArrayEquals(java.lang.String expected,
java.lang.String[] actual) |
protected java.lang.String |
cmdString(java.lang.String... cmds) |
static boolean |
contains(java.util.List<java.lang.String> lines,
java.lang.String str) |
protected void |
deleteTrashFile(java.lang.String name) |
protected java.lang.String |
escapeJava(java.lang.String line) |
protected java.lang.String[] |
execute(java.lang.String... cmds)
Executes specified git commands (with arguments), throws exception and
stops execution on first command which output contains a 'fatal:' error
|
protected java.lang.String[] |
executeAndPrint(java.lang.String... cmds)
Execute the given commands and print the output to stdout.
|
protected java.lang.String[] |
executeAndPrintTestCode(java.lang.String... cmds)
Execute the given commands and print test code comparing expected and
actual output.
|
protected java.lang.String[] |
executeUnchecked(java.lang.String... cmds)
Executes specified git commands (with arguments)
|
protected java.lang.String |
read(java.io.File file)
Read a file's content
|
void |
setUp()
Setup test
|
static java.lang.String |
toString(java.util.List<java.lang.String> lines) |
static java.lang.String |
toString(java.lang.String... lines) |
protected java.nio.file.Path |
writeLink(java.lang.String link,
java.lang.String target) |
protected java.io.File |
writeTrashFile(java.lang.String name,
java.lang.String data) |
addRepoToClose, createBareRepository, createRepository, createTempDirectory, createTempFile, createUniqueTestGitDir, createWorkRepository, getCeilings, getTemporaryDirectory, indexState, recursiveDelete, runHook, tearDown, tick, write, writeprotected Repository db
public void setUp()
throws java.lang.Exception
LocalDiskRepositoryTestCasesetUp in class LocalDiskRepositoryTestCasejava.lang.Exceptionprotected java.lang.String[] executeUnchecked(java.lang.String... cmds)
throws java.lang.Exception
cmds - each string argument must be a valid git command line, e.g.
"git branch -h"java.lang.Exceptionprotected java.lang.String[] execute(java.lang.String... cmds)
throws java.lang.Exception
cmds - each string argument must be a valid git command line, e.g.
"git branch -h"java.lang.Exceptionprotected java.nio.file.Path writeLink(java.lang.String link,
java.lang.String target)
throws java.lang.Exception
link - the path of the symbolic link to createtarget - the target of the symbolic linkjava.lang.Exceptionprotected java.io.File writeTrashFile(java.lang.String name,
java.lang.String data)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String read(java.io.File file)
throws java.io.IOException
LocalDiskRepositoryTestCaseread in class LocalDiskRepositoryTestCasefile - the filejava.io.IOExceptionprotected void deleteTrashFile(java.lang.String name)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String[] executeAndPrint(java.lang.String... cmds)
throws java.lang.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...)java.lang.Exceptionprotected java.lang.String[] executeAndPrintTestCode(java.lang.String... cmds)
throws java.lang.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...)java.lang.Exceptionprotected java.lang.String cmdString(java.lang.String... cmds)
protected java.lang.String escapeJava(java.lang.String line)
protected void assertStringArrayEquals(java.lang.String expected,
java.lang.String[] actual)
protected void assertArrayOfLinesEquals(java.lang.String[] expected,
java.lang.String[] actual)
public static java.lang.String toString(java.lang.String... lines)
public static java.lang.String toString(java.util.List<java.lang.String> lines)
public static boolean contains(java.util.List<java.lang.String> lines,
java.lang.String str)