package org.jabref.model.entry;

import org.jabref.model.database.BibDatabase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Optional;

import static org.junit.Assert.assertEquals;

public class EntryLinkListTest {

    @Test
    public void givenFieldValueAndDatabaseWhenParsingThenResultExpected() {
        String fieldValue = "test";
        BibDatabase bibDatabase = new BibDatabase();
        List<ParsedEntryLink> links = EntryLinkList.parse(fieldValue, bibDatabase);
        ParsedEntryLink link = links.get(0);

        assertEquals(fieldValue, link.getKey());
        assertEquals(bibDatabase, link.getDataBase());
        assertEquals(Optional.empty(), link.getLinkedEntry());
    }
}

@@ -526,22 +526,18 @@
 Then
-Result
 Expect
-ed
+Link
 () %7B
@@ -928,11 +928,324 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void givenNullFieldValueAndDatabaseWhenParsingThenExpectLinksSizeZero() %7B%0A        String fieldValue = null;%0A        BibDatabase bibDatabase = new BibDatabase();%0A        List%3CParsedEntryLink%3E links = EntryLinkList.parse(fieldValue, bibDatabase);%0A%0A        assertEquals(0, links.size());%0A    %7D
 %0A%7D%0A

add test for parsing of entry link list with null key