Search in sources :

Example 31 with LayoutFormatter

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"));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 32 with LayoutFormatter

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"));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 33 with LayoutFormatter

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"));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Aggregations

LayoutFormatter (org.jabref.logic.layout.LayoutFormatter)33 Test (org.junit.Test)33