Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #191 #197

Merged
merged 40 commits into from
Jun 28, 2023
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5398859
fix #191
nck-mlcnv Apr 8, 2023
58d71bb
simple fix for countLines method
nck-mlcnv Apr 8, 2023
23470d2
Merge branch 'develop' into fix/issue-191/readline-with-different-lin…
nck-mlcnv Apr 11, 2023
6798f8f
add IndexedLineReader with tests
nck-mlcnv Apr 12, 2023
6b8add0
change the IndexedLineReader to comply with current indexing implemen…
nck-mlcnv Apr 14, 2023
ae4bae6
update FileUtils
nck-mlcnv Apr 14, 2023
8bec05d
change getLineEnding method in FileUtils class
nck-mlcnv Apr 18, 2023
78ebd18
refactor IndexedLineReader
nck-mlcnv Apr 18, 2023
5848fe2
restructure FileUtilsTest
nck-mlcnv Apr 18, 2023
ebd623b
fix javadoc
nck-mlcnv Apr 18, 2023
343becc
fix javadoc again
nck-mlcnv Apr 21, 2023
5b52ab2
correct try-resource-blocks
nck-mlcnv Apr 21, 2023
b0ab294
add a test for IndexedLineReader
nck-mlcnv Apr 21, 2023
0077efb
correct try-resource-block for streams too
nck-mlcnv Apr 21, 2023
70a172e
make countLines method skip lines that only contain whitespace charac…
nck-mlcnv May 15, 2023
4398bdc
add docs for constructor of FileSeparatorQuerySource
nck-mlcnv May 15, 2023
41cf274
rename IndexedLineReader to IndexedQueryReader
nck-mlcnv May 17, 2023
1d8fbf6
change try-with-resource instructions
nck-mlcnv May 17, 2023
bd76573
refactor indexing
nck-mlcnv May 25, 2023
5ae9166
fix unit tests
nck-mlcnv May 25, 2023
23eb002
fix size method
nck-mlcnv May 25, 2023
7fed3c9
refactor default separator in FileSeparatorQuerySource
nck-mlcnv May 25, 2023
adc47b4
fix more tests
nck-mlcnv May 26, 2023
065e8fe
fix documentation
nck-mlcnv May 26, 2023
1157ce0
update constructor and readQuery
nck-mlcnv May 26, 2023
74cb9ff
remove unused methods and other minor changes
nck-mlcnv Jun 15, 2023
4de0a20
fix indexFile method and add more test cases
nck-mlcnv Jun 17, 2023
b7b6396
Fix/issue 191/rework parsing (#211)
bigerl Jun 21, 2023
8e1a35d
small change to test
nck-mlcnv Jun 23, 2023
1a86dcf
update documentation
nck-mlcnv Jun 23, 2023
5783fd5
fix QueryHandlerTest
nck-mlcnv Jun 23, 2023
90404f9
Merge branch 'develop' into fix/issue-191/readline-with-different-lin…
nck-mlcnv Jun 23, 2023
41002ac
adjust expected test results to new behaviour of the IndexedQueryReader
nck-mlcnv Jun 26, 2023
2191621
add tests for getLineEnding
nck-mlcnv Jun 26, 2023
cb57354
fix test
nck-mlcnv Jun 26, 2023
e82c165
fix test cases
nck-mlcnv Jun 26, 2023
eb88285
Refactor FileUtilsTest to use temporary files
bigerl Jun 28, 2023
18f7d33
Ensure temporary test files are deleted
bigerl Jun 28, 2023
ff7bbc0
Update FileUtilsTest to use temp file
bigerl Jun 28, 2023
b41fbd2
Refactor FileUtilsTest for safer and more dynamic test data
bigerl Jun 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update FileUtilsTest to use temp file
Changed the "readTest" method in FileUtilsTest.java to use a temporary file, instead of a static file, to improve test isolation and avoid possible interference between tests.
  • Loading branch information
bigerl committed Jun 28, 2023
commit ff7bbc061d4c7bb395344a731786c308851c3bea
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.UUID;

import static java.nio.file.Files.createTempFile;
import static org.apache.commons.io.FileUtils.writeStringToFile;
Expand Down Expand Up @@ -148,10 +149,16 @@ public void getHashTest(){
public static class NonParameterizedTest {
@Test
public void readTest() throws IOException {

Path file = createTempFile("readTest", ".txt");
file.toFile().deleteOnExit();
String expectedString = UUID.randomUUID() + "\n\t\r" + UUID.randomUUID() + "\n";
writeStringToFile(file.toFile(), expectedString, StandardCharsets.UTF_8);

//read whole content
String data = FileUtils.readFile("src/test/resources/fileUtils.txt");
String expected = "a\nab\nabc\n\n\n\n\n\n\n\n\\n\n\n\n\n\ndfe\n\ntest";
assertEquals(expected, data);
String actualString = FileUtils.readFile(file.toString());

assertEquals(expectedString, actualString);
}
}
}