Skip to content

Commit 5a9f512

Browse files
authored
Revert "Issue676 author last (#13625)" (#14123)
This reverts commit 72d9c1d.
1 parent 72d9c1d commit 5a9f512

File tree

2 files changed

+17
-36
lines changed

2 files changed

+17
-36
lines changed

jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* <code>2017_Kitsune_123</code> when expanded using the BibTeX entry <code>@Article{ authors = {O. Kitsune}, year = {2017},
4747
* pages={123-6}}</code>.
4848
* <p>
49-
* The embedding in JabRef is explained at <a href="https://docs.jabref.org/setup/citationkeypatterns">Customize the citation key generator</a>.
49+
* The embedding in JabRef is explained at <a href="https://docs.jabref.org/setup/citationkeypattern">Customize the citation key generator</a>.
5050
* </p>
5151
*/
5252
public class BracketedPattern {
@@ -807,8 +807,7 @@ private static String firstAuthorVonAndLast(AuthorList authorList) {
807807
* @param authorList an {@link AuthorList}
808808
* @return the surname of an author/editor
809809
*/
810-
@VisibleForTesting
811-
static String lastAuthor(AuthorList authorList) {
810+
private static String lastAuthor(AuthorList authorList) {
812811
if (authorList.isEmpty()) {
813812
return "";
814813
}
@@ -1222,7 +1221,7 @@ protected static List<String> parseFieldAndModifiers(String arg) {
12221221

12231222
/**
12241223
* <p>
1225-
* An author or editor may be an institution not a person. In that case the key generator builds very long keys,
1224+
* An author or editor may be and institution not a person. In that case the key generator builds very long keys,
12261225
* e.g.: for &ldquo;The Attributed Graph Grammar System (AGG)&rdquo; -> &ldquo;TheAttributedGraphGrammarSystemAGG&rdquo;.
12271226
* </p>
12281227
*

jablib/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ static Stream<Arguments> authShort() {
179179

180180
@ParameterizedTest
181181
@MethodSource
182-
void authShort(String expected, AuthorList list) {
183-
assertEquals(expected, BracketedPattern.authShort(list));
182+
void authIni1(String expected, AuthorList list) {
183+
assertEquals(expected, BracketedPattern.authIniN(list, 1));
184184
}
185185

186186
static Stream<Arguments> authIni1() {
@@ -204,8 +204,8 @@ static Stream<Arguments> authIni1() {
204204

205205
@ParameterizedTest
206206
@MethodSource
207-
void authIni1(String expected, AuthorList list) {
208-
assertEquals(expected, BracketedPattern.authIniN(list, 1));
207+
void authIni2(String expected, AuthorList list) {
208+
assertEquals(expected, BracketedPattern.authIniN(list, 2));
209209
}
210210

211211
static Stream<Arguments> authIni2() {
@@ -230,8 +230,8 @@ static Stream<Arguments> authIni2() {
230230

231231
@ParameterizedTest
232232
@MethodSource
233-
void authIni2(String expected, AuthorList list) {
234-
assertEquals(expected, BracketedPattern.authIniN(list, 2));
233+
void authIni3(String expected, AuthorList list) {
234+
assertEquals(expected, BracketedPattern.authIniN(list, 3));
235235
}
236236

237237
static Stream<Arguments> authIni3() {
@@ -256,8 +256,8 @@ static Stream<Arguments> authIni3() {
256256

257257
@ParameterizedTest
258258
@MethodSource
259-
void authIni3(String expected, AuthorList list) {
260-
assertEquals(expected, BracketedPattern.authIniN(list, 3));
259+
void authIni4(String expected, AuthorList list) {
260+
assertEquals(expected, BracketedPattern.authIniN(list, 4));
261261
}
262262

263263
static Stream<Arguments> authIni4() {
@@ -281,8 +281,8 @@ static Stream<Arguments> authIni4() {
281281

282282
@ParameterizedTest
283283
@MethodSource
284-
void authIni4(String expected, AuthorList list) {
285-
assertEquals(expected, BracketedPattern.authIniN(list, 4));
284+
void authEtAlDotDotEal(String expected, AuthorList list) {
285+
assertEquals(expected, BracketedPattern.authEtal(list, ".", ".etal"));
286286
}
287287

288288
static Stream<Arguments> authEtAlDotDotEal() {
@@ -306,8 +306,8 @@ static Stream<Arguments> authEtAlDotDotEal() {
306306

307307
@ParameterizedTest
308308
@MethodSource
309-
void authEtAlDotDotEal(String expected, AuthorList list) {
310-
assertEquals(expected, BracketedPattern.authEtal(list, ".", ".etal"));
309+
void authAuthEa(String expected, AuthorList list) {
310+
assertEquals(expected, BracketedPattern.authAuthEa(list));
311311
}
312312

313313
static Stream<Arguments> authAuthEa() {
@@ -331,26 +331,8 @@ static Stream<Arguments> authAuthEa() {
331331

332332
@ParameterizedTest
333333
@MethodSource
334-
void authAuthEa(String expected, AuthorList list) {
335-
assertEquals(expected, BracketedPattern.authAuthEa(list));
336-
}
337-
338-
@ParameterizedTest
339-
@CsvSource({
340-
"'Newton', 'Isaac Newton'",
341-
"'Maxwell', 'Isaac Newton and James Maxwell'",
342-
"'Einstein', 'Isaac Newton and James Maxwell and Albert Einstein'",
343-
"'Bohr', 'Isaac Newton and James Maxwell and Albert Einstein and N. Bohr'",
344-
"'Aachen', 'Aachen'",
345-
"'Berlin', 'Aachen and Berlin'",
346-
"'Chemnitz', 'Aachen and Berlin and Chemnitz'",
347-
"'Düsseldorf', 'Aachen and Berlin and Chemnitz and Düsseldorf'",
348-
"'Essen', 'Aachen and Berlin and Chemnitz and Düsseldorf and Essen'",
349-
"'Aalst', 'Wil van der Aalst",
350-
"'Lessen', 'Wil van der Aalst and Tammo van Lessen'"
351-
})
352-
void authLast(String expected, AuthorList list) {
353-
assertEquals(expected, BracketedPattern.lastAuthor(list));
334+
void authShort(String expected, AuthorList list) {
335+
assertEquals(expected, BracketedPattern.authShort(list));
354336
}
355337

356338
@ParameterizedTest

0 commit comments

Comments
 (0)