diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherController.java index 691ce01..11c3dcd 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.combination; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class AdfgvxCipherController{ private String adfgvxName; @Value("${cipher.combination.adfgvx.description}") private String adfgvxDescription; + @Value("${cipher.combination.adfgvx.explanation}") + private List adfgvxExplanation; + @Value("${cipher.combination.adfgvx.facts}") + private List adfgvxFacts; @GetMapping @@ -36,7 +42,7 @@ public class AdfgvxCipherController{ log.info("Getting info for {}", adfgvxName); - return CipherInfoUtil.buildInfoNode(adfgvxName, adfgvxDescription); + return CipherInfoUtil.buildInfoNode(adfgvxName, adfgvxDescription, adfgvxExplanation, adfgvxFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherController.java index 77c199b..4e30c48 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.combination; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class AdfgxCipherController{ private String adfgxName; @Value("${cipher.combination.adfgx.description}") private String adfgxDescription; + @Value("${cipher.combination.adfgx.explanation}") + private List adfgxExplanation; + @Value("${cipher.combination.adfgx.facts}") + private List adfgxFacts; @GetMapping @@ -36,7 +42,7 @@ public class AdfgxCipherController{ log.info("Getting info for {}", adfgxName); - return CipherInfoUtil.buildInfoNode(adfgxName, adfgxDescription); + return CipherInfoUtil.buildInfoNode(adfgxName, adfgxDescription, adfgxExplanation, adfgxFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherController.java index a73b7fc..1c0653a 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class AffineCipherController{ private String affineName; @Value("${cipher.mono.affine.description}") private String affineDescription; + @Value("${cipher.mono.affine.explanation}") + private List affineExplanation; + @Value("${cipher.mono.affine.facts}") + private List affineFacts; @GetMapping @@ -36,7 +42,7 @@ public class AffineCipherController{ log.info("Getting info for {}", affineName); - return CipherInfoUtil.buildInfoNode(affineName, affineDescription); + return CipherInfoUtil.buildInfoNode(affineName, affineDescription, affineExplanation, affineFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherController.java index 44d1b38..0a015fa 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class AtbashCipherController{ private String atbashName; @Value("${cipher.mono.atbash.description}") private String atbashDescription; + @Value("${cipher.mono.atbash.explanation}") + private List atbashExplanation; + @Value("${cipher.mono.atbash.facts}") + private List atbashFacts; @GetMapping @@ -36,7 +42,7 @@ public class AtbashCipherController{ log.info("Getting info for {}", atbashName); - return CipherInfoUtil.buildInfoNode(atbashName, atbashDescription); + return CipherInfoUtil.buildInfoNode(atbashName, atbashDescription, atbashExplanation, atbashFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherController.java index e0c4dcd..1c84349 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class AutokeyCipherController{ private String autokeyName; @Value("${cipher.mono.autokey.description}") private String autokeyDescription; + @Value("${cipher.mono.autokey.explanation}") + private List autokeyExplanation; + @Value("${cipher.mono.autokey.facts}") + private List autokeyFacts; @GetMapping @@ -36,7 +42,7 @@ public class AutokeyCipherController{ log.info("Getting info for {}", autokeyName); - return CipherInfoUtil.buildInfoNode(autokeyName, autokeyDescription); + return CipherInfoUtil.buildInfoNode(autokeyName, autokeyDescription, autokeyExplanation, autokeyFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherController.java index 0605368..eb1aa2b 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class BaconianCipherController{ private String baconianName; @Value("${cipher.mono.baconian.description}") private String baconianDescription; + @Value("${cipher.mono.baconian.explanation}") + private List baconianExplanation; + @Value("${cipher.mono.baconian.facts}") + private List baconianFacts; @GetMapping @@ -36,7 +42,7 @@ public class BaconianCipherController{ log.info("Getting info for {}", baconianName); - return CipherInfoUtil.buildInfoNode(baconianName, baconianDescription); + return CipherInfoUtil.buildInfoNode(baconianName, baconianDescription, baconianExplanation, baconianFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherController.java index 4c76c39..4b3829a 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class BaseXCipherController{ private String baseXName; @Value("${cipher.mono.basex.description}") private String baseXDescription; + @Value("${cipher.mono.baseX.explanation}") + private List baseXExplanation; + @Value("${cipher.mono.baseX.facts}") + private List baseXFacts; @GetMapping @@ -36,7 +42,7 @@ public class BaseXCipherController{ log.info("Getting info for {}", baseXName); - return CipherInfoUtil.buildInfoNode(baseXName, baseXDescription); + return CipherInfoUtil.buildInfoNode(baseXName, baseXDescription, baseXExplanation, baseXFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherController.java index 5163696..c6b5769 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class BeaufortCipherController{ private String beaufortName; @Value("${cipher.mono.beaufort.description}") private String beaufortDescription; + @Value("${cipher.mono.beaufort.explanation}") + private List beaufortExplanation; + @Value("${cipher.mono.beaufort.facts}") + private List beaufortFacts; @GetMapping @@ -36,7 +42,7 @@ public class BeaufortCipherController{ log.info("Getting info for {}", beaufortName); - return CipherInfoUtil.buildInfoNode(beaufortName, beaufortDescription); + return CipherInfoUtil.buildInfoNode(beaufortName, beaufortDescription, beaufortExplanation, beaufortFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherController.java index e1f0519..399d564 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class CaesarCipherController{ private String caesarName; @Value("${cipher.mono.caesar.description}") private String caesarDescription; + @Value("${cipher.mono.caesar.explanation}") + private List caesarExplanation; + @Value("${cipher.mono.caesar.facts}") + private List caesarFacts; @GetMapping @@ -36,7 +42,7 @@ public class CaesarCipherController{ log.info("Getting info for {}", caesarName); - return CipherInfoUtil.buildInfoNode(caesarName, caesarDescription); + return CipherInfoUtil.buildInfoNode(caesarName, caesarDescription, caesarExplanation, caesarFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherController.java index f74694d..2314d0b 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class OneTimePadCipherController{ private String oneTimePadName; @Value("${cipher.mono.onetimepad.description}") private String oneTimePadDescription; + @Value("${cipher.mono.oneTimePad.explanation}") + private List oneTimePadExplanation; + @Value("${cipher.mono.oneTimePad.facts}") + private List oneTimePadFacts; @GetMapping @@ -36,7 +42,7 @@ public class OneTimePadCipherController{ log.info("Getting info for {}", oneTimePadName); - return CipherInfoUtil.buildInfoNode(oneTimePadName, oneTimePadDescription); + return CipherInfoUtil.buildInfoNode(oneTimePadName, oneTimePadDescription, oneTimePadExplanation, oneTimePadFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherController.java index 08dd870..28658a7 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class PortaCipherController{ private String portaName; @Value("${cipher.mono.porta.description}") private String portaDescription; + @Value("${cipher.mono.porta.explanation}") + private List portaExplanation; + @Value("${cipher.mono.porta.facts}") + private List portaFacts; @GetMapping @@ -36,7 +42,7 @@ public class PortaCipherController{ log.info("Getting info for {}", portaName); - return CipherInfoUtil.buildInfoNode(portaName, portaDescription); + return CipherInfoUtil.buildInfoNode(portaName, portaDescription, portaExplanation, portaFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherController.java index 3c2e0bc..def410e 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class SubstitutionCipherController{ private String substitutionName; @Value("${cipher.mono.substitution.description}") private String substitutionDescription; + @Value("${cipher.mono.substitution.explanation}") + private List substitutionExplanation; + @Value("${cipher.mono.substitution.facts}") + private List substitutionFacts; @GetMapping @@ -36,7 +42,7 @@ public class SubstitutionCipherController{ log.info("Getting info for {}", substitutionName); - return CipherInfoUtil.buildInfoNode(substitutionName, substitutionDescription); + return CipherInfoUtil.buildInfoNode(substitutionName, substitutionDescription, substitutionExplanation, substitutionFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherController.java index 41055e4..2cf7a1e 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class VigenereCipherController{ private String vigenereName; @Value("${cipher.mono.vigenere.description}") private String vigenereDescription; + @Value("${cipher.mono.vigenere.explanation}") + private List vigenereExplanation; + @Value("${cipher.mono.vigenere.facts}") + private List vigenereFacts; @GetMapping @@ -36,7 +42,7 @@ public class VigenereCipherController{ log.info("Getting info for {}", vigenereName); - return CipherInfoUtil.buildInfoNode(vigenereName, vigenereDescription); + return CipherInfoUtil.buildInfoNode(vigenereName, vigenereDescription, vigenereExplanation, vigenereFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherController.java index 8028ecd..463fbba 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class BifidCipherController{ private String bifidName; @Value("${cipher.poly.bifid.description}") private String bifidDescription; + @Value("${cipher.poly.bifid.explanation}") + private List bifidExplanation; + @Value("${cipher.poly.bifid.facts}") + private List bifidFacts; @GetMapping @@ -36,7 +42,7 @@ public class BifidCipherController{ log.info("Getting info for {}", bifidName); - return CipherInfoUtil.buildInfoNode(bifidName, bifidDescription); + return CipherInfoUtil.buildInfoNode(bifidName, bifidDescription, bifidExplanation, bifidFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherController.java index b7f44f1..57e79ee 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class ColumnarCipherController{ private String columnarName; @Value("${cipher.poly.columnar.description}") private String columnarDescription; + @Value("${cipher.poly.columnar.explanation}") + private List columnarExplanation; + @Value("${cipher.poly.columnar.facts}") + private List columnarFacts; @GetMapping @@ -36,7 +42,7 @@ public class ColumnarCipherController{ log.info("Getting info for {}", columnarName); - return CipherInfoUtil.buildInfoNode(columnarName, columnarDescription); + return CipherInfoUtil.buildInfoNode(columnarName, columnarDescription, columnarExplanation, columnarFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherController.java index 6505ebc..922d68e 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -30,6 +32,10 @@ public class HillCipherController{ private String hillName; @Value("${cipher.poly.hill.description}") private String hillDescription; + @Value("${cipher.poly.hill.explanation}") + private List hillExplanation; + @Value("${cipher.poly.hill.facts}") + private List hillFacts; @GetMapping @@ -38,7 +44,7 @@ public class HillCipherController{ log.info("Getting info for {}", hillName); - return CipherInfoUtil.buildInfoNode(hillName, hillDescription); + return CipherInfoUtil.buildInfoNode(hillName, hillDescription, hillExplanation, hillFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeController.java b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeController.java index ceb584e..fbeeec3 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class MorseCodeController{ private String morseName; @Value("${cipher.poly.morse.description}") private String morseDescription; + @Value("${cipher.poly.morse.explanation}") + private List morseExplanation; + @Value("${cipher.poly.morse.facts}") + private List morseFacts; @GetMapping @@ -36,7 +42,7 @@ public class MorseCodeController{ log.info("Getting info for {}", morseName); - return CipherInfoUtil.buildInfoNode(morseName, morseDescription); + return CipherInfoUtil.buildInfoNode(morseName, morseDescription, morseExplanation, morseFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherController.java index 1e9ffb3..e53ddae 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class PlayfairCipherController{ private String playfairName; @Value("${cipher.poly.playfair.description}") private String playfairDescription; + @Value("${cipher.poly.playfair.explanation}") + private List playfairExplanation; + @Value("${cipher.poly.playfair.facts}") + private List playfairFacts; @GetMapping @@ -36,7 +42,7 @@ public class PlayfairCipherController{ log.info("Getting info for {}", playfairName); - return CipherInfoUtil.buildInfoNode(playfairName, playfairDescription); + return CipherInfoUtil.buildInfoNode(playfairName, playfairDescription, playfairExplanation, playfairFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareController.java b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareController.java index 8f860b0..60c5819 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class PolybiusSquareController{ private String polybiusName; @Value("${cipher.poly.polybius.description}") private String polybiusDescription; + @Value("${cipher.poly.polybius.explanation}") + private List polybiusExplanation; + @Value("${cipher.poly.polybius.facts}") + private List polybiusFacts; @GetMapping @@ -36,7 +42,7 @@ public class PolybiusSquareController{ log.info("Getting info for {}", polybiusName); - return CipherInfoUtil.buildInfoNode(polybiusName, polybiusDescription); + return CipherInfoUtil.buildInfoNode(polybiusName, polybiusDescription, polybiusExplanation, polybiusFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceController.java b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceController.java index e0687d3..2e12101 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class RailFenceController{ private String railFenceName; @Value("${cipher.poly.railfence.description}") private String railFenceDescription; + @Value("${cipher.poly.railfence.explanation}") + private List railFenceExplanation; + @Value("${cipher.poly.railfence.facts}") + private List railFenceFacts; @GetMapping @@ -36,7 +42,7 @@ public class RailFenceController{ log.info("Getting info for {}", railFenceName); - return CipherInfoUtil.buildInfoNode(railFenceName, railFenceDescription); + return CipherInfoUtil.buildInfoNode(railFenceName, railFenceDescription, railFenceExplanation, railFenceFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherController.java b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherController.java index bdd6a4f..a4673b0 100644 --- a/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherController.java +++ b/src/main/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherController.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import java.util.List; + import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -28,6 +30,10 @@ public class TrifidCipherController{ private String trifidName; @Value("${cipher.poly.trifid.description}") private String trifidDescription; + @Value("${cipher.poly.trifid.explanation}") + private List trifidExplanation; + @Value("${cipher.poly.trifid.facts}") + private List trifidFacts; @GetMapping @@ -36,7 +42,7 @@ public class TrifidCipherController{ log.info("Getting info for {}", trifidName); - return CipherInfoUtil.buildInfoNode(trifidName, trifidDescription); + return CipherInfoUtil.buildInfoNode(trifidName, trifidDescription, trifidExplanation, trifidFacts); } @PostMapping("/encode") diff --git a/src/main/java/com/mattrixwv/cipherstream/utils/CipherInfoUtil.java b/src/main/java/com/mattrixwv/cipherstream/utils/CipherInfoUtil.java index 77e65a7..5a76e8b 100644 --- a/src/main/java/com/mattrixwv/cipherstream/utils/CipherInfoUtil.java +++ b/src/main/java/com/mattrixwv/cipherstream/utils/CipherInfoUtil.java @@ -1,6 +1,8 @@ package com.mattrixwv.cipherstream.utils; +import java.util.List; + import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -15,14 +17,18 @@ public class CipherInfoUtil{ //Parameters public static final String CIPHER_NAME = "name"; public static final String CIPHER_DESCRIPTION = "description"; + public static final String CIPHER_EXPLANATION = "explanation"; + public static final String CIPHER_FACTS = "facts"; - public static ObjectNode buildInfoNode(String name, String description){ + public static ObjectNode buildInfoNode(String name, String description, List explanation, List facts){ ObjectNode infoNode = mapper.createObjectNode(); infoNode.put(CIPHER_NAME, name); infoNode.put(CIPHER_DESCRIPTION, description); + infoNode.set(CIPHER_EXPLANATION, mapper.valueToTree(explanation)); + infoNode.set(CIPHER_FACTS, mapper.valueToTree(facts)); return infoNode; diff --git a/src/main/resources/ciphers.properties b/src/main/resources/ciphers.properties index af9e221..d85886a 100644 --- a/src/main/resources/ciphers.properties +++ b/src/main/resources/ciphers.properties @@ -1,7 +1,8 @@ #Mono-Substitution #Affine cipher.mono.affine.name=Affine -cipher.mono.affine.description=The Affine cipher is a monoalphabetic substitution cipher, where each letter in an alphabet is mapped to a numeric equivalent, encrypted, and then converted back to a letter. \ +cipher.mono.affine.description= +cipher.mono.affine.explanation=The Affine cipher is a monoalphabetic substitution cipher, where each letter in an alphabet is mapped to a numeric equivalent, encrypted, and then converted back to a letter. \ The formula used in this encryption is F(x) = (ax + b) % m, where x is the original letter, a and b are the keys of the cipher, and m is the length of the alphabet, with a and m being coprime.\ Decryption is performed using the formula F(x) = a^-1(x - b) % m.\ The Affine cipher is a relatively weak cipher compared to modern encryption methods because it's vulnerable to frequency analysis and other cryptanalysis techniques. However, it's simple to implement and understand, making it a good introduction to encryption concepts. @@ -9,7 +10,8 @@ cipher.mono.affine.facts= #Atbash cipher.mono.atbash.name=Atbash -cipher.mono.atbash.description=The Atbash cipher is a monoalphabetic substitution cipher and is one of the simplest and oldest forms of encryption. \ +cipher.mono.atbash.description= +cipher.mono.atbash.explanation=The Atbash cipher is a monoalphabetic substitution cipher and is one of the simplest and oldest forms of encryption. \ Encryption involves replacing each letter with its reverse counterpart. i.e. A becomes Z, B becomes Y, etc. \ Decryption is performed using the same formula as encryption. \ Atbash cipher can effectively obscure the meaning of a message to those unfamiliar with the technique. However, it's very vulnerable to cryptanalysis, especially frequency analysis, and it provides very little security against modern decryption techniques. @@ -18,7 +20,8 @@ The Atbash cipher is a special case of the Affine cipher with a = 25 and b = 25. #Autokey cipher.mono.autokey.name=Autokey -cipher.mono.autokey.description=The autokey cipher extends the Vigenere cipher. Like the Vigenere cipher it uses a keyword to encrypt plaintext, but it also incorporates the plaintext itself into the keystream. \ +cipher.mono.autokey.description= +cipher.mono.autokey.explanation=The autokey cipher extends the Vigenere cipher. Like the Vigenere cipher it uses a keyword to encrypt plaintext, but it also incorporates the plaintext itself into the keystream. \ Encryption works by concatenating the message to the keyword. Then you convert the resulting key into a series of numeric values mod 26. Then you advance each letter the indicated number of letters similar to the Caesar cipher. \ Decryption works by converting the key the same as encryption, but instead of advancing each letter the given amount the values retreat. As each letter is decrypted the letter needs added to the key as well as the output so that decryption can continue. \ The Autokey cipher is more secure than the Vigenere cipher due to the keyword including part of the text to be encoded. However, like the Vigenere cipher, the Autokey cipher is vulnerable to frequency analysis and other cryptanalysis techniques, especially if the keyword is short or if there are patterns in the plaintext. @@ -26,7 +29,8 @@ cipher.mono.autokey.facts= #Baconian cipher.mono.baconian.name=Baconian -cipher.mono.baconian.description=The Baconian cipher, also known as the Baconian alphabet or Bacon's cipher, is a type of substitution cipher used for encoding and decoding messages. \ +cipher.mono.baconian.description= +cipher.mono.baconian.explanation=The Baconian cipher, also known as the Baconian alphabet or Bacon's cipher, is a type of substitution cipher used for encoding and decoding messages. \ In the Baconian cipher, each letter of the alphabet is replaced by a sequence of five characters, consisting of 'A' and 'B'. \ These characters represent the binary encoding of the letter, where 'A' stands for one binary digit (usually 0) and 'B' stands for the other binary digit (usually 1). \ During encoding I and J are generally encoded as the same letter. \ @@ -37,12 +41,14 @@ cipher.mono.baconian.facts=It was developed by Sir Francis Bacon in the late 16t #TODO #Base X cipher.mono.basex.name=Base X -cipher.mono.basex.description=Base X is an abstraction for Base 2, Base 16, etc. Base X uses the integer values for each character and displays them in the desired base. +cipher.mono.basex.description= +cipher.mono.basex.explanation=Base X is an abstraction for Base 2, Base 16, etc. Base X uses the integer values for each character and displays them in the desired base. cipher.mono.basex.facts= #Beaufort cipher.mono.beaufort.name=Beaufort -cipher.mono.beaufort.description=The Beaufort cipher is a type of substitution cipher similar to the Vigenere cipher but with a different method of encryption. \ +cipher.mono.beaufort.description= +cipher.mono.beaufort.explanation=The Beaufort cipher is a type of substitution cipher similar to the Vigenere cipher but with a different method of encryption. \ In the Beaufort cipher, encryption and decryption are performed by using a keyword to determine the amount of backward displacement within the alphabet for each letter of the text, unlike the Vigenere cipher, where the key is added. \ The Beaufort cipher, like the Vigenere cipher, is vulnerable to frequency analysis and other cryptanalysis techniques, especially if the keyword is short or if there are patterns in the plaintext. \ However, it provides some variation in encryption compared to the Vigenere cipher, which may offer slightly different cryptographic properties. @@ -50,7 +56,8 @@ cipher.mono.beaufort.facts=It was named after Sir Francis Beaufort, an Irish hyd #Caesar cipher.mono.caesar.name=Caesar -cipher.mono.caesar.description=The Caesar cipher is one of the simplest and most widely known encryption techniques. It's a type of substitution cipher where each letter in the plaintext is shifted a certain number of places down or up the alphabet. \ +cipher.mono.caesar.description= +cipher.mono.caesar.explanation=The Caesar cipher is one of the simplest and most widely known encryption techniques. It's a type of substitution cipher where each letter in the plaintext is shifted a certain number of places down or up the alphabet. \ For encryption a shift value is used which determines how many letters forward each letter in the text should be shifted. \ Decryption uses the same shift, but shifts each letter down rather than up. \ The Caesar cipher is a special case of the substitution cipher with a fixed shift. While it's straightforward to implement and understand, it's also highly vulnerable to cryptanalysis, especially through frequency analysis. \ @@ -59,7 +66,8 @@ cipher.mono.caesar.facts=The Caesar cipher, named after Julius Caesar who is sai #One-Time Pad cipher.mono.onetimepad.name=One-Time Pad -cipher.mono.onetimepad.description=A One-Time Pad cipher is a type of encryption technique that provides perfect secrecy when used correctly. The essence of a One-Time Pad cipher lies in the use of a randomly generated key that is at least as long as the message being encrypted. \ +cipher.mono.onetimepad.description= +cipher.mono.onetimepad.explanation=A One-Time Pad cipher is a type of encryption technique that provides perfect secrecy when used correctly. The essence of a One-Time Pad cipher lies in the use of a randomly generated key that is at least as long as the message being encrypted. \ The key is never reused and is kept completely secret between the sender and the recipient. Each character of the plaintext message is combined with the corresponding bit or character of the key using a the same shift as the Caesar cipher. \ In a slightly less secure, but more practical key selection, the passage of a book can also be used. Preferably one with a good mix of many characters that would make frequency analysis more difficult. \ When these principles are followed, the One-Time Pad provides perfect secrecy, meaning that the ciphertext reveals no information about the plaintext, even when the attacker has unlimited computational power. However, achieving and maintaining these conditions in practice can be extremely challenging, which limits the practical use of the One-Time Pad cipher. @@ -67,7 +75,8 @@ cipher.mono.onetimepad.facts=It was invented independently by Gilbert Vernam in #Porta cipher.mono.porta.name=Porta -cipher.mono.porta.description=The Porta cipher, also known as the Porta square or Portax cipher, is a variant of the Vigenere cipher and shares some similarities with it. \ +cipher.mono.porta.description= +cipher.mono.porta.explanation=The Porta cipher, also known as the Porta square or Portax cipher, is a variant of the Vigenere cipher and shares some similarities with it. \ In the Porta cipher, encryption and decryption are performed using a keyword and a tabula recta or Porta square. The Porta square is a table that consists of 26 rows and 26 columns, where each row represents the alphabet shifted by a certain number of positions. \ The Porta square is constructed by shifting the letters of the alphabet by an amount determined by the keyword. \ Each row of the square represents a different shift of the alphabet, with the first row being shifted by 0 positions, the second row by 1 position, the third row by 2 positions, and so on until the last row, which is shifted by 25 positions. \ @@ -76,7 +85,8 @@ cipher.mono.porta.facts=It was invented by Giovanni Battista della Porta in the #Substitution cipher.mono.substitution.name=Substitution -cipher.mono.substitution.description=A substitution cipher is a method of encryption where each letter in the plaintext is replaced by another letter or symbol according to a predetermined set of rules. In other words, it substitutes each plaintext character with another character. \ +cipher.mono.substitution.description= +cipher.mono.substitution.explanation=A substitution cipher is a method of encryption where each letter in the plaintext is replaced by another letter or symbol according to a predetermined set of rules. In other words, it substitutes each plaintext character with another character. \ Substitution ciphers are among the simplest forms of encryption and have been used throughout history for secret communication. \ However, they are generally less secure compared to modern encryption techniques and are vulnerable to various cryptanalysis methods, such as frequency analysis, which exploits patterns in the ciphertext to reveal information about the plaintext. \ Despite their vulnerabilities, substitution ciphers are often used in educational settings to introduce basic concepts of cryptography. @@ -84,7 +94,8 @@ cipher.mono.substitution.facts= #Vigenere cipher.mono.vigenere.name=Vigenere -cipher.mono.vigenere.description=The Vigenere cipher adds more security compared to simple monoalphabetic substitution ciphers like the Caesar cipher. \ +cipher.mono.vigenere.description= +cipher.mono.vigenere.explanation=The Vigenere cipher adds more security compared to simple monoalphabetic substitution ciphers like the Caesar cipher. \ In the Vigenere cipher, encryption and decryption are performed using a keyword or keyphrase. The key is used to determine the shift applied to each letter in the plaintext, with different parts of the key determining different shifts. \ Decryption is performed by applying the reverse process. Given the ciphertext and the keyword, the original plaintext can be recovered. \ The Vigenere cipher provides stronger encryption compared to simple substitution ciphers because it uses multiple Caesar ciphers in a repeating pattern determined by the keyword. \ However, it is still vulnerable to frequency analysis and other cryptanalysis techniques, especially if the keyword is short or if there are patterns in the plaintext. \Despite its vulnerabilities, the Vigenere cipher was considered unbreakable for centuries and was widely used for secure communication. @@ -94,7 +105,8 @@ cipher.mono.vigenere.facts=It was invented by Giovan Battista Bellaso in the 16t #Poly-Substitution #Bifid cipher.poly.bifid.name=Bifid -cipher.poly.bifid.description=The Bifid cipher is a type of polyalphabetic substitution cipher that combines elements of both transposition and substitution. \ +cipher.poly.bifid.description= +cipher.poly.bifid.explanation=The Bifid cipher is a type of polyalphabetic substitution cipher that combines elements of both transposition and substitution. \ It was invented by Felix Delastelle in 1901 and was considered one of the strongest ciphers at the time due to its complexity. \ Encryption is done by creating a 5x5 grid, known as the Polybius square, is created. The letters of the alphabet (excluding 'J' in most cases) are arranged in the grid, typically starting with 'A' and ending with 'Z', omitting 'J'. \ Each letter of the plaintext is first converted into its corresponding row and column numbers in the grid. For example, the letter 'C' may correspond to the row 1, column 3. These numerical representations are then combined into pairs of numbers. \ @@ -107,7 +119,8 @@ cipher.poly.bifid.facts= #Columnar cipher.poly.columnar.name=Columnar -cipher.poly.columnar.description=The Columnar cipher, also known as the Columnar Transposition cipher, is a type of transposition cipher where the characters of the plaintext are rearranged according to a specific method based on the columns of a grid. \ +cipher.poly.columnar.description= +cipher.poly.columnar.explanation=The Columnar cipher, also known as the Columnar Transposition cipher, is a type of transposition cipher where the characters of the plaintext are rearranged according to a specific method based on the columns of a grid. \ Start by writing the plaintext message into a grid, row by row, with a fixed number of columns. The number of columns is determined by the key, which is a word or a sequence of letters chosen by the sender. \ Arrange the columns of the grid in alphabetical order based on the letters of the key. For example, if the key is "KEYWORD", arrange the columns of the grid in the order of the letters in "KEYWORD". \ Read the ciphertext from the grid by going column by column, starting with the column that corresponds to the first letter of the key, then the second letter of the key, and so on, until all columns have been read. \ @@ -116,7 +129,8 @@ cipher.poly.columnar.facts= #Hill cipher.poly.hill.name=Hill -cipher.poly.hill.description=The Hill cipher is a type of polygraphic substitution cipher based on linear algebra and is one of the earliest known examples of a block cipher. The Hill cipher operates on blocks of plaintext letters and uses matrix multiplication to encrypt and decrypt messages. \ +cipher.poly.hill.description= +cipher.poly.hill.explanation=The Hill cipher is a type of polygraphic substitution cipher based on linear algebra and is one of the earliest known examples of a block cipher. The Hill cipher operates on blocks of plaintext letters and uses matrix multiplication to encrypt and decrypt messages. \ The encryption key in the Hill cipher is a square matrix called the encryption matrix. The size of the matrix (i.e., the number of rows and columns) depends on the key length and the block size of the plaintext. The determinant of the encryption matrix must be relatively prime to the size of the alphabet used (typically 26 for English text) to ensure that the encryption matrix is invertible. \ To encrypt a message, the plaintext is divided into blocks of letters, each block matching the size of the encryption matrix. Each block is then represented as a column vector, with each element of the vector representing the numerical value of a letter in the plaintext. The encryption matrix is multiplied by each column vector of plaintext letters modulo the size of the alphabet. The resulting matrix of encrypted numerical values is then converted back into ciphertext letters. \ Decryption is performed by multiplying the ciphertext column vectors by the inverse of the encryption matrix modulo the size of the alphabet. The resulting numerical values are converted back into plaintext letters. \ @@ -126,14 +140,16 @@ cipher.poly.hill.facts=It was invented by Lester S. Hill in 1929. #Morse cipher.poly.morse.name=Morse Code -cipher.poly.morse.description=Morse code is a method of transmitting text information as a series of on-off tones, lights, or clicks. Morse code encodes characters (letters, numbers, and punctuation) as sequences of dots (short signals) and dashes (long signals) arranged in specific patterns. \ +cipher.poly.morse.description= +cipher.poly.morse.explanation=Morse code is a method of transmitting text information as a series of on-off tones, lights, or clicks. Morse code encodes characters (letters, numbers, and punctuation) as sequences of dots (short signals) and dashes (long signals) arranged in specific patterns. \ The basic elemens of Morse Code are dots and dashes. Each letter, number, or punctuation mark is represented by a unique combination of dots and dashes. Numbers and punctuation marks also have their own Morse code representations. \ Morse code has been widely used in various forms of communication, including telegraphy, radio communication, aviation, and navigation. Despite advances in technology, Morse code remains relevant today, particularly in emergency communication, amateur radio, and certain military applications. It is also used by some individuals for its simplicity and effectiveness in situations where other forms of communication may be unreliable or unavailable. cipher.poly.morse.facts=It was developed in the early 19th century by Samuel Morse and Alfred Vail as a means of long-distance communication using telegraphy. #Playfair cipher.poly.playfair.name=Playfair -cipher.poly.playfair.description=The Playfair cipher is a type of digraph substitution cipher. It was used for secure communication in the early days of telegraphy. \ +cipher.poly.playfair.description= +cipher.poly.playfair.explanation=The Playfair cipher is a type of digraph substitution cipher. It was used for secure communication in the early days of telegraphy. \ To encode start with a 5x5 grid, known as the Playfair square. The letters of the alphabet (usually excluding 'J', which is combined with 'I') are written into the grid in order, omitting any duplicates. Choose a keyword or keyphrase and use it to fill in the rest of the grid, omitting any duplicate letters. \ To encrypt a message, split the plaintext into pairs of letters (digraphs). If the pair consists of two identical letters, insert a filler letter (often 'X') between them. For each digraph, apply the following rules:\n\ If both letters are in the same row of the grid, replace each letter with the letter to its right (wrapping around to the beginning of the row if necessary).\n\ @@ -146,7 +162,8 @@ cipher.poly.playfair.facts=It was invented by Charles Wheatstone and popularized #Polybius cipher.poly.polybius.name=Polybius -cipher.poly.polybius.description=The Polybius Square cipher, also known as the Polybius checkerboard, is a method of encryption that replaces pairs of letters with coordinates from a grid. \ +cipher.poly.polybius.description= +cipher.poly.polybius.explanation=The Polybius Square cipher, also known as the Polybius checkerboard, is a method of encryption that replaces pairs of letters with coordinates from a grid. \ The cipher typically uses a 5x5 grid, with the letters of the alphabet (usually excluding 'J') arranged within it. Each letter is represented by its row and column coordinates in the grid. For example, if 'A' is in the first row and first column, it could be represented as "11", and if 'B' is in the first row and second column, it could be represented as "12". \ In this grid, each letter is represented by its row and column coordinates. For instance, 'A' is at coordinates (1,1), so it's encoded as "11", 'B' is at (1,2), so it's encoded as "12", and so on. \ To encrypt a message using the Polybius Square cipher, each letter is first located in the grid, and then its coordinates are noted down. These coordinates form the encrypted message. To decrypt the message, the process is reversed: each pair of coordinates is converted back into the corresponding letter from the grid. \ @@ -155,7 +172,8 @@ cipher.poly.polybius.facts= It was named after the ancient Greek historian Polyb #Rail Fence cipher.poly.railfence.name=Rail Fence -cipher.poly.railfence.description=The Rail Fence cipher is a transposition cipher that works by writing the plaintext in a zigzag pattern across a number of "rails" or "fences," and then reading off the ciphertext from the pattern formed by the rails. \ +cipher.poly.railfence.description= +cipher.poly.railfence.explanation=The Rail Fence cipher is a transposition cipher that works by writing the plaintext in a zigzag pattern across a number of "rails" or "fences," and then reading off the ciphertext from the pattern formed by the rails. \ We first write the message in a zigzag pattern across 3 "rails." Then we read off the ciphertext by concatenating the characters from each rail. So, "HELLO WORLD" is encrypted to "HOLL ELWRLOL" using the Rail Fence cipher with 3 rails. \ To decrypt a Rail Fence ciphertext, the process is reversed. Write the ciphertext in a zigzag pattern across the rails. Read off the plaintext from the pattern formed by the rails. \ The Rail Fence cipher is relatively easy to implement and understand, but it's not very secure against modern cryptanalysis techniques. It's often used as a teaching tool rather than for serious encryption. @@ -163,7 +181,8 @@ cipher.poly.railfence.facts= #Trifid cipher.poly.trifid.name=Trifid -cipher.poly.trifid.description=The trifid cipher is a polygraphic substitution cipher and is an extention of the Bifid cipher. \ +cipher.poly.trifid.description= +cipher.poly.trifid.explanation=The trifid cipher is a polygraphic substitution cipher and is an extention of the Bifid cipher. \ To encode, a key matrix is generated, typically a permutation of the alphabet plus some additional symbols. Each letter of the plaintext is converted into its corresponding coordinates in the 3x3x3 grid. For example, if the letter is 'A', it could be represented as (1,1,1). \ The coordinates are then rearranged according to the key matrix and teh plaintext coordinate is (1,1,1), in might be rearranged to 2,3,1 based on the position of 'A' in the key matrix. The rearranged coordinates are converted back into letters. \ The process is reversed. The ciphertext is first converted into coordinates, rearranged back using the key matrix, and then converted back into plaintext. \ @@ -174,7 +193,8 @@ cipher.poly.trifid.facts=It was invented by Felix Delastelle in 1901. #Combination #ADFGVX cipher.combination.adfgvx.name=ADFGVX -cipher.combination.adfgvx.description=The ADFGVX cipher is a fractionating transposition cipher and was named after the six letters used in the cipher. \ +cipher.combination.adfgvx.description= +cipher.combination.adfgvx.explanation=The ADFGVX cipher is a fractionating transposition cipher and was named after the six letters used in the cipher. \ This cipher was notable for its use of a 6x6 grid to encode letters, making it more complex than many other ciphers of its time. \ To encode a 6x6 grid, usually called the Polybius square, is created. The rows and columns are labeled with the letters A, D, F, G, V, and X. \ Each letter of the plaintext is replaced with its corresponding pair of letters from the grid. For example, if the letter 'C' corresponds to 'FD', then 'C' is replaced with 'FD' in the ciphertext. \ @@ -187,7 +207,8 @@ It was used extensively by the German Army during World War I for secure communi #ADFGX cipher.combination.adfgx.name=ADFGX -cipher.combination.adfgx.description=The ADFGX cipher is a variant of the ADFGVX cipher. Both the ADFGX and ADFGVX ciphers are similar in structure and operation, but the ADFGX cipher uses a 5x5 grid instead of a 6x6 grid. \ +cipher.combination.adfgx.description= +cipher.combination.adfgx.explanation=The ADFGX cipher is a variant of the ADFGVX cipher. Both the ADFGX and ADFGVX ciphers are similar in structure and operation, but the ADFGX cipher uses a 5x5 grid instead of a 6x6 grid. \ A 5x5 grid, usually called the Polybius square, is created. The rows and columns are labeled with the letters A, D, F, G, and X. \ Each letter of the plaintext is replaced with its corresponding pair of letters from the grid. For example, if the letter 'C' corresponds to 'DG', then 'C' is replaced with 'DG' in the ciphertext. \ The resulting fractionated ciphertext is then encrypted using a keyword or keyphrase, similar to the ADFGVX cipher. This typically involves a transposition step, such as columnar transposition, to rearrange the letters of the fractionated ciphertext. \ diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherControllerIntegrationTest.java index 4257de9..70e7780 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.combination; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -42,6 +45,8 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle private static final String squareKeyword = "SquareKeyword"; private static final String adfgvxName = "adfgvxName"; private static final String adfgvxDescription = "adfgvxDescription"; + private static final List adfgvxExplanation = List.of("adfgvxExplanation1", "adfgvxExplanation2", "adfgvxExplanation3"); + private static final List adfgvxFacts = List.of("adfgvxFact1", "adfgvxFact2", "adfgvxFact3"); @BeforeEach @@ -66,6 +71,8 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxName", adfgvxName); ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxDescription", adfgvxDescription); + ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxExplanation", adfgvxExplanation); + ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxFacts", adfgvxFacts); } @@ -77,7 +84,13 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(adfgvxName)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(adfgvxDescription)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(adfgvxDescription)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(adfgvxExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(adfgvxExplanation.get(0), adfgvxExplanation.get(1), adfgvxExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(adfgvxFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(adfgvxFacts.get(0), adfgvxFacts.get(1), adfgvxFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherControllerTest.java index b2ed9ff..07c8571 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgvxCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.combination; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -32,17 +34,21 @@ public class AdfgvxCipherControllerTest{ private static final String OUTPUT_STRING = "AXgvdavfxgagfa afag-aaxdxfgdagda"; private static final String adfgvxName = "adfgvxName"; private static final String adfgvxDescription = "adfgvxDescription"; + private static final List adfgvxExplanation = List.of("adfgvxExplanation1", "adfgvxExplanation2", "adfgvxExplanation3"); + private static final List adfgvxFacts = List.of("adfgvxFact1", "adfgvxFact2", "adfgvxFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxName", adfgvxName); ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxDescription", adfgvxDescription); + ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxExplanation", adfgvxExplanation); + ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxFacts", adfgvxFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgvxName, adfgvxDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgvxName, adfgvxDescription, adfgvxExplanation, adfgvxFacts); ObjectNode returnedJson = adfgvxCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherControllerIntegrationTest.java index 4010179..44d6b70 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.combination; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -42,6 +45,8 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController private static final String squareKeyword = "SquareKeyword"; private static final String adfgxName = "adfgxName"; private static final String adfgxDescription = "adfgxDescription"; + private static final List adfgxExplanation = List.of("adfgxExplanation1", "adfgxExplanation2", "adfgxExplanation3"); + private static final List adfgxFacts = List.of("adfgxFact1", "adfgxFact2", "adfgxFact3"); @BeforeEach @@ -66,6 +71,8 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController ReflectionTestUtils.setField(adfgxCipherController, "adfgxName", adfgxName); ReflectionTestUtils.setField(adfgxCipherController, "adfgxDescription", adfgxDescription); + ReflectionTestUtils.setField(adfgxCipherController, "adfgxExplanation", adfgxExplanation); + ReflectionTestUtils.setField(adfgxCipherController, "adfgxFacts", adfgxFacts); } @@ -77,7 +84,13 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(adfgxName)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(adfgxDescription)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(adfgxDescription)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(adfgxExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(adfgxExplanation.get(0), adfgxExplanation.get(1), adfgxExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(adfgxFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(adfgxFacts.get(0), adfgxFacts.get(1), adfgxFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherControllerTest.java index 451f682..a0d9d9a 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/combination/AdfgxCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.combination; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -32,17 +34,21 @@ public class AdfgxCipherControllerTest{ private static final String ADFGX_OUTPUT_STRING = "AAgagadfagaxxd axdx^adafafxddgdf"; private static final String adfgxName = "adfgxName"; private static final String adfgxDescription = "adfgxDescription"; + private static final List adfgxExplanation = List.of("adfgxExplanation1", "adfgxExplanation2", "adfgxExplanation3"); + private static final List adfgxFacts = List.of("adfgxFact1", "adfgxFact2", "adfgxFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(adfgxCipherController, "adfgxName", adfgxName); ReflectionTestUtils.setField(adfgxCipherController, "adfgxDescription", adfgxDescription); + ReflectionTestUtils.setField(adfgxCipherController, "adfgxExplanation", adfgxExplanation); + ReflectionTestUtils.setField(adfgxCipherController, "adfgxFacts", adfgxFacts); } @Test public void testGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgxName, adfgxDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgxName, adfgxDescription, adfgxExplanation, adfgxFacts); ObjectNode returnedJson = adfgxCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherControllerIntegrationTest.java index 232935a..de33e6e 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -34,6 +37,7 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle @Mock(name = "com.mattrixwv.cipherstream.controller.monosubstitution.AffineCipherController") private Logger affineLogger; //Fields + private static final ObjectNode blankNode = mapper.createObjectNode(); private static final String url = "/affine"; private static final String decodedString = "Message to^encode"; private static final String encodedString = "Pbtthlb yz^burzwb"; @@ -41,7 +45,8 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle private static final int key2 = 7; private static final String affineName = "affineCipherName"; private static final String affineDescription = "affineCipherDescription"; - private static final ObjectNode blankNode = mapper.createObjectNode(); + private static final List affineExplanation = List.of("affineExplanation1", "affineExplanation2", "affineExplanation3"); + private static final List affineFacts = List.of("affineFact1", "affineFact2", "affineFact3"); @BeforeEach @@ -66,6 +71,8 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle ReflectionTestUtils.setField(affineCipherController, "affineName", affineName); ReflectionTestUtils.setField(affineCipherController, "affineDescription", affineDescription); + ReflectionTestUtils.setField(affineCipherController, "affineExplanation", affineExplanation); + ReflectionTestUtils.setField(affineCipherController, "affineFacts", affineFacts); } @@ -77,7 +84,13 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(affineDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(affineName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(affineName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(affineExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(affineExplanation.get(0), affineExplanation.get(1), affineExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(affineFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(affineFacts.get(0), affineFacts.get(1), affineFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherControllerTest.java index fa934be..343c4b7 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AffineCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -32,17 +34,21 @@ public class AffineCipherControllerTest{ private static final ObjectNode blankNode = mapper.createObjectNode(); private static final String affineName = "affineCipherName"; private static final String affineDescription = "affineCipherDescription"; + private static final List affineExplanation = List.of("affineExplanation1", "affineExplanation2", "affineExplanation3"); + private static final List affineFacts = List.of("affineFact1", "affineFact2", "affineFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(affineCipherController, "affineName", affineName); ReflectionTestUtils.setField(affineCipherController, "affineDescription", affineDescription); + ReflectionTestUtils.setField(affineCipherController, "affineExplanation", affineExplanation); + ReflectionTestUtils.setField(affineCipherController, "affineFacts", affineFacts); } @Test public void testGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(affineName, affineDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(affineName, affineDescription, affineExplanation, affineFacts); ObjectNode returnedJson = affineCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherControllerIntegrationTest.java index d8767bd..b7e4a13 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -29,7 +32,7 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle @Autowired private MockMvc mockMvc; @Autowired - private AtbashCipherController atbashController; + private AtbashCipherController atbashCipherController; //Loggers @Mock(name = "com.mattrixwv.cipherstream.controller.monosubstitution.AtbashCipherController") protected Logger atbashLogger; @@ -40,6 +43,8 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle private static final String encodedString = "Nvhhztv gl^vmxlwv"; private static final String atbashName = "atbashName"; private static final String atbashDescription = "atbashDescription"; + private static final List atbashExplanation = List.of("atbashExplanation1", "atbashExplanation2", "atbashExplanation3"); + private static final List atbashFacts = List.of("atbashFact1", "atbashFact2", "atbashFact3"); @BeforeEach @@ -58,8 +63,10 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle encodedNode.put(CipherParameterUtil.INPUT_STRING, encodedString); encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString); - ReflectionTestUtils.setField(atbashController, "atbashName", atbashName); - ReflectionTestUtils.setField(atbashController, "atbashDescription", atbashDescription); + ReflectionTestUtils.setField(atbashCipherController, "atbashName", atbashName); + ReflectionTestUtils.setField(atbashCipherController, "atbashDescription", atbashDescription); + ReflectionTestUtils.setField(atbashCipherController, "atbashExplanation", atbashExplanation); + ReflectionTestUtils.setField(atbashCipherController, "atbashFacts", atbashFacts); } @@ -71,7 +78,13 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(atbashDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(atbashName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(atbashName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(atbashExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(atbashExplanation.get(0), atbashExplanation.get(1), atbashExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(atbashFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(atbashFacts.get(0), atbashFacts.get(1), atbashFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherControllerTest.java index cc5750c..4ba78d1 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AtbashCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -14,6 +16,7 @@ import org.springframework.test.util.ReflectionTestUtils; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.mattrixwv.cipherstream.exception.InvalidCipherParameterException; +import com.mattrixwv.cipherstream.utils.CipherInfoUtil; import com.mattrixwv.cipherstream.utils.CipherParameterUtil; @@ -29,12 +32,28 @@ public class AtbashCipherControllerTest{ private static final String ATBASH_OUTPUT_STRING = "Nvhhztv gl^vmxlwv"; private static final String atbashName = "atbashName"; private static final String atbashDescription = "atbashDescription"; + private static final List atbashExplanation = List.of("atbashExplanation1", "atbashExplanation2", "atbashExplanation3"); + private static final List atbashFacts = List.of("atbashFact1", "atbashFact2", "atbashFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(atbashCipherController, "atbashName", atbashName); ReflectionTestUtils.setField(atbashCipherController, "atbashDescription", atbashDescription); + ReflectionTestUtils.setField(atbashCipherController, "atbashExplanation", atbashExplanation); + ReflectionTestUtils.setField(atbashCipherController, "atbashFacts", atbashFacts); + } + + + @Test + public void testGetCipherInfo(){ + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(atbashName, atbashDescription, atbashExplanation, atbashFacts); + + + ObjectNode returnedJson = atbashCipherController.getCipherInfo(); + + + assertEquals(infoNode, returnedJson); } @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherControllerIntegrationTest.java index 22b9626..8268b2a 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll private static final String keyword = "keyword"; private static final String autokeyName = "autokeyName"; private static final String autokeyDescription = "autokeyDescription"; + private static final List autokeyExplanation = List.of("autokeyExplanation1", "autokeyExplanation2", "autokeyExplanation3"); + private static final List autokeyFacts = List.of("autokeyFact1", "autokeyFact2", "autokeyFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll ReflectionTestUtils.setField(autokeyCipherController, "autokeyName", autokeyName); ReflectionTestUtils.setField(autokeyCipherController, "autokeyDescription", autokeyDescription); + ReflectionTestUtils.setField(autokeyCipherController, "autokeyExplanation", autokeyExplanation); + ReflectionTestUtils.setField(autokeyCipherController, "autokeyFacts", autokeyFacts); } @@ -74,7 +81,13 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(autokeyDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(autokeyName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(autokeyName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(autokeyExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(autokeyExplanation.get(0), autokeyExplanation.get(1), autokeyExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(autokeyFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(autokeyFacts.get(0), autokeyFacts.get(1), autokeyFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherControllerTest.java index bd7e9f8..89e42d0 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/AutokeyCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,17 +33,21 @@ public class AutokeyCipherControllerTest{ private static final String AUTOKEY_KEYWORD = CipherParameterUtil.KEYWORD; private static final String autokeyName = "autokeyName"; private static final String autokeyDescription = "autokeyDescription"; + private static final List autokeyExplanation = List.of("autokeyExplanation1", "autokeyExplanation2", "autokeyExplanation3"); + private static final List autokeyFacts = List.of("autokeyFact1", "autokeyFact2", "autokeyFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(autokeyCipherController, "autokeyName", autokeyName); ReflectionTestUtils.setField(autokeyCipherController, "autokeyDescription", autokeyDescription); + ReflectionTestUtils.setField(autokeyCipherController, "autokeyExplanation", autokeyExplanation); + ReflectionTestUtils.setField(autokeyCipherController, "autokeyFacts", autokeyFacts); } @Test public void testGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(autokeyName, autokeyDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(autokeyName, autokeyDescription, autokeyExplanation, autokeyFacts); ObjectNode returnedJson = autokeyCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherControllerIntegrationTest.java index ce19702..339bada 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -40,6 +43,8 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl private static final ObjectNode blankNode = mapper.createObjectNode(); private static final String baconianName = "baconianName"; private static final String baconianDescription = "baconianDescription"; + private static final List baconianExplanation = List.of("baconianExplanation1", "baconianExplanation2", "baconianExplanation3"); + private static final List baconianFacts = List.of("baconianFact1", "baconianFact2", "baconianFact3"); @BeforeEach @@ -60,6 +65,8 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl ReflectionTestUtils.setField(baconianCipherController, "baconianName", baconianName); ReflectionTestUtils.setField(baconianCipherController, "baconianDescription", baconianDescription); + ReflectionTestUtils.setField(baconianCipherController, "baconianExplanation", baconianExplanation); + ReflectionTestUtils.setField(baconianCipherController, "baconianFacts", baconianFacts); } @@ -71,7 +78,13 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(baconianDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(baconianName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(baconianName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(baconianExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(baconianExplanation.get(0), baconianExplanation.get(1), baconianExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(baconianFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(baconianFacts.get(0), baconianFacts.get(1), baconianFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherControllerTest.java index 491f193..1f99f4e 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaconianCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,18 +33,22 @@ public class BaconianCipherControllerTest{ private static final ObjectNode blankNode = mapper.createObjectNode(); private static final String baconianName = "baconianName"; private static final String baconianDescription = "baconianDescription"; + private static final List baconianExplanation = List.of("baconianExplanation1", "baconianExplanation2", "baconianExplanation3"); + private static final List baconianFacts = List.of("baconianFact1", "baconianFact2", "baconianFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(baconianCipherController, "baconianName", baconianName); ReflectionTestUtils.setField(baconianCipherController, "baconianDescription", baconianDescription); + ReflectionTestUtils.setField(baconianCipherController, "baconianExplanation", baconianExplanation); + ReflectionTestUtils.setField(baconianCipherController, "baconianFacts", baconianFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(baconianName, baconianDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(baconianName, baconianDescription, baconianExplanation, baconianFacts); ObjectNode returnedJson = baconianCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherControllerIntegrationTest.java index 965f68a..3f736b4 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController private static final int base = 2; private static final String baseXName = "baseXName"; private static final String baseXDescription = "baseXDescription"; + private static final List baseXExplanation = List.of("baseXExplanation1", "baseXExplanation2", "baseXExplanation3"); + private static final List baseXFacts = List.of("baseXFact1", "baseXFact2", "baseXFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController ReflectionTestUtils.setField(baseXCipherController, "baseXName", baseXName); ReflectionTestUtils.setField(baseXCipherController, "baseXDescription", baseXDescription); + ReflectionTestUtils.setField(baseXCipherController, "baseXExplanation", baseXExplanation); + ReflectionTestUtils.setField(baseXCipherController, "baseXFacts", baseXFacts); } @@ -74,7 +81,13 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(baseXDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(baseXName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(baseXName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(baseXExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(baseXExplanation.get(0), baseXExplanation.get(1), baseXExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(baseXFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(baseXFacts.get(0), baseXFacts.get(1), baseXFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherControllerTest.java index e747414..e5fdc13 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BaseXCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,17 +33,21 @@ public class BaseXCipherControllerTest{ private static final String BASE_X_OUTPUT_STRING = "1000001 101011 1000010 1000000 1000011 100000 1100100 1001 1100101 1010 1100110"; private static final String baseXName = "baseXName"; private static final String baseXDescription = "baseXDescription"; + private static final List baseXExplanation = List.of("baseXExplanation1", "baseXExplanation2", "baseXExplanation3"); + private static final List baseXFacts = List.of("baseXFact1", "baseXFact2", "baseXFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(baseXCipherController, "baseXName", baseXName); ReflectionTestUtils.setField(baseXCipherController, "baseXDescription", baseXDescription); + ReflectionTestUtils.setField(baseXCipherController, "baseXExplanation", baseXExplanation); + ReflectionTestUtils.setField(baseXCipherController, "baseXFacts", baseXFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(baseXName, baseXDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(baseXName, baseXDescription, baseXExplanation, baseXFacts); ObjectNode returnedJson = baseXCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherControllerIntegrationTest.java index 5802859..6be6ae6 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl private static final ObjectNode blankNode = mapper.createObjectNode(); private static final String beaufortName = "beaufortName"; private static final String beaufortDescription = "beaufortDescription"; + private static final List beaufortExplanation = List.of("beaufortExplanation1", "beaufortExplanation2", "beaufortExplanation3"); + private static final List beaufortFacts = List.of("beaufortFact1", "beaufortFact2", "beaufortFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl ReflectionTestUtils.setField(beaufortCipherController, "beaufortName", beaufortName); ReflectionTestUtils.setField(beaufortCipherController, "beaufortDescription", beaufortDescription); + ReflectionTestUtils.setField(beaufortCipherController, "beaufortExplanation", beaufortExplanation); + ReflectionTestUtils.setField(beaufortCipherController, "beaufortFacts", beaufortFacts); } @@ -74,7 +81,13 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(beaufortDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(beaufortName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(beaufortName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(beaufortExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(beaufortExplanation.get(0), beaufortExplanation.get(1), beaufortExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(beaufortFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(beaufortFacts.get(0), beaufortFacts.get(1), beaufortFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherControllerTest.java index 849704b..9726fb3 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/BeaufortCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,17 +33,21 @@ public class BeaufortCipherControllerTest{ private static final ObjectNode blankNode = mapper.createObjectNode(); private static final String beaufortName = "beaufortName"; private static final String beaufortDescription = "beaufortDescription"; + private static final List beaufortExplanation = List.of("beaufortExplanation1", "beaufortExplanation2", "beaufortExplanation3"); + private static final List beaufortFacts = List.of("beaufortFact1", "beaufortFact2", "beaufortFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(beaufortCipherController, "beaufortName", beaufortName); ReflectionTestUtils.setField(beaufortCipherController, "beaufortDescription", beaufortDescription); + ReflectionTestUtils.setField(beaufortCipherController, "beaufortExplanation", beaufortExplanation); + ReflectionTestUtils.setField(beaufortCipherController, "beaufortFacts", beaufortFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(beaufortName, beaufortDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(beaufortName, beaufortDescription, beaufortExplanation, beaufortFacts); ObjectNode returnedJson = beaufortCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherControllerIntegrationTest.java index 6455238..5848d7f 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle private static final int shiftAmount = 23; private static final String caesarName = "caesarName"; private static final String caesarDescription = "caesarDescription"; + private static final List caesarExplanation = List.of("caesarExplanation1", "caesarExplanation2", "caesarExplanation3"); + private static final List caesarFacts = List.of("caesarFact1", "caesarFact2", "caesarFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle ReflectionTestUtils.setField(caesarCipherController, "caesarName", caesarName); ReflectionTestUtils.setField(caesarCipherController, "caesarDescription", caesarDescription); + ReflectionTestUtils.setField(caesarCipherController, "caesarExplanation", caesarExplanation); + ReflectionTestUtils.setField(caesarCipherController, "caesarFacts", caesarFacts); } @@ -74,7 +81,13 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(caesarDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(caesarName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(caesarName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(caesarExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(caesarExplanation.get(0), caesarExplanation.get(1), caesarExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(caesarFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(caesarFacts.get(0), caesarFacts.get(1), caesarFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherControllerTest.java index beaa67d..2f1d188 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/CaesarCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,17 +33,21 @@ public class CaesarCipherControllerTest{ private static final ObjectNode blankNode = mapper.createObjectNode(); private static final String caesarName = "caesarName"; private static final String caesarDescription = "caesarDescription"; + private static final List caesarExplanation = List.of("caesarExplanation1", "caesarExplanation2", "caesarExplanation3"); + private static final List caesarFacts = List.of("caesarFact1", "caesarFact2", "caesarFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(caesarCipherController, "caesarName", caesarName); ReflectionTestUtils.setField(caesarCipherController, "caesarDescription", caesarDescription); + ReflectionTestUtils.setField(caesarCipherController, "caesarExplanation", caesarExplanation); + ReflectionTestUtils.setField(caesarCipherController, "caesarFacts", caesarFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(caesarName, caesarDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(caesarName, caesarDescription, caesarExplanation, caesarFacts); ObjectNode returnedJson = caesarCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherControllerIntegrationTest.java index fffc21b..cb500cc 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr private static final String keyword = "keywordThatIsTotallyRandom"; private static final String oneTimePadName = "oneTimePadName"; private static final String oneTimePadDescription = "oneTimePadDescription"; + private static final List oneTimePadExplanation = List.of("oneTimePadExplanation1", "oneTimePadExplanation2", "oneTimePadExplanation3"); + private static final List oneTimePadFacts = List.of("oneTimePadFact1", "oneTimePadFact2", "oneTimePadFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadName", oneTimePadName); ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadDescription", oneTimePadDescription); + ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadExplanation", oneTimePadExplanation); + ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadFacts", oneTimePadFacts); } @@ -74,7 +81,13 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(oneTimePadDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(oneTimePadName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(oneTimePadName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(oneTimePadExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(oneTimePadExplanation.get(0), oneTimePadExplanation.get(1), oneTimePadExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(oneTimePadFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(oneTimePadFacts.get(0), oneTimePadFacts.get(1), oneTimePadFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherControllerTest.java index c0c08a5..de8c6ed 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/OneTimePadCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,17 +33,21 @@ public class OneTimePadCipherControllerTest{ private static final String ONE_TIME_PAD_OUTPUT_STRING = "Wiqooxh mv^egkgws"; private static final String oneTimePadName = "oneTimePadName"; private static final String oneTimePadDescription = "oneTimePadDescription"; + private static final List oneTimePadExplanation = List.of("oneTimePadExplanation1", "oneTimePadExplanation2", "oneTimePadExplanation3"); + private static final List oneTimePadFacts = List.of("oneTimePadFact1", "oneTimePadFact2", "oneTimePadFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadName", oneTimePadName); ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadDescription", oneTimePadDescription); + ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadExplanation", oneTimePadExplanation); + ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadFacts", oneTimePadFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(oneTimePadName, oneTimePadDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(oneTimePadName, oneTimePadDescription, oneTimePadExplanation, oneTimePadFacts); ObjectNode returnedJson = oneTimePadCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherControllerIntegrationTest.java index 3240450..4243695 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherControllerIntegrationTest.java @@ -1,11 +1,14 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -42,6 +45,8 @@ public class PortaCipherControllerIntegrationTest extends CipherStreamController private static final String keyword = "keyword"; private static final String portaName = "portaName"; private static final String portaDescription = "portaDescription"; + private static final List portaExplanation = List.of("portaExplanation1", "portaExplanation2", "portaExplanation3"); + private static final List portaFacts = List.of("portaFact1", "portaFact2", "portaFact3"); @BeforeEach @@ -64,6 +69,8 @@ public class PortaCipherControllerIntegrationTest extends CipherStreamController ReflectionTestUtils.setField(portaCipherController, "portaName", portaName); ReflectionTestUtils.setField(portaCipherController, "portaDescription", portaDescription); + ReflectionTestUtils.setField(portaCipherController, "portaExplanation", portaExplanation); + ReflectionTestUtils.setField(portaCipherController, "portaFacts", portaFacts); } @@ -75,7 +82,13 @@ public class PortaCipherControllerIntegrationTest extends CipherStreamController .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(portaDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(portaName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(portaName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(portaExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(portaExplanation.get(0), portaExplanation.get(1), portaExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(portaFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(portaFacts.get(0), portaFacts.get(1), portaFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherControllerTest.java index e0bda52..9e80cca 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/PortaCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,17 +33,21 @@ public class PortaCipherControllerTest{ private static final String PORTA_OUTPUT_STRING = "Rtghuos bm^qcwgrw"; private static final String portaName = "portaName"; private static final String portaDescription = "portaDescription"; + private static final List portaExplanation = List.of("portaExplanation1", "portaExplanation2", "portaExplanation3"); + private static final List portaFacts = List.of("portaFact1", "portaFact2", "portaFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(portaCipherController, "portaName", portaName); ReflectionTestUtils.setField(portaCipherController, "portaDescription", portaDescription); + ReflectionTestUtils.setField(portaCipherController, "portaExplanation", portaExplanation); + ReflectionTestUtils.setField(portaCipherController, "portaFacts", portaFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(portaName, portaDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(portaName, portaDescription, portaExplanation, portaFacts); ObjectNode returnedJson = portaCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherControllerIntegrationTest.java index c1e1dd4..00e2282 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon private static final String keyword = "cdefghijklmnopqrstuvwxyzab"; private static final String substitutionName = "substitutionName"; private static final String substitutionDescription = "substitutionDescription"; + private static final List substitutionExplanation = List.of("substitutionExplanation1", "substitutionExplanation2", "substitutionExplanation3"); + private static final List substitutionFacts = List.of("substitutionFact1", "substitutionFact2", "substitutionFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon ReflectionTestUtils.setField(substitutionCipherController, "substitutionName", substitutionName); ReflectionTestUtils.setField(substitutionCipherController, "substitutionDescription", substitutionDescription); + ReflectionTestUtils.setField(substitutionCipherController, "substitutionExplanation", substitutionExplanation); + ReflectionTestUtils.setField(substitutionCipherController, "substitutionFacts", substitutionFacts); } @@ -74,7 +81,13 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(substitutionDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(substitutionName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(substitutionName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(substitutionExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(substitutionExplanation.get(0), substitutionExplanation.get(1), substitutionExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(substitutionFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(substitutionFacts.get(0), substitutionFacts.get(1), substitutionFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherControllerTest.java index f5c6dd0..ecd5b74 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/SubstitutionCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,17 +33,21 @@ public class SubstitutionCipherControllerTest{ private static final String SUBSTITUTION_OUTPUT_STRING = "Oguucig vq&gpeqfg 876"; private static final String substitutionName = "substitutionName"; private static final String substitutionDescription = "substitutionDescription"; + private static final List substitutionExplanation = List.of("substitutionExplanation1", "substitutionExplanation2", "substitutionExplanation3"); + private static final List substitutionFacts = List.of("substitutionFact1", "substitutionFact2", "substitutionFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(substitutionCipherController, "substitutionName", substitutionName); ReflectionTestUtils.setField(substitutionCipherController, "substitutionDescription", substitutionDescription); + ReflectionTestUtils.setField(substitutionCipherController, "substitutionExplanation", substitutionExplanation); + ReflectionTestUtils.setField(substitutionCipherController, "substitutionFacts", substitutionFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(substitutionName, substitutionDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(substitutionName, substitutionDescription, substitutionExplanation, substitutionFacts); ObjectNode returnedJson = substitutionCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherControllerIntegrationTest.java index 8dd9d75..377f30a 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl private static final String keyword = "keyword"; private static final String vigenereName = "vigenereName"; private static final String vigenereDescription = "vigenereDescription"; + private static final List vigenereExplanation = List.of("vigenereExplanation1", "vigenereExplanation2", "vigenereExplanation3"); + private static final List vigenereFacts = List.of("vigenereFact1", "vigenereFact2", "vigenereFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl ReflectionTestUtils.setField(vigenereCipherController, "vigenereName", vigenereName); ReflectionTestUtils.setField(vigenereCipherController, "vigenereDescription", vigenereDescription); + ReflectionTestUtils.setField(vigenereCipherController, "vigenereExplanation", vigenereExplanation); + ReflectionTestUtils.setField(vigenereCipherController, "vigenereFacts", vigenereFacts); } @@ -74,7 +81,13 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(vigenereDescription)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(vigenereName)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(vigenereName)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(vigenereExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(vigenereExplanation.get(0), vigenereExplanation.get(1), vigenereExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(vigenereFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(vigenereFacts.get(0), vigenereFacts.get(1), vigenereFacts.get(2)))); //Filter super.verifyFilter(url); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherControllerTest.java index bfe3070..29ab600 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/monosubstitution/VigenereCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,17 +33,21 @@ public class VigenereCipherControllerTest{ private static final String VIGENERE_OUTPUT_STRING = "Wiqooxh ds^cjqfgo"; private static final String vigenereName = "vigenereName"; private static final String vigenereDescription = "vigenereDescription"; + private static final List vigenereExplanation = List.of("vigenereExplanation1", "vigenereExplanation2", "vigenereExplanation3"); + private static final List vigenereFacts = List.of("vigenereFact1", "vigenereFact2", "vigenereFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(vigenereCipherController, "vigenereName", vigenereName); ReflectionTestUtils.setField(vigenereCipherController, "vigenereDescription", vigenereDescription); + ReflectionTestUtils.setField(vigenereCipherController, "vigenereExplanation", vigenereExplanation); + ReflectionTestUtils.setField(vigenereCipherController, "vigenereFacts", vigenereFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(vigenereName, vigenereDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(vigenereName, vigenereDescription, vigenereExplanation, vigenereFacts); ObjectNode returnedJson = vigenereCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherControllerIntegrationTest.java index 6f88c77..acf8c66 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class BifidCipherControllerIntegrationTest extends CipherStreamController private static final String keyword = "keyword"; private static final String bifidName = "bifidName"; private static final String bifidDescription = "bifidDescription"; + private static final List bifidExplanation = List.of("bifidExplanation1", "bifidExplanation2", "bifidExplanation3"); + private static final List bifidFacts = List.of("bifidFact1", "bifidFact2", "bifidFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class BifidCipherControllerIntegrationTest extends CipherStreamController ReflectionTestUtils.setField(bifidCipherController, "bifidName", bifidName); ReflectionTestUtils.setField(bifidCipherController, "bifidDescription", bifidDescription); + ReflectionTestUtils.setField(bifidCipherController, "bifidExplanation", bifidExplanation); + ReflectionTestUtils.setField(bifidCipherController, "bifidFacts", bifidFacts); } @@ -74,7 +81,13 @@ public class BifidCipherControllerIntegrationTest extends CipherStreamController .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(bifidName)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(bifidDescription)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(bifidDescription)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(bifidExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(bifidExplanation.get(0), bifidExplanation.get(1), bifidExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(bifidFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(bifidFacts.get(0), bifidFacts.get(1), bifidFacts.get(2)))); //Filter super.verifyFilter(url); @@ -104,7 +117,7 @@ public class BifidCipherControllerIntegrationTest extends CipherStreamController } @Test - public void testEncodeAdfgvx_error() throws Exception{ + public void testEncodebifid_error() throws Exception{ mockMvc.perform(post(url + "/encode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) @@ -144,7 +157,7 @@ public class BifidCipherControllerIntegrationTest extends CipherStreamController } @Test - public void testDecodeAdfgvx_error() throws Exception{ + public void testDecodebifid_error() throws Exception{ mockMvc.perform(post(url + "/decode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherControllerTest.java index ad0e199..46d7c1a 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/BifidCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,17 +33,21 @@ public class BifidCipherControllerTest{ private static final String BIFID_KEYWORD = CipherParameterUtil.KEYWORD; private static final String bifidName = "bifidName"; private static final String bifidDescription = "bifidDescription"; + private static final List bifidExplanation = List.of("bifidExplanation1", "bifidExplanation2", "bifidExplanation3"); + private static final List bifidFacts = List.of("bifidFact1", "bifidFact2", "bifidFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(bifidCipherController, "bifidName", bifidName); ReflectionTestUtils.setField(bifidCipherController, "bifidDescription", bifidDescription); + ReflectionTestUtils.setField(bifidCipherController, "bifidExplanation", bifidExplanation); + ReflectionTestUtils.setField(bifidCipherController, "bifidFacts", bifidFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(bifidName, bifidDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(bifidName, bifidDescription, bifidExplanation, bifidFacts); ObjectNode returnedJson = bifidCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherControllerIntegrationTest.java index 74c300a..38e7448 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class ColumnarCipherControllerIntegrationTest extends CipherStreamControl private static final String keyword = "keyword"; private static final String columnarName = "columnarName"; private static final String columnarDescription = "columnarDescription"; + private static final List columnarExplanation = List.of("columnarExplanation1", "columnarExplanation2", "columnarExplanation3"); + private static final List columnarFacts = List.of("columnarFact1", "columnarFact2", "columnarFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class ColumnarCipherControllerIntegrationTest extends CipherStreamControl ReflectionTestUtils.setField(columnarCipherController, "columnarName", columnarName); ReflectionTestUtils.setField(columnarCipherController, "columnarDescription", columnarDescription); + ReflectionTestUtils.setField(columnarCipherController, "columnarExplanation", columnarExplanation); + ReflectionTestUtils.setField(columnarCipherController, "columnarFacts", columnarFacts); } @@ -74,7 +81,13 @@ public class ColumnarCipherControllerIntegrationTest extends CipherStreamControl .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(columnarName)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(columnarDescription)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(columnarDescription)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(columnarExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(columnarExplanation.get(0), columnarExplanation.get(1), columnarExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(columnarFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(columnarFacts.get(0), columnarFacts.get(1), columnarFacts.get(2)))); //Filter super.verifyFilter(url); @@ -104,7 +117,7 @@ public class ColumnarCipherControllerIntegrationTest extends CipherStreamControl } @Test - public void testEncodeAdfgvx_error() throws Exception{ + public void testEncodecolumnar_error() throws Exception{ mockMvc.perform(post(url + "/encode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) @@ -144,7 +157,7 @@ public class ColumnarCipherControllerIntegrationTest extends CipherStreamControl } @Test - public void testDecodeAdfgvx_error() throws Exception{ + public void testDecodecolumnar_error() throws Exception{ mockMvc.perform(post(url + "/decode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherControllerTest.java index ac0e353..a146011 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/ColumnarCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,18 +33,22 @@ public class ColumnarCipherControllerTest{ private static final String COLUMNAR_KEYWORD = CipherParameterUtil.KEYWORD; private static final String columnarName = "columnarName"; private static final String columnarDescription = "columnarDescription"; + private static final List columnarExplanation = List.of("columnarExplanation1", "columnarExplanation2", "columnarExplanation3"); + private static final List columnarFacts = List.of("columnarFact1", "columnarFact2", "columnarFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(columnarCipherController, "columnarName", columnarName); ReflectionTestUtils.setField(columnarCipherController, "columnarDescription", columnarDescription); + ReflectionTestUtils.setField(columnarCipherController, "columnarExplanation", columnarExplanation); + ReflectionTestUtils.setField(columnarCipherController, "columnarFacts", columnarFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(columnarName, columnarDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(columnarName, columnarDescription, columnarExplanation, columnarFacts); ObjectNode returnedJson = columnarCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherControllerIntegrationTest.java index abc07b0..3e7e19e 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class HillCipherControllerIntegrationTest extends CipherStreamControllerI private static final int[][] keyArray = new int[][]{{1, 4, 2}, {2, 4, 1}, {4, 1, 2}}; private static final String hillName = "hillName"; private static final String hillDescription = "hillDescription"; + private static final List hillExplanation = List.of("hillExplanation1", "hillExplanation2", "hillExplanation3"); + private static final List hillFacts = List.of("hillFact1", "hillFact2", "hillFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class HillCipherControllerIntegrationTest extends CipherStreamControllerI ReflectionTestUtils.setField(hillCipherController, "hillName", hillName); ReflectionTestUtils.setField(hillCipherController, "hillDescription", hillDescription); + ReflectionTestUtils.setField(hillCipherController, "hillExplanation", hillExplanation); + ReflectionTestUtils.setField(hillCipherController, "hillFacts", hillFacts); } @@ -74,7 +81,13 @@ public class HillCipherControllerIntegrationTest extends CipherStreamControllerI .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(hillName)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(hillDescription)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(hillDescription)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(hillExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(hillExplanation.get(0), hillExplanation.get(1), hillExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(hillFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(hillFacts.get(0), hillFacts.get(1), hillFacts.get(2)))); //Filter super.verifyFilter(url); @@ -104,7 +117,7 @@ public class HillCipherControllerIntegrationTest extends CipherStreamControllerI } @Test - public void testEncodeAdfgvx_error() throws Exception{ + public void testEncodehill_error() throws Exception{ mockMvc.perform(post(url + "/encode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) @@ -144,7 +157,7 @@ public class HillCipherControllerIntegrationTest extends CipherStreamControllerI } @Test - public void testDecodeAdfgvx_error() throws Exception{ + public void testDecodehill_error() throws Exception{ mockMvc.perform(post(url + "/decode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherControllerTest.java index cf443fe..afe0356 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/HillCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -33,18 +35,22 @@ public class HillCipherControllerTest{ private static final int[][] KEY = {{1, 4, 2}, {2, 4, 1}, {4, 1, 2}}; private static final String hillName = "hillName"; private static final String hillDescription = "hillDescription"; + private static final List hillExplanation = List.of("hillExplanation1", "hillExplanation2", "hillExplanation3"); + private static final List hillFacts = List.of("hillFact1", "hillFact2", "hillFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(hillCipherController, "hillName", hillName); ReflectionTestUtils.setField(hillCipherController, "hillDescription", hillDescription); + ReflectionTestUtils.setField(hillCipherController, "hillExplanation", hillExplanation); + ReflectionTestUtils.setField(hillCipherController, "hillFacts", hillFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(hillName, hillDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(hillName, hillDescription, hillExplanation, hillFacts); ObjectNode returnedJson = hillCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeControllerIntegrationTest.java index f53fa35..f3eefb1 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -40,6 +43,8 @@ public class MorseCodeControllerIntegrationTest extends CipherStreamControllerIn private static final String encodedString = "-- . ... ... .- --. . - --- . -. -.-. --- -.. . .---- ..--- ...--"; private static final String morseName = "morseName"; private static final String morseDescription = "morseDescription"; + private static final List morseExplanation = List.of("morseExplanation1", "morseExplanation2", "morseExplanation3"); + private static final List morseFacts = List.of("morseFact1", "morseFact2", "morseFact3"); @BeforeEach @@ -54,6 +59,8 @@ public class MorseCodeControllerIntegrationTest extends CipherStreamControllerIn ReflectionTestUtils.setField(morseCodeController, "morseName", morseName); ReflectionTestUtils.setField(morseCodeController, "morseDescription", morseDescription); + ReflectionTestUtils.setField(morseCodeController, "morseExplanation", morseExplanation); + ReflectionTestUtils.setField(morseCodeController, "morseFacts", morseFacts); } @Test @@ -64,7 +71,13 @@ public class MorseCodeControllerIntegrationTest extends CipherStreamControllerIn .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(morseName)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(morseDescription)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(morseDescription)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(morseExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(morseExplanation.get(0), morseExplanation.get(1), morseExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(morseFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(morseFacts.get(0), morseFacts.get(1), morseFacts.get(2)))); //Filter super.verifyFilter(url); @@ -94,7 +107,7 @@ public class MorseCodeControllerIntegrationTest extends CipherStreamControllerIn } @Test - public void testEncodeAdfgvx_error() throws Exception{ + public void testEncodemorse_error() throws Exception{ mockMvc.perform(post(url + "/encode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) @@ -134,7 +147,7 @@ public class MorseCodeControllerIntegrationTest extends CipherStreamControllerIn } @Test - public void testDecodeAdfgvx_error() throws Exception{ + public void testDecodemorse_error() throws Exception{ mockMvc.perform(post(url + "/decode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeControllerTest.java index 3925aa8..fd3432f 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/MorseCodeControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -30,18 +32,22 @@ public class MorseCodeControllerTest{ private static final String MORSE_OUTPUT_STRING = "... --- ..."; private static final String morseName = "morseName"; private static final String morseDescription = "morseDescription"; + private static final List morseExplanation = List.of("morseExplanation1", "morseExplanation2", "morseExplanation3"); + private static final List morseFacts = List.of("morseFact1", "morseFact2", "morseFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(morseCodeController, "morseName", morseName); ReflectionTestUtils.setField(morseCodeController, "morseDescription", morseDescription); + ReflectionTestUtils.setField(morseCodeController, "morseExplanation", morseExplanation); + ReflectionTestUtils.setField(morseCodeController, "morseFacts", morseFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(morseName, morseDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(morseName, morseDescription, morseExplanation, morseFacts); ObjectNode returnedJson = morseCodeController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherControllerIntegrationTest.java index 5f30d20..b70618d 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -42,6 +45,8 @@ public class PlayfairCipherControllerIntegrationTest extends CipherStreamControl private static final String keyword = "Play-fair@Exam ple"; private static final String playfairName = "playfairName"; private static final String playfairDescription = "playfairDescription"; + private static final List playfairExplanation = List.of("playfairExplanation1", "playfairExplanation2", "playfairExplanation3"); + private static final List playfairFacts = List.of("playfairFact1", "playfairFact2", "playfairFact3"); @BeforeEach @@ -64,6 +69,8 @@ public class PlayfairCipherControllerIntegrationTest extends CipherStreamControl ReflectionTestUtils.setField(playfairCipherController, "playfairName", playfairName); ReflectionTestUtils.setField(playfairCipherController, "playfairDescription", playfairDescription); + ReflectionTestUtils.setField(playfairCipherController, "playfairExplanation", playfairExplanation); + ReflectionTestUtils.setField(playfairCipherController, "playfairFacts", playfairFacts); } @@ -75,7 +82,13 @@ public class PlayfairCipherControllerIntegrationTest extends CipherStreamControl .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(playfairName)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(playfairDescription)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(playfairDescription)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(playfairExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(playfairExplanation.get(0), playfairExplanation.get(1), playfairExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(playfairFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(playfairFacts.get(0), playfairFacts.get(1), playfairFacts.get(2)))); //Filter super.verifyFilter(url); @@ -105,7 +118,7 @@ public class PlayfairCipherControllerIntegrationTest extends CipherStreamControl } @Test - public void testEncodeAdfgvx_error() throws Exception{ + public void testEncodeplayfair_error() throws Exception{ mockMvc.perform(post(url + "/encode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) @@ -145,7 +158,7 @@ public class PlayfairCipherControllerIntegrationTest extends CipherStreamControl } @Test - public void testDecodeAdfgvx_error() throws Exception{ + public void testDecodeplayfair_error() throws Exception{ mockMvc.perform(post(url + "/decode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherControllerTest.java index d02c18d..b7c0283 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PlayfairCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -32,18 +34,22 @@ public class PlayfairCipherControllerTest{ private static final String PLAYFAIR_KEYWORD = "Play-fair@Exam ple"; private static final String playfairName = "playfairName"; private static final String playfairDescription = "playfairDescription"; + private static final List playfairExplanation = List.of("playfairExplanation1", "playfairExplanation2", "playfairExplanation3"); + private static final List playfairFacts = List.of("playfairFact1", "playfairFact2", "playfairFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(playfairCipherController, "playfairName", playfairName); ReflectionTestUtils.setField(playfairCipherController, "playfairDescription", playfairDescription); + ReflectionTestUtils.setField(playfairCipherController, "playfairExplanation", playfairExplanation); + ReflectionTestUtils.setField(playfairCipherController, "playfairFacts", playfairFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(playfairName, playfairDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(playfairName, playfairDescription, playfairExplanation, playfairFacts); ObjectNode returnedJson = playfairCipherController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareControllerIntegrationTest.java index b9f741a..f6cd07a 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class PolybiusSquareControllerIntegrationTest extends CipherStreamControl private static final String keyword = "keyword"; private static final String polybiusName = "polybiusName"; private static final String polybiusDescription = "polybiusDescription"; + private static final List polybiusExplanation = List.of("polybiusExplanation1", "polybiusExplanation2", "polybiusExplanation3"); + private static final List polybiusFacts = List.of("polybiusFact1", "polybiusFact2", "polybiusFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class PolybiusSquareControllerIntegrationTest extends CipherStreamControl ReflectionTestUtils.setField(polybiusSquareController, "polybiusName", polybiusName); ReflectionTestUtils.setField(polybiusSquareController, "polybiusDescription", polybiusDescription); + ReflectionTestUtils.setField(polybiusSquareController, "polybiusExplanation", polybiusExplanation); + ReflectionTestUtils.setField(polybiusSquareController, "polybiusFacts", polybiusFacts); } @@ -74,7 +81,13 @@ public class PolybiusSquareControllerIntegrationTest extends CipherStreamControl .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(polybiusName)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(polybiusDescription)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(polybiusDescription)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(polybiusExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(polybiusExplanation.get(0), polybiusExplanation.get(1), polybiusExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(polybiusFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(polybiusFacts.get(0), polybiusFacts.get(1), polybiusFacts.get(2)))); //Filter super.verifyFilter(url); @@ -104,7 +117,7 @@ public class PolybiusSquareControllerIntegrationTest extends CipherStreamControl } @Test - public void testEncodeAdfgvx_error() throws Exception{ + public void testEncodepolybius_error() throws Exception{ mockMvc.perform(post(url + "/encode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) @@ -144,7 +157,7 @@ public class PolybiusSquareControllerIntegrationTest extends CipherStreamControl } @Test - public void testDecodeAdfgvx_error() throws Exception{ + public void testDecodepolybius_error() throws Exception{ mockMvc.perform(post(url + "/decode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareControllerTest.java index 6ef157d..4205415 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/PolybiusSquareControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,17 +33,21 @@ public class PolybiusSquareControllerTest{ private static final String POLYBIUS_KEYWORD = "Z Y+ X-"; private static final String polybiusName = "polybiusName"; private static final String polybiusDescription = "polybiusDescription"; + private static final List polybiusExplanation = List.of("PolybiusExplanation1", "PolybiusExplanation2", "PolybiusExplanation3"); + private static final List polybiusFacts = List.of("PolybiusFact1", "PolybiusFact2", "PolybiusFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(polybiusSquareController, "polybiusName", polybiusName); ReflectionTestUtils.setField(polybiusSquareController, "polybiusDescription", polybiusDescription); + ReflectionTestUtils.setField(polybiusSquareController, "polybiusExplanation", polybiusExplanation); + ReflectionTestUtils.setField(polybiusSquareController, "polybiusFacts", polybiusFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(polybiusName, polybiusDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(polybiusName, polybiusDescription, polybiusExplanation, polybiusFacts); ObjectNode returnedJson = polybiusSquareController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceControllerIntegrationTest.java index 00a319c..31e8481 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -41,6 +44,8 @@ public class RailFenceControllerIntegrationTest extends CipherStreamControllerIn private static final int rails = 3; private static final String railFenceName = "railFenceName"; private static final String railFenceDescription = "railFenceDescription"; + private static final List railFenceExplanation = List.of("railFenceExplanation1", "railFenceExplanation2", "railFenceExplanation3"); + private static final List railFenceFacts = List.of("railFenceFact1", "railFenceFact2", "railFenceFact3"); @BeforeEach @@ -63,6 +68,8 @@ public class RailFenceControllerIntegrationTest extends CipherStreamControllerIn ReflectionTestUtils.setField(railFenceController, "railFenceName", railFenceName); ReflectionTestUtils.setField(railFenceController, "railFenceDescription", railFenceDescription); + ReflectionTestUtils.setField(railFenceController, "railFenceExplanation", railFenceExplanation); + ReflectionTestUtils.setField(railFenceController, "railFenceFacts", railFenceFacts); } @@ -74,7 +81,13 @@ public class RailFenceControllerIntegrationTest extends CipherStreamControllerIn .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(railFenceName)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(railFenceDescription)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(railFenceDescription)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(railFenceExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(railFenceExplanation.get(0), railFenceExplanation.get(1), railFenceExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(railFenceFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(railFenceFacts.get(0), railFenceFacts.get(1), railFenceFacts.get(2)))); //Filter super.verifyFilter(url); @@ -104,7 +117,7 @@ public class RailFenceControllerIntegrationTest extends CipherStreamControllerIn } @Test - public void testEncodeAdfgvx_error() throws Exception{ + public void testEncoderailFence_error() throws Exception{ mockMvc.perform(post(url + "/encode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) @@ -144,7 +157,7 @@ public class RailFenceControllerIntegrationTest extends CipherStreamControllerIn } @Test - public void testDecodeAdfgvx_error() throws Exception{ + public void testDecoderailFence_error() throws Exception{ mockMvc.perform(post(url + "/decode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceControllerTest.java index b2b872f..014e5f9 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/RailFenceControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -31,18 +33,22 @@ public class RailFenceControllerTest{ private static final int RAIL_FENCE_RAILS = 5; private static final String railFenceName = "railFenceName"; private static final String railFenceDescription = "railFenceDescription"; + private static final List railFenceExplanation = List.of("railFenceExplanation1", "railFenceExplanation2", "railFenceExplanation3"); + private static final List railFenceFacts = List.of("railFenceFact1", "railFenceFact2", "railFenceFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(railFenceController, "railFenceName", railFenceName); ReflectionTestUtils.setField(railFenceController, "railFenceDescription", railFenceDescription); + ReflectionTestUtils.setField(railFenceController, "railFenceExplanation", railFenceExplanation); + ReflectionTestUtils.setField(railFenceController, "railFenceFacts", railFenceFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(railFenceName, railFenceDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(railFenceName, railFenceDescription, railFenceExplanation, railFenceFacts); ObjectNode returnedJson = railFenceController.getCipherInfo(); diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherControllerIntegrationTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherControllerIntegrationTest.java index b63fb2f..e033cb8 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherControllerIntegrationTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherControllerIntegrationTest.java @@ -1,10 +1,13 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; +import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -43,6 +46,8 @@ public class TrifidCipherControllerIntegrationTest extends CipherStreamControlle private static final int grouplength = Integer.MAX_VALUE; private static final String trifidName = "trifidName"; private static final String trifidDescription = "trifidDescription"; + private static final List trifidExplanation = List.of("trifidExplanation1", "trifidExplanation2", "trifidExplanation3"); + private static final List trifidFacts = List.of("trifidFact1", "trifidFact2", "trifidFact3"); @BeforeEach @@ -69,6 +74,8 @@ public class TrifidCipherControllerIntegrationTest extends CipherStreamControlle ReflectionTestUtils.setField(trifidCipherController, "trifidName", trifidName); ReflectionTestUtils.setField(trifidCipherController, "trifidDescription", trifidDescription); + ReflectionTestUtils.setField(trifidCipherController, "trifidExplanation", trifidExplanation); + ReflectionTestUtils.setField(trifidCipherController, "trifidFacts", trifidFacts); } @@ -80,7 +87,13 @@ public class TrifidCipherControllerIntegrationTest extends CipherStreamControlle .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(trifidName)) - .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(trifidDescription)); + .andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(trifidDescription)) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(trifidExplanation.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(trifidExplanation.get(0), trifidExplanation.get(1), trifidExplanation.get(2)))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray()) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(trifidFacts.size()))) + .andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(trifidFacts.get(0), trifidFacts.get(1), trifidFacts.get(2)))); //Filter super.verifyFilter(url); @@ -110,7 +123,7 @@ public class TrifidCipherControllerIntegrationTest extends CipherStreamControlle } @Test - public void testEncodeAdfgvx_error() throws Exception{ + public void testEncodetrifid_error() throws Exception{ mockMvc.perform(post(url + "/encode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) @@ -150,7 +163,7 @@ public class TrifidCipherControllerIntegrationTest extends CipherStreamControlle } @Test - public void testDecodeAdfgvx_error() throws Exception{ + public void testDecodetrifid_error() throws Exception{ mockMvc.perform(post(url + "/decode") .header("X-Request-Id", requestId) .header("X-Forwarded-For", ipAddress) diff --git a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherControllerTest.java b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherControllerTest.java index ad00570..8ba33b9 100644 --- a/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherControllerTest.java +++ b/src/test/java/com/mattrixwv/cipherstream/controller/polysubstitution/TrifidCipherControllerTest.java @@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution; import static org.junit.jupiter.api.Assertions.*; +import java.util.List; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -33,18 +35,22 @@ public class TrifidCipherControllerTest{ private static final int TRIFID_GROUP_LENGTH = 3; private static final String trifidName = "trifidName"; private static final String trifidDescription = "trifidDescription"; + private static final List trifidExplanation = List.of("trifidExplanation1", "trifidExplanation2", "trifidExplanation3"); + private static final List trifidFacts = List.of("trifidFact1", "trifidFact2", "trifidFact3"); @BeforeEach public void setup(){ ReflectionTestUtils.setField(trifidCipherController, "trifidName", trifidName); ReflectionTestUtils.setField(trifidCipherController, "trifidDescription", trifidDescription); + ReflectionTestUtils.setField(trifidCipherController, "trifidExplanation", trifidExplanation); + ReflectionTestUtils.setField(trifidCipherController, "trifidFacts", trifidFacts); } @Test public void tetGetCipherInfo(){ - ObjectNode infoNode = CipherInfoUtil.buildInfoNode(trifidName, trifidDescription); + ObjectNode infoNode = CipherInfoUtil.buildInfoNode(trifidName, trifidDescription, trifidExplanation, trifidFacts); ObjectNode returnedJson = trifidCipherController.getCipherInfo();