Search in sources :

Example 1 with ProtectedTermsPreferences

use of org.jabref.logic.protectedterms.ProtectedTermsPreferences in project jabref by JabRef.

the class ProtectTermsFormatterTest method setUp.

@Before
public void setUp() {
    ProtectTermsFormatter.setProtectedTermsLoader(new ProtectedTermsLoader(new ProtectedTermsPreferences(ProtectedTermsLoader.getInternalLists(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList())));
    formatter = new ProtectTermsFormatter();
}
Also used : ProtectedTermsLoader(org.jabref.logic.protectedterms.ProtectedTermsLoader) ProtectedTermsPreferences(org.jabref.logic.protectedterms.ProtectedTermsPreferences) Before(org.junit.Before)

Example 2 with ProtectedTermsPreferences

use of org.jabref.logic.protectedterms.ProtectedTermsPreferences in project jabref by JabRef.

the class CleanupWorkerTest method cleanupCasesAddsBracketAroundAluminiumGalliumArsenid.

@Test
public void cleanupCasesAddsBracketAroundAluminiumGalliumArsenid() {
    ProtectedTermsLoader protectedTermsLoader = new ProtectedTermsLoader(new ProtectedTermsPreferences(ProtectedTermsLoader.getInternalLists(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList()));
    Assert.assertNotEquals(Collections.emptyList(), protectedTermsLoader.getProtectedTerms());
    CleanupPreset preset = new CleanupPreset(new FieldFormatterCleanups(true, Collections.singletonList(new FieldFormatterCleanup("title", new ProtectTermsFormatter(protectedTermsLoader)))));
    BibEntry entry = new BibEntry();
    entry.setField("title", "AlGaAs");
    worker.cleanup(preset, entry);
    Assert.assertEquals(Optional.of("{AlGaAs}"), entry.getField("title"));
}
Also used : ProtectedTermsLoader(org.jabref.logic.protectedterms.ProtectedTermsLoader) BibEntry(org.jabref.model.entry.BibEntry) ProtectTermsFormatter(org.jabref.logic.formatter.casechanger.ProtectTermsFormatter) ProtectedTermsPreferences(org.jabref.logic.protectedterms.ProtectedTermsPreferences) FieldFormatterCleanups(org.jabref.model.cleanup.FieldFormatterCleanups) FieldFormatterCleanup(org.jabref.model.cleanup.FieldFormatterCleanup) Test(org.junit.Test)

Aggregations

ProtectedTermsLoader (org.jabref.logic.protectedterms.ProtectedTermsLoader)2 ProtectedTermsPreferences (org.jabref.logic.protectedterms.ProtectedTermsPreferences)2 ProtectTermsFormatter (org.jabref.logic.formatter.casechanger.ProtectTermsFormatter)1 FieldFormatterCleanup (org.jabref.model.cleanup.FieldFormatterCleanup)1 FieldFormatterCleanups (org.jabref.model.cleanup.FieldFormatterCleanups)1 BibEntry (org.jabref.model.entry.BibEntry)1 Before (org.junit.Before)1 Test (org.junit.Test)1