Fix some tests in ConfigTest

Some of the ConfigTest tests created a FileRepositoryBuilder but didn't
use it to actually create a FileRepository.

Change-Id: I1a4b27891daee1b235a71e7bbf2a7588b9d11a53
This commit is contained in:
Matthias Sohn 2023-08-29 21:26:34 +02:00
parent a2f326b762
commit e29834a77d
1 changed files with 12 additions and 4 deletions

View File

@ -1482,7 +1482,9 @@ public void testCommitTemplateConfig()
File workTree = tmp.newFolder("dummy-worktree");
File tempFile = tmp.newFile("testCommitTemplate-");
Repository repo = FileRepositoryBuilder.create(workTree);
Repository repo = FileRepositoryBuilder
.create(new File(workTree, ".git"));
repo.create();
String templateContent = "content of the template";
JGitTestUtil.write(tempFile, templateContent);
String expectedTemplatePath = tempFile.getPath();
@ -1532,7 +1534,9 @@ public void testCommitTemplateEncoding()
throws ConfigInvalidException, IOException {
Config config = new Config(null);
File workTree = tmp.newFolder("dummy-worktree");
Repository repo = FileRepositoryBuilder.create(workTree);
Repository repo = FileRepositoryBuilder
.create(new File(workTree, ".git"));
repo.create();
File tempFile = tmp.newFile("testCommitTemplate-");
String templateContent = "content of the template";
JGitTestUtil.write(tempFile, templateContent);
@ -1554,7 +1558,9 @@ public void testCommitTemplateWithInvalidEncoding()
Config config = new Config(null);
File workTree = tmp.newFolder("dummy-worktree");
File tempFile = tmp.newFile("testCommitTemplate-");
Repository repo = FileRepositoryBuilder.create(workTree);
Repository repo = FileRepositoryBuilder
.create(new File(workTree, ".git"));
repo.create();
String templateContent = "content of the template";
JGitTestUtil.write(tempFile, templateContent);
config = parse("[i18n]\n\tcommitEncoding = invalidEcoding\n"
@ -1569,7 +1575,9 @@ public void testCommitTemplateWithInvalidPath()
Config config = new Config(null);
File workTree = tmp.newFolder("dummy-worktree");
File tempFile = tmp.newFile("testCommitTemplate-");
Repository repo = FileRepositoryBuilder.create(workTree);
Repository repo = FileRepositoryBuilder
.create(new File(workTree, ".git"));
repo.create();
String templateContent = "content of the template";
JGitTestUtil.write(tempFile, templateContent);
// commit message encoding