Skip to content

Commit fbae596

Browse files
committed
add test case 2
1 parent 89f5fed commit fbae596

File tree

2 files changed

+60
-5
lines changed

2 files changed

+60
-5
lines changed

.idea/workspace.xml

Lines changed: 47 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/test/java/io/github/dbc/DuplicateCharactersCounterTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import org.junit.jupiter.api.BeforeEach;
44
import org.junit.jupiter.api.DisplayName;
55
import org.junit.jupiter.api.Test;
6+
import org.junit.jupiter.params.ParameterizedTest;
7+
import org.junit.jupiter.params.provider.ValueSource;
68

79
import static org.junit.jupiter.api.Assertions.assertEquals;
810

@@ -14,6 +16,17 @@ void setUp() {
1416
counter = new DuplicateCharactersCounter();
1517
}
1618

19+
@ParameterizedTest
20+
@ValueSource(strings = {"abcdefghijklmnopqrstuvwxyz", "dbc", "A", "1234567890"})
21+
@DisplayName("should return map of correct size")
22+
void shouldReturnMapOfCorrectSize(String input) {
23+
// Act
24+
var characterIntegerMap = counter.countDuplicateCharacters(input);
25+
// Assert
26+
assertEquals(input.length(), characterIntegerMap.size(),
27+
"the map should have the same size as the input string");
28+
}
29+
1730
@Test
1831
@DisplayName("should return count as 1 for all non duplicate characters")
1932
void shouldReturnCount1ForNonDuplicateCharacters() {

0 commit comments

Comments
 (0)