Search in sources :

Example 21 with LayoutFormatter

use of org.jabref.logic.layout.LayoutFormatter in project jabref by JabRef.

the class AuthorLastFirstOxfordCommasTest method testFormat.

/**
     * Test method for {@link org.jabref.logic.layout.format.AuthorLastFirstOxfordCommas#format(java.lang.String)}.
     */
@Test
public void testFormat() {
    LayoutFormatter a = new AuthorLastFirstOxfordCommas();
    // Empty case
    Assert.assertEquals("", a.format(""));
    // Single Names
    Assert.assertEquals("Someone, Van Something", a.format("Van Something Someone"));
    // Two names
    Assert.assertEquals("von Neumann, John and Black Brown, Peter", a.format("John von Neumann and Black Brown, Peter"));
    // Three names
    Assert.assertEquals("von Neumann, John, Smith, John, and Black Brown, Peter", a.format("von Neumann, John and Smith, John and Black Brown, Peter"));
    Assert.assertEquals("von Neumann, John, Smith, John, and Black Brown, Peter", 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 22 with LayoutFormatter

use of org.jabref.logic.layout.LayoutFormatter in project jabref by JabRef.

the class AuthorLastFirstTest method testFormat.

@Test
public void testFormat() {
    LayoutFormatter a = new AuthorLastFirst();
    // Empty case
    Assert.assertEquals("", a.format(""));
    // Single Names
    Assert.assertEquals("Someone, Van Something", a.format("Van Something Someone"));
    // Two names
    Assert.assertEquals("von Neumann, John and Black Brown, Peter", a.format("John von Neumann and Black Brown, Peter"));
    // Three names
    Assert.assertEquals("von Neumann, John and Smith, John and Black Brown, Peter", a.format("von Neumann, John and Smith, John and Black Brown, Peter"));
    Assert.assertEquals("von Neumann, John and Smith, John and Black Brown, Peter", 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 23 with LayoutFormatter

use of org.jabref.logic.layout.LayoutFormatter in project jabref by JabRef.

the class AuthorOrgSciTest method testOrgSciPlusAbbreviation.

@Test
public void testOrgSciPlusAbbreviation() {
    LayoutFormatter f = new CompositeFormat(new AuthorOrgSci(), new NoSpaceBetweenAbbreviations());
    Assert.assertEquals("Flynn, J., S. Gartska", f.format("John Flynn and Sabine Gartska"));
    Assert.assertEquals("Garvin, D.A.", f.format("David A. Garvin"));
    Assert.assertEquals("Makridakis, S., S.C. Wheelwright, V.E. McGee", f.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea McGee"));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 24 with LayoutFormatter

use of org.jabref.logic.layout.LayoutFormatter in project jabref by JabRef.

the class AuthorOrgSciTest method testOrgSci.

@Test
public void testOrgSci() {
    LayoutFormatter f = new AuthorOrgSci();
    Assert.assertEquals("Flynn, J., S. Gartska", f.format("John Flynn and Sabine Gartska"));
    Assert.assertEquals("Garvin, D. A.", f.format("David A. Garvin"));
    Assert.assertEquals("Makridakis, S., S. C. Wheelwright, V. E. McGee", f.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea McGee"));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 25 with LayoutFormatter

use of org.jabref.logic.layout.LayoutFormatter in project jabref by JabRef.

the class AuthorFirstLastOxfordCommasTest method testFormat.

/**
     * Test method for {@link org.jabref.logic.layout.format.AuthorFirstLastOxfordCommas#format(java.lang.String)}.
     */
@Test
public void testFormat() {
    LayoutFormatter a = new AuthorFirstLastOxfordCommas();
    // 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)

Aggregations

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