-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/braincident/jabref into r…
…isimporter * 'master' of https://github.com/braincident/jabref: Update RisImporterTest.java Update RisImporterTest.java Create RisImporterTest.java Update CHANGELOG.md Update RisImporter.java Update EditAction.java Update CHANGELOG.md Update EditAction.java
- Loading branch information
Showing
3 changed files
with
60 additions
and
6 deletions.
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
51 changes: 51 additions & 0 deletions
51
src/test/java/org/jabref/logic/importer/RisImporterTest.java
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,51 @@ | ||
package org.jabref.logic.importer; | ||
|
||
import java.lang.reflect.Method; | ||
import java.util.HashMap; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
|
||
import org.jabref.logic.importer.fileformat.RisImporter; | ||
import org.jabref.model.entry.field.Field; | ||
import org.jabref.model.entry.field.StandardField; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
public class RisImporterTest { | ||
RisImporter ri = null; | ||
|
||
@BeforeEach | ||
public void setUp() throws Exception { | ||
ri = new RisImporter(); | ||
} | ||
|
||
@Test | ||
public void testAddDoi1() throws Exception { | ||
String testDoi = "10.1589/jpts.28.186"; | ||
String doi = testDoi.toLowerCase(Locale.ENGLISH); | ||
Map<Field, String> fields = new HashMap<>(); | ||
Method testAddDoiMethod = ri.getClass().getDeclaredMethod("addDoi", Map.class, String.class); | ||
testAddDoiMethod.setAccessible(true); | ||
|
||
testAddDoiMethod.invoke(ri, fields, doi); | ||
assertNotNull(fields.get(StandardField.DOI)); | ||
assertEquals("10.1589/jpts.28.186", fields.get(StandardField.DOI)); | ||
} | ||
|
||
@Test | ||
public void testAddDoi2() throws Exception { | ||
String testDoi = "doi:10.1589/jpts.28.186"; | ||
String doi = testDoi.toLowerCase(Locale.ENGLISH); | ||
Map<Field, String> fields = new HashMap<>(); | ||
Method testAddDoiMethod = ri.getClass().getDeclaredMethod("addDoi", Map.class, String.class); | ||
testAddDoiMethod.setAccessible(true); | ||
|
||
testAddDoiMethod.invoke(ri, fields, doi); | ||
assertNotNull(fields.get(StandardField.DOI)); | ||
assertEquals("10.1589/jpts.28.186", fields.get(StandardField.DOI)); | ||
} | ||
} |