I am trying to run a test on the class below:
package chapter03.backend;
import java.util.Map;
public class CharacterCounter {
public static Map<Character, Integer> countCharacters(String text) {
if (text == null) {
throw new IllegalArgumentException("text must not be null");
}
return null;
}
}
I have written this test class:
package chapter03.backend;
import static org.junit.Assert.*;
import org.junit.Test;
public class CharacterCounterTests {
@Test(expected=IllegalAccessException.class)
public void testNullInput() {
CharacterCounter.countCharacters(null);
}
}
When I run it, it keeps failing. Here is a screen shot of the error:
I will appreciate pointers on this.