Add tests for CharacterSame (#2989)

This commit is contained in:
Aldo Telese 2022-03-31 19:54:48 +02:00 committed by GitHub
parent 1fc897ed4d
commit 63f486c6ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,28 @@
package com.thealgorithms.strings;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class CharacterSameTest {
@Test
public void isAllCharactersSame() {
String input1 = "aaa";
String input2 = "abc";
String input3 = "1 1 1 1";
String input4 = "111";
String input5 = "";
String input6 = " ";
String input7 = ". ";
assertTrue(CharactersSame.isAllCharactersSame(input1));
assertFalse(CharactersSame.isAllCharactersSame(input2));
assertFalse(CharactersSame.isAllCharactersSame(input3));
assertTrue(CharactersSame.isAllCharactersSame(input4));
assertTrue(CharactersSame.isAllCharactersSame(input5));
assertTrue(CharactersSame.isAllCharactersSame(input6));
assertFalse(CharactersSame.isAllCharactersSame(input7));
}
}