/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/java/com/thealgorithms/ciphers/CaesarTest.java
46 строк
1 KB
Piotr Idzik
style: enable `AvoidStarImport` in checkstyle (#5141)
05 май 2024, 21:48
Не верифицирован
05 май 2024, 21:48
414835d
Код
Авторство
О чём код?
package com.thealgorithms.ciphers; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; class CaesarTest { Caesar caesar = new Caesar(); @Test void caesarEncryptTest() { // given String textToEncrypt = "Encrypt this text"; // when String cipherText = caesar.encode(textToEncrypt, 5); // then assertEquals("Jshwduy ymnx yjcy", cipherText); } @Test void caesarDecryptTest() { // given String encryptedText = "Jshwduy ymnx yjcy"; // when String cipherText = caesar.decode(encryptedText, 5); // then assertEquals("Encrypt this text", cipherText); } @Test void caesarBruteForce() { // given String encryptedText = "Jshwduy ymnx yjcy"; // when String[] allPossibleAnswers = caesar.bruteforce(encryptedText); assertEquals(27, allPossibleAnswers.length); assertEquals("Encrypt this text", allPossibleAnswers[5]); } }