package net.sf.jabref.logic.formatter.minifier;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class AuthorsMinifierTest {
    private AuthorsMinifier formatter;

    @Before
    public void setUp() {
        formatter = new AuthorsMinifier();
    }

    @After
    public void teardown() {
        formatter = null;
    }

    @Test
    public void minifyAuthorNames() {
        expectCorrect("Simon Harrer", "Simon Harrer");
        expectCorrect("Simon Harrer and others", "Simon Harrer and others");
        expectCorrect("Simon Harrer and Jrg Lenhard", "Simon Harrer and Jrg Lenhard");
        expectCorrect("Simon Harrer and Jrg Lenhard and Guido Wirtz", "Simon Harrer and others");
        expectCorrect("Simon Harrer and Jrg Lenhard and Guido Wirtz and others", "Simon Harrer and others");
    }

    @Test
    public void formatEmptyFields() {
        expectCorrect("", "");
        expectCorrect(null, null);
    }

    private void expectCorrect(String input, String expected) {
        Assert.assertEquals(expected, formatter.format(input));
    }
}
@@ -589,32 +589,33 @@
 mon Harrer and J
+%C3%B6
 rg Lenhard%22, %22Si
@@ -622,32 +622,33 @@
 mon Harrer and J
+%C3%B6
 rg Lenhard%22);%0A  
@@ -678,32 +678,33 @@
 mon Harrer and J
+%C3%B6
 rg Lenhard and G
@@ -785,16 +785,17 @@
 er and J
+%C3%B6
 rg Lenha

Correct encoding