Search in sources :

Example 1 with LayoutFormatter

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

the class AuthorAbbreviatorTest method testFormat.

@Test
public void testFormat() {
    LayoutFormatter a = new AuthorLastFirstAbbreviator();
    LayoutFormatter b = new AuthorAbbreviator();
    Assert.assertEquals(b.format(""), a.format(""));
    Assert.assertEquals(b.format("Someone, Van Something"), a.format("Someone, Van Something"));
    Assert.assertEquals(b.format("Smith, John"), a.format("Smith, John"));
    Assert.assertEquals(b.format("von Neumann, John and Smith, John and Black Brown, Peter"), a.format("von Neumann, John and Smith, John and Black Brown, Peter"));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 2 with LayoutFormatter

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

the class AuthorAndToSemicolonReplacerTest method testFormat.

@Test
public void testFormat() {
    LayoutFormatter a = new AuthorAndToSemicolonReplacer();
    Assert.assertEquals(expected, a.format(input));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 3 with LayoutFormatter

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

the class DOICheckTest method testFormat.

@Test
public void testFormat() {
    LayoutFormatter lf = new DOICheck();
    Assert.assertEquals("", lf.format(""));
    Assert.assertEquals(null, lf.format(null));
    Assert.assertEquals("http://doi.org/10.1000/ISBN1-900512-44-0", lf.format("10.1000/ISBN1-900512-44-0"));
    Assert.assertEquals("http://doi.org/10.1000/ISBN1-900512-44-0", lf.format("http://dx.doi.org/10.1000/ISBN1-900512-44-0"));
    Assert.assertEquals("http://doi.org/10.1000/ISBN1-900512-44-0", lf.format("http://doi.acm.org/10.1000/ISBN1-900512-44-0"));
    Assert.assertEquals("http://doi.org/10.1145/354401.354407", lf.format("http://doi.acm.org/10.1145/354401.354407"));
    Assert.assertEquals("http://doi.org/10.1145/354401.354407", lf.format("10.1145/354401.354407"));
    // Works even when having a / at the front
    Assert.assertEquals("http://doi.org/10.1145/354401.354407", lf.format("/10.1145/354401.354407"));
    // Obviously a wrong doi, will not change anything.
    Assert.assertEquals("10", lf.format("10"));
    // Obviously a wrong doi, will not change anything.
    Assert.assertEquals("1", lf.format("1"));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 4 with LayoutFormatter

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

the class DOIStripTest method testFormat.

@Test
public void testFormat() {
    LayoutFormatter lf = new DOIStrip();
    Assert.assertEquals("", lf.format(""));
    Assert.assertEquals(null, lf.format(null));
    Assert.assertEquals("10.1000/ISBN1-900512-44-0", lf.format("10.1000/ISBN1-900512-44-0"));
    Assert.assertEquals("10.1000/ISBN1-900512-44-0", lf.format("http://dx.doi.org/10.1000/ISBN1-900512-44-0"));
    Assert.assertEquals("10.1000/ISBN1-900512-44-0", lf.format("http://doi.acm.org/10.1000/ISBN1-900512-44-0"));
}
Also used : LayoutFormatter(org.jabref.logic.layout.LayoutFormatter) Test(org.junit.Test)

Example 5 with LayoutFormatter

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

the class CompositeFormatTest method testDoubleComposite.

@Test
public void testDoubleComposite() {
    LayoutFormatter f = new CompositeFormat(new AuthorOrgSci(), new NoSpaceBetweenAbbreviations());
    LayoutFormatter first = new AuthorOrgSci();
    LayoutFormatter second = new NoSpaceBetweenAbbreviations();
    Assert.assertEquals(second.format(first.format("John Flynn and Sabine Gartska")), f.format("John Flynn and Sabine Gartska"));
    Assert.assertEquals(second.format(first.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea 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)

Aggregations

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