Skip to content

Commit

Permalink
temp dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr committed Nov 25, 2024
1 parent f56108c commit 63118b1
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ static void setUp() {
}

@Test
final void exportForNoEntriesWritesNothing(@TempDir Path tempFile) throws Exception {
Path file = tempFile.resolve("ThisIsARandomlyNamedFile");
final void exportForNoEntriesWritesNothing(@TempDir Path tempDir) throws Exception {
Path file = tempDir.resolve("ThisIsARandomlyNamedFile");
Files.createFile(file);
htmlWebsiteExporter.export(databaseContext, tempFile, Collections.emptyList());
htmlWebsiteExporter.export(databaseContext, tempDir, Collections.emptyList());
assertEquals(Collections.emptyList(), Files.readAllLines(file));
}

@Test
final void exportsCorrectContentArticle(@TempDir Path tempFile) throws Exception {
final void exportsCorrectContentArticle(@TempDir Path tempDir) throws Exception {
BibEntry entry = new BibEntry(StandardEntryType.Article)
.withCitationKey("test")
.withField(StandardField.AUTHOR, "Test Author")
Expand All @@ -61,7 +61,7 @@ final void exportsCorrectContentArticle(@TempDir Path tempFile) throws Exception
.withField(StandardField.PUBLISHER, "THE PRESS")
.withField(StandardField.YEAR, "2020");

Path file = tempFile.resolve("RandomFileName");
Path file = tempDir.resolve("RandomFileName");
Files.createFile(file);
htmlWebsiteExporter.export(databaseContext, file, Collections.singletonList(entry));

Expand All @@ -72,7 +72,7 @@ final void exportsCorrectContentArticle(@TempDir Path tempFile) throws Exception
}

@Test
final void exportsCorrectContentInCollection(@TempDir Path tempFile) throws Exception {
final void exportsCorrectContentInCollection(@TempDir Path tempDir) throws Exception {
BibEntry entry = new BibEntry(StandardEntryType.InCollection)
.withCitationKey("test")
.withField(StandardField.AUTHOR, "Test Author")
Expand All @@ -81,7 +81,7 @@ final void exportsCorrectContentInCollection(@TempDir Path tempFile) throws Exce
.withField(StandardField.PUBLISHER, "PRESS")
.withField(StandardField.YEAR, "2020");

Path file = tempFile.resolve("RandomFileName");
Path file = tempDir.resolve("RandomFileName");
Files.createFile(file);
htmlWebsiteExporter.export(databaseContext, file, Collections.singletonList(entry));

Expand All @@ -92,7 +92,7 @@ final void exportsCorrectContentInCollection(@TempDir Path tempFile) throws Exce
}

@Test
final void exportsCorrectContentBook(@TempDir Path tempFile) throws Exception {
final void exportsCorrectContentBook(@TempDir Path tempDir) throws Exception {
BibEntry entry = new BibEntry(StandardEntryType.Book)
.withCitationKey("test")
.withField(StandardField.AUTHOR, "Test Author")
Expand All @@ -101,7 +101,7 @@ final void exportsCorrectContentBook(@TempDir Path tempFile) throws Exception {
.withField(StandardField.PUBLISHER, "PRESS")
.withField(StandardField.YEAR, "2020");

Path file = tempFile.resolve("RandomFileName");
Path file = tempDir.resolve("RandomFileName");
Files.createFile(file);
htmlWebsiteExporter.export(databaseContext, file, Collections.singletonList(entry));

Expand All @@ -112,7 +112,7 @@ final void exportsCorrectContentBook(@TempDir Path tempFile) throws Exception {
}

@Test
final void exportsCorrectContentInProceeedingsPublisher(@TempDir Path tempFile) throws Exception {
final void exportsCorrectContentInProceeedingsPublisher(@TempDir Path tempDir) throws Exception {
BibEntry entry = new BibEntry(StandardEntryType.InProceedings)
.withCitationKey("test")
.withField(StandardField.AUTHOR, "Test Author")
Expand All @@ -122,7 +122,7 @@ final void exportsCorrectContentInProceeedingsPublisher(@TempDir Path tempFile)
.withField(StandardField.SERIES, "CONF'20")
.withField(StandardField.YEAR, "2020");

Path file = tempFile.resolve("RandomFileName");
Path file = tempDir.resolve("RandomFileName");
Files.createFile(file);
htmlWebsiteExporter.export(databaseContext, file, Collections.singletonList(entry));

Expand All @@ -133,7 +133,7 @@ final void exportsCorrectContentInProceeedingsPublisher(@TempDir Path tempFile)
}

@Test
final void exportsCorrectContentInProceeedingsNoPublisher(@TempDir Path tempFile) throws Exception {
final void exportsCorrectContentInProceeedingsNoPublisher(@TempDir Path tempDir) throws Exception {
BibEntry entry = new BibEntry(StandardEntryType.InProceedings)
.withCitationKey("test")
.withField(StandardField.AUTHOR, "Test Author")
Expand All @@ -142,7 +142,7 @@ final void exportsCorrectContentInProceeedingsNoPublisher(@TempDir Path tempFile
.withField(StandardField.SERIES, "CONF'20")
.withField(StandardField.YEAR, "2020");

Path file = tempFile.resolve("RandomFileName");
Path file = tempDir.resolve("RandomFileName");
Files.createFile(file);
htmlWebsiteExporter.export(databaseContext, file, Collections.singletonList(entry));

Expand All @@ -153,15 +153,15 @@ final void exportsCorrectContentInProceeedingsNoPublisher(@TempDir Path tempFile
}

@Test
final void exportsCorrectContentInProceeedingsNoSeries(@TempDir Path tempFile) throws Exception {
final void exportsCorrectContentInProceeedingsNoSeries(@TempDir Path tempDir) throws Exception {
BibEntry entry = new BibEntry(StandardEntryType.InProceedings)
.withCitationKey("test")
.withField(StandardField.AUTHOR, "Test Author")
.withField(StandardField.TITLE, "Test Title")
.withField(StandardField.BOOKTITLE, "Test Conference")
.withField(StandardField.YEAR, "2020");

Path file = tempFile.resolve("RandomFileName");
Path file = tempDir.resolve("RandomFileName");
Files.createFile(file);
htmlWebsiteExporter.export(databaseContext, file, Collections.singletonList(entry));

Expand All @@ -172,15 +172,15 @@ final void exportsCorrectContentInProceeedingsNoSeries(@TempDir Path tempFile) t
}

@Test
final void exportsCorrectContentBracketsInTitle(@TempDir Path tempFile) throws Exception {
final void exportsCorrectContentBracketsInTitle(@TempDir Path tempDir) throws Exception {
BibEntry entry = new BibEntry(StandardEntryType.Article)
.withCitationKey("test")
.withField(StandardField.AUTHOR, "Test Author")
.withField(StandardField.TITLE, "This is {JabRef}")
.withField(StandardField.JOURNAL, "Journal of this \\& that")
.withField(StandardField.YEAR, "2020");

Path file = tempFile.resolve("RandomFileName");
Path file = tempDir.resolve("RandomFileName");
Files.createFile(file);
htmlWebsiteExporter.export(databaseContext, file, Collections.singletonList(entry));

Expand Down

0 comments on commit 63118b1

Please sign in to comment.