|
1 | 1 | package com.thealgorithms.ciphers;
|
2 | 2 |
|
3 |
| -import static org.junit.jupiter.api.Assertions.assertEquals; |
4 |
| - |
5 |
| -import java.util.stream.Stream; |
6 |
| - |
7 |
| -import org.junit.jupiter.params.ParameterizedTest; |
8 |
| -import org.junit.jupiter.params.provider.Arguments; |
9 |
| -import org.junit.jupiter.params.provider.MethodSource; |
10 |
| - |
11 | 3 | public final class MonoAlphabetic {
|
12 | 4 |
|
13 | 5 | // Private constructor to prevent instantiation of utility class
|
@@ -53,40 +45,4 @@ public static int getIndex(char c, String key) {
|
53 | 45 | }
|
54 | 46 | return -1; // Return -1 if character not found (should not happen for valid inputs)
|
55 | 47 | }
|
56 |
| - |
57 |
| - // *********** Unit Test Section ************** |
58 |
| - |
59 |
| - // Method to provide test data for encryption |
60 |
| - private static Stream<Arguments> provideEncryptionData() { |
61 |
| - String key = "MNBVCXZLKJHGFDSAPOIUYTREWQ"; |
62 |
| - return Stream.of( |
63 |
| - // Input data, key, expected encrypted output |
64 |
| - Arguments.of("HELLO", key, "GFSSD"), |
65 |
| - Arguments.of("JAVA", key, "MZSM") |
66 |
| - ); |
67 |
| - } |
68 |
| - |
69 |
| - // Test for encryption |
70 |
| - @ParameterizedTest |
71 |
| - @MethodSource("provideEncryptionData") |
72 |
| - public void testEncrypt(String data, String key, String expected) { |
73 |
| - assertEquals(expected, MonoAlphabetic.encrypt(data, key)); |
74 |
| - } |
75 |
| - |
76 |
| - // Method to provide test data for decryption |
77 |
| - private static Stream<Arguments> provideDecryptionData() { |
78 |
| - String key = "MNBVCXZLKJHGFDSAPOIUYTREWQ"; |
79 |
| - return Stream.of( |
80 |
| - // Encrypted data, key, expected decrypted output |
81 |
| - Arguments.of("GFSSD", key, "HELLO"), |
82 |
| - Arguments.of("MZSM", key, "JAVA") |
83 |
| - ); |
84 |
| - } |
85 |
| - |
86 |
| - // Test for decryption |
87 |
| - @ParameterizedTest |
88 |
| - @MethodSource("provideDecryptionData") |
89 |
| - public void testDecrypt(String data, String key, String expected) { |
90 |
| - assertEquals(expected, MonoAlphabetic.decrypt(data, key)); |
91 |
| - } |
92 | 48 | }
|
0 commit comments