Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions src/test/java/org/jabref/model/entry/AuthorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,61 @@ void addDotIfAbbreviationDoNotAddDot() {
assertEquals("Moore, O. and O. Moore", Author.addDotIfAbbreviation("Moore, O. and O. Moore"));
assertEquals("Moore, O. and O. Moore and Moore, O. O.", Author.addDotIfAbbreviation("Moore, O. and O. Moore and Moore, O. O."));
}

@Test
void addDotIfAbbreviationIfNameIsNull() {
String nameTest = null;
assertEquals(null, Author.addDotIfAbbreviation(nameTest));
}

@Test
void addDotIfAbbreviationReturnNameIfEmptyString() {
assertEquals("", Author.addDotIfAbbreviation(""));
}

@Test
void addDotIfAbbreviationMoreLowerCaseLetters() {
assertEquals("asdf", Author.addDotIfAbbreviation("asdf"));
}

@Test
void addDotIfAbbreviationOnlyOneCharLowerCase() {
assertEquals("a", Author.addDotIfAbbreviation("a"));
}

@Test
void addDotIfAbbreviationStartWithUpperCaseAndHyphen() {
assertEquals("A.-melia", Author.addDotIfAbbreviation("A-melia"));
}

@Test
void addDotIfAbbreviationEndsWithUpperCaseLetter() {
assertEquals("AmeliA", Author.addDotIfAbbreviation("AmeliA"));
}

@Test
void addDotIfAbbreviationEndsWithUpperCaseLetterSpaced() {
assertEquals("Ameli A.", Author.addDotIfAbbreviation("Ameli A"));
}

@Test
void addDotIfAbbreviationEndsWithWhiteSpaced() {
assertEquals("Ameli", Author.addDotIfAbbreviation("Ameli "));
}

@Test
void addDotIfAbbreviationEndsWithDoubleAbbreviation() {
assertEquals("Ameli A. A.", Author.addDotIfAbbreviation("Ameli AA"));
}

@Test
void addDotIfAbbreviationIfStartsWithNumber() {
assertEquals("1", Author.addDotIfAbbreviation("1"));
}

@Test
void addDotIfAbbreviationIfStartsWithSpacedNumber() {
assertEquals("1 23", Author.addDotIfAbbreviation("1 23"));
}

}