-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from InseeFr/feat/jacoco
feat: add jacoco maven plugin
- Loading branch information
Showing
4 changed files
with
85 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package fr.insee.rmes.utils; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class StringUtilsTest { | ||
|
||
@Test | ||
void testStringContainsItemFromList_WhenTokenContainsAnItem_ShouldReturnTrue() { | ||
String token = "hello world"; | ||
String[] list = {"hello", "test", "example"}; | ||
|
||
boolean result = StringUtils.stringContainsItemFromList(token, list); | ||
|
||
assertTrue(result, "The token contains an item from the list, so it should return true"); | ||
} | ||
|
||
@Test | ||
void testStringContainsItemFromList_WhenTokenDoesNotContainAnyItem_ShouldReturnFalse() { | ||
String token = "goodbye world"; | ||
String[] list = {"hello", "test", "example"}; | ||
|
||
boolean result = StringUtils.stringContainsItemFromList(token, list); | ||
|
||
assertFalse(result, "The token does not contain any item from the list, so it should return false"); | ||
} | ||
|
||
@Test | ||
void testStringContainsItemFromList_WhenListIsEmpty_ShouldReturnFalse() { | ||
String token = "hello world"; | ||
String[] list = {}; | ||
|
||
boolean result = StringUtils.stringContainsItemFromList(token, list); | ||
|
||
assertFalse(result, "An empty list should always return false"); | ||
} | ||
|
||
@Test | ||
void testStringContainsItemFromList_WhenTokenIsEmpty_ShouldReturnFalse() { | ||
String token = ""; | ||
String[] list = {"hello", "test"}; | ||
|
||
boolean result = StringUtils.stringContainsItemFromList(token, list); | ||
|
||
assertFalse(result, "An empty token should return false"); | ||
} | ||
|
||
@Test | ||
void testStringContainsItemFromList_WhenBothTokenAndListAreEmpty_ShouldReturnFalse() { | ||
String token = ""; | ||
String[] list = {}; | ||
|
||
boolean result = StringUtils.stringContainsItemFromList(token, list); | ||
|
||
assertFalse(result, "An empty token and an empty list should return false"); | ||
} | ||
} |