Skip to content

Commit

Permalink
update test getPart
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan-Oliveira committed Mar 26, 2022
1 parent 18913f6 commit 0ad7f64
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/test/java/org/jabref/model/strings/StringUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,14 @@ void testStripBrackets() {

@Test
void testGetPart() {
assertEquals("{roupa}", StringUtil.getPart("O rato roeu a {roupa} do rei de roma", 13, false));
// Get word between braces
assertEquals("{makes}", StringUtil.getPart("Practice {makes} perfect", 8, false));
// When the string is empty and start Index equal zero
assertEquals("", StringUtil.getPart("", 0, false));
assertEquals("", StringUtil.getPart("Um passo por }dia}", 12, false));
assertEquals("dia", StringUtil.getPart("Um passo por dia", 12, true));
// When the word are in between close curly bracket
assertEquals("", StringUtil.getPart("A closed mouth catches no }flies}", 25, false));
// Get the word from the end of the sentence
assertEquals("bite", StringUtil.getPart("Barking dogs seldom bite", 19, true));
}

@Test
Expand Down

0 comments on commit 0ad7f64

Please sign in to comment.