lots of exercises in java... from https://github.com/exercism/java

IncorrectKeyCipherTest.java 747B

123456789101112131415161718192021222324252627282930
  1. import org.junit.Test;
  2. public class IncorrectKeyCipherTest {
  3. @Test(expected = IllegalArgumentException.class)
  4. public void cipherThrowsWithAllCapsKey() {
  5. new Cipher("ABCDEF");
  6. }
  7. @Test(expected = IllegalArgumentException.class)
  8. public void cipherThrowsWithAnyCapsKey() {
  9. new Cipher("abcdEFg");
  10. }
  11. @Test(expected = IllegalArgumentException.class)
  12. public void cipherThrowsWithNumericKey() {
  13. new Cipher("12345");
  14. }
  15. @Test(expected = IllegalArgumentException.class)
  16. public void cipherThrowsWithAnyNumericKey() {
  17. new Cipher("abcd345ef");
  18. }
  19. @Test(expected = IllegalArgumentException.class)
  20. public void cipherThrowsWithEmptyKey() {
  21. new Cipher("");
  22. }
  23. }