Skip to content

Commit

Permalink
TIKA-4326: replace deprecated; refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
THausherr committed Jan 14, 2025
1 parent 3f80a05 commit 9e9c10f
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testSimpleWord() throws Exception {

Reader reader = new InputStreamReader((InputStream) response.getEntity(), UTF_8);

CSVParser csvReader = new CSVParser(reader, CSVFormat.EXCEL);
CSVParser csvReader = CSVParser.builder().setReader(reader).setFormat(CSVFormat.EXCEL).get();

Map<String, String> metadata = new HashMap<>();

Expand Down Expand Up @@ -129,15 +129,13 @@ public void testPasswordProtected() throws Exception {
assertEquals(200, response.getStatus());

// Check results
Reader reader = new InputStreamReader((InputStream) response.getEntity(), UTF_8);
CSVParser csvReader = new CSVParser(reader, CSVFormat.EXCEL);

Map<String, String> metadata = new HashMap<>();

for (CSVRecord r : csvReader) {
metadata.put(r.get(0), r.get(1));
try (Reader reader = new InputStreamReader((InputStream) response.getEntity(), UTF_8);
CSVParser csvReader = CSVParser.builder().setReader(reader).setFormat(CSVFormat.EXCEL).get()) {
for (CSVRecord r : csvReader) {
metadata.put(r.get(0), r.get(1));
}
}
csvReader.close();

assertNotNull(metadata.get(TikaCoreProperties.CREATOR.getName()));
assertEquals("pavel", metadata.get(TikaCoreProperties.CREATOR.getName()));
Expand Down

0 comments on commit 9e9c10f

Please sign in to comment.