Search in sources :

Example 26 with LayoutFormatter

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

the class AuthorLastFirstAbbrCommasTest method testFormat.

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

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

the class AuthorLastFirstAbbrOxfordCommasTest method testFormat.

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

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

the class FirstPageTest method testFormatNull.

@Test
public void testFormatNull() {
    LayoutFormatter a = new FirstPage();
    Assert.assertEquals("", a.format(null));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 29 with LayoutFormatter

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

the class AuthorFirstAbbrLastCommasTest method testFormat.

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

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

the class AuthorFirstAbbrLastOxfordCommasTest method testFormat.

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