Search in sources :

Example 11 with LayoutFormatter

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

the class AuthorAndsReplacerTest method testFormat.

/**
     * Test method for
     * {@link org.jabref.logic.layout.format.AuthorAndsReplacer#format(java.lang.String)}.
     */
@Test
public void testFormat() {
    LayoutFormatter a = new AuthorAndsReplacer();
    // Empty case
    Assert.assertEquals("", a.format(""));
    // Single Names don't change
    Assert.assertEquals("Someone, Van Something", a.format("Someone, Van Something"));
    // Two names just an &
    Assert.assertEquals("John Smith & Black Brown, Peter", a.format("John Smith and Black Brown, Peter"));
    // Three names put a comma:
    Assert.assertEquals("von Neumann, John; Smith, John & Black Brown, Peter", a.format("von Neumann, John and Smith, John and Black Brown, Peter"));
    Assert.assertEquals("John von Neumann; John Smith & Peter Black Brown", a.format("John von Neumann and John Smith and Peter Black Brown"));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 12 with LayoutFormatter

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

the class LastPageTest method testFormatSingleDash.

@Test
public void testFormatSingleDash() {
    LayoutFormatter a = new LastPage();
    Assert.assertEquals("350", a.format("345-350"));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 13 with LayoutFormatter

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

the class LastPageTest method testFormatSinglePage.

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

Example 14 with LayoutFormatter

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

the class LastPageTest method testFormatNull.

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

Example 15 with LayoutFormatter

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

the class LastPageTest method testFormatEmpty.

@Test
public void testFormatEmpty() {
    LayoutFormatter a = new LastPage();
    Assert.assertEquals("", a.format(""));
}
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