use of org.jabref.logic.formatter.casechanger.UpperCaseFormatter in project jabref by JabRef.
the class FieldFormatterCleanupTest method testInternalAllField.
@Test
public void testInternalAllField() throws Exception {
FieldFormatterCleanup cleanup = new FieldFormatterCleanup(FieldName.INTERNAL_ALL_FIELD, new UpperCaseFormatter());
cleanup.cleanup(entry);
Assert.assertEquals(fieldMap.get("title").toUpperCase(), entry.getField("title").get());
Assert.assertEquals(fieldMap.get("booktitle").toUpperCase(), entry.getField("booktitle").get());
Assert.assertEquals(fieldMap.get("year").toUpperCase(), entry.getField("year").get());
Assert.assertEquals(fieldMap.get("month").toUpperCase(), entry.getField("month").get());
Assert.assertEquals(fieldMap.get("abstract").toUpperCase(), entry.getField("abstract").get());
Assert.assertEquals(fieldMap.get("doi").toUpperCase(), entry.getField("doi").get());
Assert.assertEquals(fieldMap.get("issn").toUpperCase(), entry.getField("issn").get());
}
use of org.jabref.logic.formatter.casechanger.UpperCaseFormatter in project jabref by JabRef.
the class Formatters method getFormatterForModifier.
public static Optional<Formatter> getFormatterForModifier(String modifier) {
Objects.requireNonNull(modifier);
Optional<Formatter> formatter = ALL.stream().filter(f -> f.getKey().equals(modifier)).findAny();
if (formatter.isPresent()) {
return formatter;
}
switch(modifier) {
case "lower":
return Optional.of(new LowerCaseFormatter());
case "upper":
return Optional.of(new UpperCaseFormatter());
default:
return Optional.empty();
}
}
use of org.jabref.logic.formatter.casechanger.UpperCaseFormatter in project jabref by JabRef.
the class FieldFormatterCleanupTest method testInternalAllTextFieldsField.
@Test
public void testInternalAllTextFieldsField() throws Exception {
FieldFormatterCleanup cleanup = new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new UpperCaseFormatter());
cleanup.cleanup(entry);
Assert.assertEquals(fieldMap.get("title").toUpperCase(), entry.getField("title").get());
Assert.assertEquals(fieldMap.get("booktitle").toUpperCase(), entry.getField("booktitle").get());
Assert.assertEquals(fieldMap.get("year"), entry.getField("year").get());
Assert.assertEquals(fieldMap.get("month"), entry.getField("month").get());
Assert.assertEquals(fieldMap.get("abstract").toUpperCase(), entry.getField("abstract").get());
Assert.assertEquals(fieldMap.get("doi"), entry.getField("doi").get());
Assert.assertEquals(fieldMap.get("issn"), entry.getField("issn").get());
}
Aggregations