Add test for Pangram.java (#2986)

This commit is contained in:
Aldo Telese 2022-03-23 21:34:50 +01:00 committed by GitHub
parent 1d5d672fbd
commit 8b71a15cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,24 @@
package com.thealgorithms.strings;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class PangramTest {
@Test
public void isPangram() {
String fullAlphabet = "abcdefghijklmnopqrstuvwxyz";
String notFullAlphabet = "abcdefghiklmnopqrstuvwxyz";
String fullMixedCaseAlphabet = "a BCDE fghIjkLMnop qrSTuv WXYz";
String sentence1 = "The quick brown fox jumps over the lazy dog";
String sentence2 = "The quick brown fox jumps over the lazy gentleman"; // missing letter d
assertTrue(Pangram.isPangram(fullAlphabet));
assertFalse(Pangram.isPangram(notFullAlphabet));
assertTrue(Pangram.isPangram(fullMixedCaseAlphabet));
assertTrue(Pangram.isPangram(sentence1));
assertFalse(Pangram.isPangram(sentence2));
}
}