Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update teste getPart #8610

Merged
merged 1 commit into from
Mar 27, 2022
Merged
Changes from all commits
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
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