use of org.jabref.logic.layout.LayoutFormatter in project jabref by JabRef.
the class AuthorFirstLastCommasTest method testFormat.
/**
* Test method for {@link org.jabref.logic.layout.format.AuthorFirstLastCommas#format(java.lang.String)}.
*/
@Test
public void testFormat() {
LayoutFormatter a = new AuthorFirstLastCommas();
// Empty case
Assert.assertEquals("", a.format(""));
// Single Names
Assert.assertEquals("Van Something Someone", a.format("Someone, Van Something"));
// Two names
Assert.assertEquals("John von Neumann and Peter Black Brown", a.format("John von Neumann and Peter Black Brown"));
// Three names
Assert.assertEquals("John von Neumann, John Smith and Peter Black Brown", a.format("von Neumann, John and Smith, John and Black Brown, Peter"));
Assert.assertEquals("John von Neumann, John Smith and Peter Black Brown", a.format("John von Neumann and John Smith and Black Brown, Peter"));
}
use of org.jabref.logic.layout.LayoutFormatter in project jabref by JabRef.
the class CompositeFormatTest method testArrayComposite.
@Test
public void testArrayComposite() {
LayoutFormatter f = new CompositeFormat(new LayoutFormatter[] { fieldText -> fieldText + fieldText, fieldText -> "A" + fieldText, fieldText -> "B" + fieldText });
Assert.assertEquals("BAff", f.format("f"));
}
use of org.jabref.logic.layout.LayoutFormatter in project jabref by JabRef.
the class CompositeFormatTest method testEmptyComposite.
@Test
public void testEmptyComposite() {
LayoutFormatter f = new CompositeFormat();
Assert.assertEquals("No Change", f.format("No Change"));
}
Aggregations