Package net.sf.jabref.export.layout

Examples of net.sf.jabref.export.layout.LayoutFormatter


import net.sf.jabref.export.layout.format.DOICheck;

public class DOICheckTest extends TestCase {

  public void testFormat() {
    LayoutFormatter lf = new DOICheck();

    assertEquals("", lf.format(""));
    assertEquals(null, lf.format(null));
   
    assertEquals("http://dx.doi.org/10.1000/ISBN1-900512-44-0", lf
      .format("10.1000/ISBN1-900512-44-0"));
    assertEquals("http://dx.doi.org/10.1000/ISBN1-900512-44-0", lf
      .format("http://dx.doi.org/10.1000/ISBN1-900512-44-0"));

    assertEquals("http://doi.acm.org/10.1000/ISBN1-900512-44-0", lf
      .format("http://doi.acm.org/10.1000/ISBN1-900512-44-0"));

    assertEquals("http://doi.acm.org/10.1145/354401.354407", lf
      .format("http://doi.acm.org/10.1145/354401.354407"));
    assertEquals("http://dx.doi.org/10.1145/354401.354407", lf.format("10.1145/354401.354407"));

    // Does not work if the string does not start with a 10
    assertEquals("/10.1145/354401.354407", lf.format("/10.1145/354401.354407"));

    // Obviously a wrong doi, but we still accept it.
    assertEquals("http://dx.doi.org/10", lf.format("10"));

    // Obviously a wrong doi, but we still accept it.
    assertEquals("1", lf.format("1"));
  }
View Full Code Here


  protected void tearDown() throws Exception {
    super.tearDown();
  }
 
  public void testOrgSci(){
    LayoutFormatter f = new AuthorOrgSci();
   
    assertEquals("Flynn, J., S. Gartska", f.format("John Flynn and Sabine Gartska"));
    assertEquals("Garvin, D. A.", f.format("David A. Garvin"));
    assertEquals("Makridakis, S., S. C. Wheelwright, V. E. McGee", f.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea McGee"));
   
  }
View Full Code Here

    assertEquals("Garvin, D. A.", f.format("David A. Garvin"));
    assertEquals("Makridakis, S., S. C. Wheelwright, V. E. McGee", f.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea McGee"));
   
  }
  public void testOrgSciPlusAbbreviation(){
    LayoutFormatter f = new CompositeFormat(new AuthorOrgSci(), new NoSpaceBetweenAbbreviations());
    assertEquals("Flynn, J., S. Gartska", f.format("John Flynn and Sabine Gartska"));
    assertEquals("Garvin, D.A.", f.format("David A. Garvin"));
    assertEquals("Makridakis, S., S.C. Wheelwright, V.E. McGee", f.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea McGee"));
  }
View Full Code Here

   * Test method for
   * {@link net.sf.jabref.export.layout.format.AuthorAndsCommaReplacer#format(java.lang.String)}.
   */
  public void testFormat() {

    LayoutFormatter a = new AuthorAndsCommaReplacer();
   
    // Empty case
    assertEquals("", a.format(""));

    // Single Names don't change
    assertEquals("Someone, Van Something", a.format("Someone, Van Something"));
   
    // Two names just an &
    assertEquals("John von Neumann & Peter Black Brown",
      a.format("John von Neumann and Peter Black Brown"));
 
    // Three names put a comma:
    assertEquals("von Neumann, John, Smith, John & Black Brown, Peter",
        a.format("von Neumann, John and Smith, John and Black Brown, Peter"));
  }
View Full Code Here

  /**
   * Test method for {@link net.sf.jabref.export.layout.format.AuthorFirstLastCommas#format(java.lang.String)}.
   */
  public void testFormat() {
    LayoutFormatter a = new AuthorFirstLastCommas();

    // Empty case
    assertEquals("", a.format(""));

    // Single Names
    assertEquals("Van Something Someone", a.format("Someone, Van Something"));

    // Two names
    assertEquals("John von Neumann and Peter Black Brown", a
      .format("John von Neumann and Peter Black Brown"));

    // Three names
    assertEquals("John von Neumann, John Smith and Peter Black Brown", a
      .format("von Neumann, John and Smith, John and Black Brown, Peter"));

    assertEquals("John von Neumann, John Smith and Peter Black Brown", a
      .format("John von Neumann and John Smith and Black Brown, Peter"));
  }
View Full Code Here

  /**
   * Test method for {@link net.sf.jabref.export.layout.format.AuthorLastFirstAbbrOxfordCommas#format(java.lang.String)}.
   */
  public void testFormat() {
    LayoutFormatter a = new AuthorLastFirstAbbrOxfordCommas();

    // Empty case
    assertEquals("", a.format(""));

    // Single Names
    assertEquals("Someone, V. S.", a.format("Van Something Someone"));

    // Two names
    assertEquals("von Neumann, J. and Black Brown, P.", a
      .format("John von Neumann and Black Brown, Peter"));

    // Three names
    assertEquals("von Neumann, J., Smith, J., and Black Brown, P.", a
      .format("von Neumann, John and Smith, John and Black Brown, Peter"));

    assertEquals("von Neumann, J., Smith, J., and Black Brown, P.", a
      .format("John von Neumann and John Smith and Black Brown, Peter"));
  }
View Full Code Here

import net.sf.jabref.export.layout.format.AuthorLastFirst;

public class AuthorLastFirstTest extends TestCase {

  public void testFormat() {
    LayoutFormatter a = new AuthorLastFirst();

    // Empty case
    assertEquals("", a.format(""));

    // Single Names
    assertEquals("Someone, Van Something", a.format("Van Something Someone"));

    // Two names
    assertEquals("von Neumann, John and Black Brown, Peter", a
      .format("John von Neumann and Black Brown, Peter"));

    // Three names
    assertEquals("von Neumann, John and Smith, John and Black Brown, Peter", a
      .format("von Neumann, John and Smith, John and Black Brown, Peter"));

    assertEquals("von Neumann, John and Smith, John and Black Brown, Peter", a
      .format("John von Neumann and John Smith and Black Brown, Peter"));
  }
View Full Code Here

public class HTMLParagraphsTest extends TestCase {

  public void testFormat() {
   
    LayoutFormatter f = new HTMLParagraphs();
   
    assertEquals("", f.format(""));
    assertEquals("<p>\nHello\n</p>", f.format("Hello"));
    assertEquals("<p>\nHello\nWorld\n</p>", f.format("Hello\nWorld"));
    assertEquals("<p>\nHello World\n</p>\n<p>\nWhat a lovely day\n</p>", f.format("Hello World\n   \nWhat a lovely day\n"));
    assertEquals("<p>\nHello World\n</p>\n<p>\nCould not be any better\n</p>\n<p>\nWhat a lovely day\n</p>", f.format("Hello World\n \n\nCould not be any better\n\nWhat a lovely day\n"));
   
  }
View Full Code Here

   * Test method for
   * {@link net.sf.jabref.export.layout.format.AuthorLastFirstCommas#format(java.lang.String)}.
   */
  public void testFormat() {

    LayoutFormatter a = new AuthorLastFirstCommas();

    // Empty case
    assertEquals("", a.format(""));

    // Single Names
    assertEquals("Someone, Van Something", a.format("Van Something Someone"));

    // Two names
    assertEquals("von Neumann, John and Black Brown, Peter", a
      .format("John von Neumann and Black Brown, Peter"));

    // Three names
    assertEquals("von Neumann, John, Smith, John and Black Brown, Peter", a
      .format("von Neumann, John and Smith, John and Black Brown, Peter"));

    assertEquals("von Neumann, John, Smith, John and Black Brown, Peter", a
      .format("John von Neumann and John Smith and Black Brown, Peter"));
  }
View Full Code Here

  protected void tearDown() throws Exception {
    super.tearDown();
  }

  public void testFormat() {
    LayoutFormatter f = new NoSpaceBetweenAbbreviations();
    assertEquals("", f.format(""));
    assertEquals("John Meier", f.format("John Meier"));
    assertEquals("J.F. Kennedy", f.format("J. F. Kennedy"));
    assertEquals("J.R.R. Tolkien", f.format("J. R. R. Tolkien"));
    assertEquals("J.R.R. Tolkien and J.F. Kennedy", f.format("J. R. R. Tolkien and J. F. Kennedy"));
  }
View Full Code Here

TOP

Related Classes of net.sf.jabref.export.layout.LayoutFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.