Search in sources :

Example 1 with ProtectTermsFormatter

use of org.jabref.logic.formatter.casechanger.ProtectTermsFormatter 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

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