Skip to content

Commit

Permalink
add test to check that java.io.File name is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers authored and poikilotherm committed Sep 19, 2022
1 parent cb299d1 commit 8478815
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/java/edu/harvard/iq/dataverse/util/FileUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,18 @@ public void testDetermineFileTypeByExtension() {
fail("File does not exist: " + file.toPath().toString());
}
}

@Test
public void testDetermineFileTypeFromName() {
//Verify that name of the local file isn't used in determining the type (as we often use *.tmp when the real name has a different extension)
try {
File file = File.createTempFile("empty", "png");
assertEquals("text/plain", FileUtil.determineFileType(file, "something.txt"));
} catch (IOException ex) {
Logger.getLogger(FileUtilTest.class.getName()).log(Level.SEVERE, null, ex);
}

}

@Test
public void testDetermineFileTypeByName() {
Expand Down

0 comments on commit 8478815

Please sign in to comment.