Class CLIRepositoryTestCase
java.lang.Object
org.eclipse.jgit.junit.LocalDiskRepositoryTestCase
org.eclipse.jgit.lib.CLIRepositoryTestCase
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RepositoryTest repository, initialized for this test case.Fields inherited from class LocalDiskRepositoryTestCase
ASSUME_UNCHANGED, author, committer, CONTENT, CONTENT_ID, LENGTH, mockSystemReader, MOD_TIME, SMUDGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertArrayOfLinesEquals(String[] expected, String[] actual) protected voidassertStringArrayEquals(String expected, String[] actual) protected Stringstatic booleanprotected voiddeleteTrashFile(String name) protected StringescapeJava(String line) protected String[]Executes specified git commands (with arguments), throws exception and stops execution on first command which output contains a 'fatal:' errorprotected 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 StringRead a file's contentvoidsetUp()Setup testprotected StringshellQuote(File f) protected StringshellQuote(String s) static Stringstatic Stringprotected Pathprotected FilewriteTrashFile(String name, String data) Methods inherited from class LocalDiskRepositoryTestCase
addRepoToClose, createBareRepository, createRepository, createRepository, createTempDirectory, createTempFile, createUniqueTestGitDir, createWorkRepository, getCeilings, getTemporaryDirectory, indexState, recursiveDelete, runHook, tearDown, tick, write, write
-
Field Details
-
db
Test repository, initialized for this test case.
-
-
Constructor Details
-
CLIRepositoryTestCase
public CLIRepositoryTestCase()
-
-
Method Details
-
setUp
Description copied from class:LocalDiskRepositoryTestCaseSetup test- Overrides:
setUpin classLocalDiskRepositoryTestCase- Throws:
Exception
-
executeUnchecked
-
execute
Executes specified git commands (with arguments), throws exception and stops execution on first command which output contains a 'fatal:' error- Parameters:
cmds- each string argument must be a valid git command line, e.g. "git branch -h"- Returns:
- command output
- Throws:
Exception
-
writeLink
-
writeTrashFile
- Throws:
IOException
-
read
Description copied from class:LocalDiskRepositoryTestCaseRead a file's content- Overrides:
readin classLocalDiskRepositoryTestCase- Parameters:
file- the file- Returns:
- the content of the file
- Throws:
IOException
-
deleteTrashFile
- Throws:
IOException
-
executeAndPrint
Execute the given commands and print the output to stdout. Use this function instead of the normalexecute(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.- Parameters:
cmds- The commands to execute- Returns:
- the result of the command, see
execute(String...) - Throws:
Exception
-
executeAndPrintTestCode
Execute the given commands and print test code comparing expected and actual output. Use this function instead of the normalexecute(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.- Parameters:
cmds- The commands to execute- Returns:
- the result of the command, see
execute(String...) - Throws:
Exception
-
cmdString
-
escapeJava
-
shellQuote
-
shellQuote
-
assertStringArrayEquals
-
assertArrayOfLinesEquals
-
toString
-
toString
-
contains
-