package Crypter; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; public class CrypterTest { @Test void testEncrypt() { Crypter c = new CrypterImpl(); assertEquals("4bcd3fghijk1mn0pqrs7uvwxyzl2ea56t89o", c.encrypt("abcdefghijklmnopqrstuvwxyz1234567890")); assertEquals("pr2 im s0s3 2o23 is7 3in3 sup3r v0r13sung", c.encrypt("pr2 im sose 202e ist eine super vorlesung")); assertEquals("4bcd3fghijk1mn0pqrs7uvwxyzl2ea56t89o", c.encrypt("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")); assertEquals("", c.encrypt("")); } @Test void testEncryptIllegal() { Crypter c = new CrypterImpl(); assertEquals("4bcd3fghijk1mn0pqrs7uvwxyzl2ea56t89o", c.encrypt("ABCDEFGHIJKLMNOPQRSTU!()/VWXYZ1234567890")); assertEquals("4bcd3fghijk1mn0pqrs7uvwxyzl2ea56t89o", c.encrypt("!A!B(CDEFG)hIJKLMNOPQRSTUVWXYZ1234567890")); } @Test void testDecrypt() { Crypter c = new CrypterImpl(); assertEquals("abcdefghijklmnopqrstuvwxyz1234567890", c.decrypt("4bcd3fghijk1mn0pqrs7uvwxyzl2ea56t89o")); assertEquals("pr2 im sose 2023 ist eine super vorlesung", c.encrypt("pr2 im s0s3 2o2e is7 3in3 sup3r v0r13sung")); assertEquals("", c.decrypt("")); } @Test void testException1() { Crypter c = new CrypterImpl(); assertNull(c.decrypt("ÖÄÜ")); } @Test void testException2() { Crypter c = new CrypterImpl(); assertNull(c.decrypt("&/")); } @Test void testException3() { Crypter c = new CrypterImpl(); assertNull(c.decrypt("abcdefghijklmnopqrstuvwXzy")); } }