BAEL-2536-added-unit-tests-for-panagram

This commit is contained in:
Varun Jain 2019-01-03 08:08:25 +05:30
parent 75bf7ba515
commit eacc84a450
1 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,44 @@
package com.baeldung.string;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class PanagramUnitTest {
@Test
public void givenValidString_isPanagram_shouldReturnSuccess() {
String input = "Two driven jocks help fax my big quiz";
assertTrue(Panagram.isPanagram(input));
assertTrue(Panagram.isPanagramWithStreams(input));
}
@Test
public void givenNullString_isPanagram_shouldReturnFailure() {
String input = null;
assertFalse(Panagram.isPanagram(input));
assertFalse(Panagram.isPanagramWithStreams(input));
assertFalse(Panagram.isPerfectPanagram(input));
}
@Test
public void givenPerfectPanagramString_isPerfectPanagram_shouldReturnSuccess() {
String input = "abcdefghijklmNoPqrStuVwxyz";
assertTrue(Panagram.isPerfectPanagram(input));
}
@Test
public void givenNonPanagramString_isPanagram_shouldReturnFailure() {
String input = "invalid panagram";
assertFalse(Panagram.isPanagram(input));
assertFalse(Panagram.isPanagramWithStreams(input));
}
@Test
public void givenPanagram_isPerfectPanagram_shouldReturnFailure() {
String input = "Two driven jocks help fax my big quiz";
assertFalse(Panagram.isPerfectPanagram(input));
}
}