Skip to content

Commit

Permalink
Add test to explain the issue when two abbreviations have different n…
Browse files Browse the repository at this point in the history
…ames but the same key.
  • Loading branch information
simonharrer committed Oct 8, 2015
1 parent 181cdea commit 3bcf7d5
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ public void testDuplicates() {
assertEquals(1, repository.size());
}

@Test
public void testDuplicatesIsoOnly() {
JournalAbbreviationRepository repository = new JournalAbbreviationRepository();
repository.addEntry(new Abbreviation("Old Long Name", "L. N."));
repository.addEntry(new Abbreviation("New Long Name", "L. N."));
assertEquals(2, repository.size());

assertEquals("L N", repository.getNextAbbreviation("L. N.").orElse("WRONG"));
assertEquals("New Long Name", repository.getNextAbbreviation("L N").orElse("WRONG"));
}

@Test
public void testDuplicateKeys() {
JournalAbbreviationRepository repository = new JournalAbbreviationRepository();
Expand All @@ -70,12 +81,4 @@ public void testDuplicateKeys() {
assertEquals("Long Name = LA. N.", repository.getAbbreviations().first().toPropertiesLine());
}

@Test
public void testParsing() {
JournalAbbreviationRepository repository = new JournalAbbreviationRepository();
repository.readJournalListFromResource(Abbreviations.JOURNALS_FILE_BUILTIN);
repository.readJournalListFromResource(Abbreviations.JOURNALS_IEEE_INTERNAL_LIST);
assertTrue(!repository.getAbbreviations().isEmpty());
}

}

0 comments on commit 3bcf7d5

Please sign in to comment.