Skip to content

Commit

Permalink
Adapt test to new behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Apr 24, 2023
1 parent 0e0c04b commit f66a109
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We moved the custom entry types dialog into the preferences dialog. [#9760](https://github.com/JabRef/jabref/pull/9760)
- We moved the manage content selectors dialog to the library properties. [#9768](https://github.com/JabRef/jabref/pull/9768)
- We moved the preferences menu command from the options menu to the file menu. [#9768](https://github.com/JabRef/jabref/pull/9768)

- We changed the handling of an "overflow" of authors at `[authIniN]`: JabRef uses `+` to indicate an overflow. Example: `[authIni2]` produces `A+` (instead of `AB`) for `Aachen and Berlin and Chemnitz`. [#9703](https://github.com/JabRef/jabref/pull/9703)


### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,31 @@ static Stream<Arguments> authIni1() {
Arguments.of("A", "Aachen and Berlin and Chemnitz and Düsseldorf and Essen and others"));
}

@ParameterizedTest
@MethodSource
void authIni2(String expected, AuthorList list) {
assertEquals(expected, BracketedPattern.authIniN(list, 2));
}

static Stream<Arguments> authIni2() {
return Stream.of(
Arguments.of("Ne", "Isaac Newton"),
Arguments.of("NM", "Isaac Newton and James Maxwell"),
Arguments.of("N+", "Isaac Newton and James Maxwell and Albert Einstein"),
Arguments.of("N+", "Isaac Newton and James Maxwell and Albert Einstein and N. Bohr"),
Arguments.of("Aa", "Aachen"),
Arguments.of("A+", "Aachen and others"),
Arguments.of("AB", "Aachen and Berlin"),
Arguments.of("A+", "Aachen and Berlin and others"),
Arguments.of("A+", "Aachen and Berlin and Chemnitz"),
Arguments.of("D+", "John Doe and Donald Smith and Will Wonder",
Arguments.of("A+", "Aachen and Berlin and Chemnitz and others"),
Arguments.of("A+", "Aachen and Berlin and Chemnitz and Düsseldorf"),
Arguments.of("A+", "Aachen and Berlin and Chemnitz and Düsseldorf and others"),
Arguments.of("A+", "Aachen and Berlin and Chemnitz and Düsseldorf and Essen"),
Arguments.of("A+", "Aachen and Berlin and Chemnitz and Düsseldorf and Essen and others"));
}

@ParameterizedTest
@MethodSource
void authIni4(String expected, AuthorList list) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ void generateKeyAuthIni() {
bibtexKeyPattern.setDefaultValue("[authIni2]");
entry.setField(StandardField.AUTHOR, "John Doe and Donald Smith and Will Wonder");
new CitationKeyGenerator(bibtexKeyPattern, database, preferences).generateAndSetKey(entry);
assertEquals(Optional.of("DS"), entry.getCitationKey());
assertEquals(Optional.of("D+"), entry.getCitationKey());
}

@Test
Expand Down

0 comments on commit f66a109

Please sign in to comment.