BAEL-2536-addressed review comments
This commit is contained in:
parent
693da95f44
commit
082724abec
|
@ -15,10 +15,10 @@ public class Pangram {
|
|||
Boolean[] alphabetMarker = new Boolean[ALPHABET_COUNT];
|
||||
Arrays.fill(alphabetMarker, false);
|
||||
int alphabetIndex = 0;
|
||||
str = str.toUpperCase();
|
||||
String strUpper = str.toUpperCase();
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
if ('A' <= str.charAt(i) && str.charAt(i) <= 'Z') {
|
||||
alphabetIndex = str.charAt(i) - 'A';
|
||||
if ('A' <= strUpper.charAt(i) && strUpper.charAt(i) <= 'Z') {
|
||||
alphabetIndex = strUpper.charAt(i) - 'A';
|
||||
alphabetMarker[alphabetIndex] = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,18 +4,17 @@ import static org.junit.Assert.assertFalse;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class PangramUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenValidString_isPanagram_shouldReturnSuccess() {
|
||||
public void givenValidString_isPangram_shouldReturnSuccess() {
|
||||
String input = "Two driven jocks help fax my big quiz";
|
||||
assertTrue(Pangram.isPangram(input));
|
||||
assertTrue(Pangram.isPangramWithStreams(input));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenNullString_isPanagram_shouldReturnFailure() {
|
||||
public void givenNullString_isPangram_shouldReturnFailure() {
|
||||
String input = null;
|
||||
assertFalse(Pangram.isPangram(input));
|
||||
assertFalse(Pangram.isPangramWithStreams(input));
|
||||
|
@ -23,20 +22,20 @@ public class PangramUnitTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void givenPerfectPanagramString_isPerfectPanagram_shouldReturnSuccess() {
|
||||
public void givenPerfectPangramString_isPerfectPangram_shouldReturnSuccess() {
|
||||
String input = "abcdefghijklmNoPqrStuVwxyz";
|
||||
assertTrue(Pangram.isPerfectPangram(input));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenNonPanagramString_isPanagram_shouldReturnFailure() {
|
||||
String input = "invalid panagram";
|
||||
public void givenNonPangramString_isPangram_shouldReturnFailure() {
|
||||
String input = "invalid pangram";
|
||||
assertFalse(Pangram.isPangram(input));
|
||||
assertFalse(Pangram.isPangramWithStreams(input));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenPanagram_isPerfectPanagram_shouldReturnFailure() {
|
||||
public void givenPangram_isPerfectPangram_shouldReturnFailure() {
|
||||
String input = "Two driven jocks help fax my big quiz";
|
||||
assertFalse(Pangram.isPerfectPangram(input));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue