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"));
}
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));
}
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"));
}
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"));
}
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"));
}
Aggregations