I am using the following two tests for the common pangram program. But test2 passes while test3 fails.
@Test
public void test2(){
Pangram4 pangram4 = new Pangram4(" b cd x rs ijk pno f vu");
Set<Character> actual = pangram4.getMissingAlphabets();
Set <Character>expected = new HashSet<Character>();
expected.add('a');
expected.add('e');
expected.add('g');
expected.add('h');
expected.add('l');
expected.add('m');
expected.add('q');
expected.add('t');
expected.add('w');
expected.add('y');
expected.add('z');
assertEquals(expected,actual);
}
@Test
public void test3(){
Pangram4 pangram4 = new Pangram4("The quick browndoga lazy.");
Set<Character> actual = pangram4.getMissingAlphabets();
Set<Character> expected = new HashSet<Character>();
expected.add('f');
expected.add('o');
expected.add('x');
expected.add('j');
expected.add('u');
expected.add('m');
expected.add('p');
expected.add('s');
expected.add('o');
expected.add('v');
expected.add('e');
expected.add('r');
assertEquals(expected, actual);
}
What can be the reason? I have only given the test methods here, not the entire junit class. Please use any pangram program with getMissingLetters() method that returns the Set and change test method accordingly.