forked from JabRef/jabref
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not extract file ending from Urls (JabRef#4547)
* Fixes JabRef#4544 Do not extract file ending from Urls * Add tests * file type for any resource type * Keep simple file name extraction for files * checkstyle
- Loading branch information
1 parent
1ae85bc
commit 69da3aa
Showing
4 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.jabref.model.util; | ||
|
||
import java.util.Optional; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class FileHelperTest { | ||
@Test | ||
public void extractFileExtension() { | ||
final String filePath = FileHelperTest.class.getResource("pdffile.pdf").getPath(); | ||
assertEquals(Optional.of("pdf"), FileHelper.getFileExtension(filePath)); | ||
} | ||
|
||
@Test | ||
public void fileExtensionFromUrl() { | ||
final String filePath = "https://link.springer.com/content/pdf/10.1007%2Fs40955-018-0121-9.pdf"; | ||
assertEquals(Optional.of("pdf"), FileHelper.getFileExtension(filePath)); | ||
} | ||
} |
Binary file not shown.