From 0b1d5a3d917accda555de864c8af96ae7429ef3b Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Fri, 19 Apr 2024 22:36:52 -0400 Subject: [PATCH] Update error messages and test names --- .../cipherstream/combination/ADFGVX.java | 2 +- .../cipherstream/combination/ADFGX.java | 2 +- .../cipherstream/monosubstitution/Affine.java | 5 +- .../cipherstream/monosubstitution/Atbash.java | 2 +- .../monosubstitution/Baconian.java | 6 +-- .../cipherstream/monosubstitution/BaseX.java | 4 +- .../monosubstitution/Beaufort.java | 2 +- .../cipherstream/monosubstitution/Caesar.java | 2 +- .../monosubstitution/OneTimePad.java | 2 +- .../cipherstream/monosubstitution/Porta.java | 2 +- .../monosubstitution/Substitution.java | 2 +- .../monosubstitution/Vigenere.java | 4 +- .../cipherstream/polysubstitution/Bifid.java | 2 +- .../polysubstitution/Columnar.java | 2 +- .../cipherstream/polysubstitution/Hill.java | 2 +- .../polysubstitution/Playfair.java | 2 +- .../polysubstitution/PolybiusSquare.java | 2 +- .../polysubstitution/RailFence.java | 4 +- .../cipherstream/polysubstitution/Trifid.java | 10 ++-- .../{TestADFGVX.java => ADFGVXTest.java} | 33 +++++------- .../{TestADFGX.java => ADFGXTest.java} | 33 +++++------- ...ion.java => InvalidBaseExceptionTest.java} | 28 ++++++---- ...ava => InvalidCharacterExceptionTest.java} | 24 ++++++--- ...on.java => InvalidInputExceptionTest.java} | 24 ++++++--- ...tion.java => InvalidKeyExceptionTest.java} | 24 ++++++--- ....java => InvalidKeywordExceptionTest.java} | 24 ++++++--- .../{TestAffine.java => AffineTest.java} | 31 +++++------ .../{TestAtbash.java => AtbashTest.java} | 27 ++++------ .../{TestAutokey.java => AutokeyTest.java} | 28 +++++----- .../{TestBaconian.java => BaconianTest.java} | 28 ++++------ .../{TestBaseX.java => BaseXTest.java} | 28 ++++------ .../{TestBeaufort.java => BeaufortTest.java} | 30 +++++------ .../{TestCaesar.java => CaesarTest.java} | 28 ++++------ ...estOneTimePad.java => OneTimePadTest.java} | 27 ++++------ .../{TestPorta.java => PortaTest.java} | 31 +++++------ ...ubstitution.java => SubstitutionTest.java} | 43 +++++++--------- .../{TestVigenere.java => VigenereTest.java} | 31 +++++------ .../{TestBifid.java => BifidTest.java} | 32 +++++------- .../{TestColumnar.java => ColumnarTest.java} | 42 +++++++-------- .../{TestHill.java => HillTest.java} | 35 +++++-------- ...uare.java => LargePolybiusSquareTest.java} | 38 ++++++-------- .../{TestMorse.java => MorseTest.java} | 23 ++++----- .../{TestPlayfair.java => PlayfairTest.java} | 38 +++++--------- ...iusSquare.java => PolybiusSquareTest.java} | 37 +++++--------- ...{TestRailFence.java => RailFenceTest.java} | 38 +++++--------- .../{TestTrifid.java => TrifidTest.java} | 51 ++++++++----------- 46 files changed, 395 insertions(+), 520 deletions(-) rename src/test/java/com/mattrixwv/cipherstream/combination/{TestADFGVX.java => ADFGVXTest.java} (91%) rename src/test/java/com/mattrixwv/cipherstream/combination/{TestADFGX.java => ADFGXTest.java} (91%) rename src/test/java/com/mattrixwv/cipherstream/exceptions/{TestInvalidBaseException.java => InvalidBaseExceptionTest.java} (51%) rename src/test/java/com/mattrixwv/cipherstream/exceptions/{TestInvalidCharacterException.java => InvalidCharacterExceptionTest.java} (57%) rename src/test/java/com/mattrixwv/cipherstream/exceptions/{TestInvalidInputException.java => InvalidInputExceptionTest.java} (58%) rename src/test/java/com/mattrixwv/cipherstream/exceptions/{TestInvalidKeyException.java => InvalidKeyExceptionTest.java} (58%) rename src/test/java/com/mattrixwv/cipherstream/exceptions/{TestInvalidKeywordException.java => InvalidKeywordExceptionTest.java} (57%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestAffine.java => AffineTest.java} (91%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestAtbash.java => AtbashTest.java} (89%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestAutokey.java => AutokeyTest.java} (87%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestBaconian.java => BaconianTest.java} (91%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestBaseX.java => BaseXTest.java} (90%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestBeaufort.java => BeaufortTest.java} (92%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestCaesar.java => CaesarTest.java} (93%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestOneTimePad.java => OneTimePadTest.java} (86%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestPorta.java => PortaTest.java} (95%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestSubstitution.java => SubstitutionTest.java} (91%) rename src/test/java/com/mattrixwv/cipherstream/monosubstitution/{TestVigenere.java => VigenereTest.java} (92%) rename src/test/java/com/mattrixwv/cipherstream/polysubstitution/{TestBifid.java => BifidTest.java} (90%) rename src/test/java/com/mattrixwv/cipherstream/polysubstitution/{TestColumnar.java => ColumnarTest.java} (95%) rename src/test/java/com/mattrixwv/cipherstream/polysubstitution/{TestHill.java => HillTest.java} (95%) rename src/test/java/com/mattrixwv/cipherstream/polysubstitution/{TestLargePolybiusSquare.java => LargePolybiusSquareTest.java} (90%) rename src/test/java/com/mattrixwv/cipherstream/polysubstitution/{TestMorse.java => MorseTest.java} (91%) rename src/test/java/com/mattrixwv/cipherstream/polysubstitution/{TestPlayfair.java => PlayfairTest.java} (96%) rename src/test/java/com/mattrixwv/cipherstream/polysubstitution/{TestPolybiusSquare.java => PolybiusSquareTest.java} (95%) rename src/test/java/com/mattrixwv/cipherstream/polysubstitution/{TestRailFence.java => RailFenceTest.java} (92%) rename src/test/java/com/mattrixwv/cipherstream/polysubstitution/{TestTrifid.java => TrifidTest.java} (93%) diff --git a/src/main/java/com/mattrixwv/cipherstream/combination/ADFGVX.java b/src/main/java/com/mattrixwv/cipherstream/combination/ADFGVX.java index dd6b24c..c273f75 100644 --- a/src/main/java/com/mattrixwv/cipherstream/combination/ADFGVX.java +++ b/src/main/java/com/mattrixwv/cipherstream/combination/ADFGVX.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/combination/ADFGVX.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/combination/ADFGVX.java //Mattrixwv // Created: 01-26-22 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/combination/ADFGX.java b/src/main/java/com/mattrixwv/cipherstream/combination/ADFGX.java index d696b7e..08fdcf3 100644 --- a/src/main/java/com/mattrixwv/cipherstream/combination/ADFGX.java +++ b/src/main/java/com/mattrixwv/cipherstream/combination/ADFGX.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/combination/ADFGX.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/combination/ADFGX.java //Mattrixwv // Created: 01-25-22 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Affine.java b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Affine.java index 6147028..8bf1679 100644 --- a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Affine.java +++ b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Affine.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/polySubstitution/Affine.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Affine.java //Mattrixwv // Created: 01-26-22 //Modified: 05-04-23 @@ -8,11 +8,10 @@ package com.mattrixwv.cipherstream.monosubstitution; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.mattrixwv.NumberAlgorithms; import com.mattrixwv.cipherstream.exceptions.InvalidInputException; import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; -import com.mattrixwv.NumberAlgorithms; - public class Affine{ private static final Logger logger = LoggerFactory.getLogger(Affine.class); diff --git a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Atbash.java b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Atbash.java index 68dafd0..f4685ce 100644 --- a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Atbash.java +++ b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Atbash.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/monoSubstitution/Atbash.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Atbash.java //Mattrixwv // Created: 07-25-21 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Baconian.java b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Baconian.java index 3b327ae..8b5ca05 100644 --- a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Baconian.java +++ b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Baconian.java @@ -1,7 +1,7 @@ //CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/Baconian.java //Mattrixwv // Created: 01-12-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; @@ -76,14 +76,14 @@ public class Baconian{ //Make sure each letter contains 5 characters if(str.length() != 5){ - throw new InvalidCharacterException("All Baconian letters contain exactly 5 characters: " + str); + throw new InvalidCharacterException("All Baconian 'letters' contain exactly 5 characters. Invalid 'letter': " + str); } //Make sure the letter contains only a's and b's logger.debug("Replacing all non-abAB characters"); String temp = str.replaceAll("[^abAB]", ""); if(!temp.equals(str)){ - throw new InvalidCharacterException("Baconian letters contain only a's and b's: " + str); + throw new InvalidCharacterException("Baconian 'letters' contain only a's and b's. Invalid 'letter': " + str); } } diff --git a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/BaseX.java b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/BaseX.java index 3d16978..75afe23 100644 --- a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/BaseX.java +++ b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/BaseX.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/monoSubstitution/BaseX.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/BaseX.java //Mattrixwv // Created: 01-08-22 //Modified: 05-04-23 @@ -10,9 +10,9 @@ import java.util.StringJoiner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.mattrixwv.cipherstream.exceptions.InvalidBaseException; import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException; import com.mattrixwv.cipherstream.exceptions.InvalidInputException; -import com.mattrixwv.cipherstream.exceptions.InvalidBaseException; public class BaseX{ diff --git a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Beaufort.java b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Beaufort.java index a68cbde..bc17e15 100644 --- a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Beaufort.java +++ b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Beaufort.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/monoSubstitution/Beaufort.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Beaufort.java //Mattrixwv // Created: 02-23-22 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Caesar.java b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Caesar.java index f65ef8f..1f62ab2 100644 --- a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Caesar.java +++ b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Caesar.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/monoSubstitution/Caesar.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Caesar.java //Matthew Ellison // Created: 07-25-21 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/OneTimePad.java b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/OneTimePad.java index 72d639c..a118977 100644 --- a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/OneTimePad.java +++ b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/OneTimePad.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/monoSubstitution/OneTimePad.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/OneTimePad.java //Mattrixwv // Created: 02-23-22 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Porta.java b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Porta.java index 24f7d22..029192b 100644 --- a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Porta.java +++ b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Porta.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/monoSubstitution/Porta.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Porta.java //Mattrixwv // Created: 02-28-22 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Substitution.java b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Substitution.java index 056bdd1..10ed91b 100644 --- a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Substitution.java +++ b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Substitution.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/monoSubstitution/Substitution.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Substitution.java //Mattrixwv // Created: 02-22-22 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Vigenere.java b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Vigenere.java index 351a42e..e8a5a98 100644 --- a/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Vigenere.java +++ b/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Vigenere.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/monoSubstitution/Vigenere.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Vigenere.java //Matthew Ellison // Created: 07-25-21 //Modified: 05-04-23 @@ -98,7 +98,7 @@ public class Vigenere{ setOffset(); //If after all the eliminating of unusable characters the keyword is empty throw an exception - if(this.keyword.isBlank()){ + if(this.keyword.length() < 2){ throw new InvalidKeywordException("Keyword must contain at least 2 letters"); } } diff --git a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Bifid.java b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Bifid.java index 7312214..6c9d522 100644 --- a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Bifid.java +++ b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Bifid.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/polySubstitution/Bifid.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Bifid.java //Mattrixwv // Created: 03-03-22 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Columnar.java b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Columnar.java index 37fbe6c..10431bd 100644 --- a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Columnar.java +++ b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Columnar.java @@ -1,4 +1,4 @@ -//MattrixwvWebsite/src/main/java/com/mattrixwv/CipherStreamJava/polySubstitution/Columnar.java +//MattrixwvWebsite/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Columnar.java //Mattrixwv // Created: 01-16-22 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Hill.java b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Hill.java index addfb69..994868c 100644 --- a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Hill.java +++ b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Hill.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/polySubstitution/Hill.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Hill.java //Mattrixwv // Created: 01-31-22 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Playfair.java b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Playfair.java index 3de6775..436d757 100644 --- a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Playfair.java +++ b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Playfair.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/polySubstitution/Playfair.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Playfair.java //Matthew Ellison // Created: 07-30-21 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/PolybiusSquare.java b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/PolybiusSquare.java index 95f875e..b070268 100644 --- a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/PolybiusSquare.java +++ b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/PolybiusSquare.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/polySubstitution/PolybiusSquare.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/PolybiusSquare.java //Mattrixwv // Created: 01-04-22 //Modified: 05-04-23 diff --git a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/RailFence.java b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/RailFence.java index d94023f..5e6d03d 100644 --- a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/RailFence.java +++ b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/RailFence.java @@ -1,4 +1,4 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/polySubstitution/RailFence.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/RailFence.java //Mattrixwv // Created: 03-21-22 //Modified: 05-04-23 @@ -10,8 +10,8 @@ import java.math.BigDecimal; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.mattrixwv.cipherstream.exceptions.InvalidInputException; import com.mattrixwv.cipherstream.exceptions.InvalidBaseException; +import com.mattrixwv.cipherstream.exceptions.InvalidInputException; public class RailFence{ diff --git a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Trifid.java b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Trifid.java index 69dd11d..042682b 100644 --- a/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Trifid.java +++ b/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Trifid.java @@ -1,7 +1,7 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/polySubstitution/Trifid.java +//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Trifid.java //Mattrixwv // Created: 03-03-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.polysubstitution; @@ -11,10 +11,10 @@ import java.util.StringJoiner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.mattrixwv.cipherstream.exceptions.InvalidBaseException; import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException; import com.mattrixwv.cipherstream.exceptions.InvalidInputException; import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; -import com.mattrixwv.cipherstream.exceptions.InvalidBaseException; public class Trifid{ @@ -60,11 +60,11 @@ public class Trifid{ protected void setFillIn(char fillIn) throws InvalidCharacterException{ //Make sure the character is a printing character if((fillIn < ' ') || (fillIn > '~')){ - throw new InvalidCharacterException("Fill in character must be a printing character"); + throw new InvalidCharacterException("Fill in character must be a printable character"); } //Make sure the character is not a letter if(Character.isAlphabetic(fillIn)){ - throw new InvalidCharacterException("Fill in must not be a letter"); + throw new InvalidCharacterException("Fill in must not be a non-letter character"); } logger.debug("Setting fill in {}", fillIn); diff --git a/src/test/java/com/mattrixwv/cipherstream/combination/TestADFGVX.java b/src/test/java/com/mattrixwv/cipherstream/combination/ADFGVXTest.java similarity index 91% rename from src/test/java/com/mattrixwv/cipherstream/combination/TestADFGVX.java rename to src/test/java/com/mattrixwv/cipherstream/combination/ADFGVXTest.java index d158b5e..9a004b3 100644 --- a/src/test/java/com/mattrixwv/cipherstream/combination/TestADFGVX.java +++ b/src/test/java/com/mattrixwv/cipherstream/combination/ADFGVXTest.java @@ -1,22 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/combination/TestADFGVX.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/combination/TestADFGVX.java //Mattrixwv // Created: 01-26-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.combination; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -32,18 +23,18 @@ import com.mattrixwv.cipherstream.polysubstitution.LargePolybiusSquare; @ExtendWith(MockitoExtension.class) -public class TestADFGVX{ +public class ADFGVXTest{ @InjectMocks private ADFGVX cipher; @Mock private Logger logger; //Variables - private String decodedString = "Message to^encode"; - private String decodedStringClean = "MESSAGETOENCODE"; - private String encodedString = "AXgvdavfxgagfa afag^aaxdxfgdagda"; - private String encodedStringClean = "AXGVDAVFXGAGFAAFAGAAXDXFGDAGDA"; - private String keyword = "keyword"; - private String squareKeyword = "SquareKeyword"; + private static final String decodedString = "Message to^encode"; + private static final String decodedStringClean = "MESSAGETOENCODE"; + private static final String encodedString = "AXgvdavfxgagfa afag^aaxdxfgdagda"; + private static final String encodedStringClean = "AXGVDAVFXGAGFAAFAGAAXDXFGDAGDA"; + private static final String keyword = "keyword"; + private static final String squareKeyword = "SquareKeyword"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/combination/TestADFGX.java b/src/test/java/com/mattrixwv/cipherstream/combination/ADFGXTest.java similarity index 91% rename from src/test/java/com/mattrixwv/cipherstream/combination/TestADFGX.java rename to src/test/java/com/mattrixwv/cipherstream/combination/ADFGXTest.java index cdc0507..c4dcb32 100644 --- a/src/test/java/com/mattrixwv/cipherstream/combination/TestADFGX.java +++ b/src/test/java/com/mattrixwv/cipherstream/combination/ADFGXTest.java @@ -1,22 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamjava/combination/TestADFGX.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/combination/TestADFGX.java //Mattrixwv // Created: 01-25-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.combination; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -32,18 +23,18 @@ import com.mattrixwv.cipherstream.polysubstitution.PolybiusSquare; @ExtendWith(MockitoExtension.class) -public class TestADFGX{ +public class ADFGXTest{ @InjectMocks private ADFGX cipher; @Mock private Logger logger; //Variables - private String decodedString = "Message to^encode"; - private String decodedStringClean = "MESSAGETOENCODE"; - private String encodedString = "AAgagadfagaxxd axdx^adafafxddgdf"; - private String encodedStringClean = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF"; - private String keyword = "keyword"; - private String squareKeyword = "SquareKeyword"; + private static final String decodedString = "Message to^encode"; + private static final String decodedStringClean = "MESSAGETOENCODE"; + private static final String encodedString = "AAgagadfagaxxd axdx^adafafxddgdf"; + private static final String encodedStringClean = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF"; + private static final String keyword = "keyword"; + private static final String squareKeyword = "SquareKeyword"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidBaseException.java b/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidBaseExceptionTest.java similarity index 51% rename from src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidBaseException.java rename to src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidBaseExceptionTest.java index 45f038a..10c84f5 100644 --- a/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidBaseException.java +++ b/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidBaseExceptionTest.java @@ -1,36 +1,44 @@ //CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidBaseException.java //Mattrixwv // Created: 04-14-23 -//Modified: 04-14-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.exceptions; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; -public class TestInvalidBaseException{ - private String message = "message"; - private Throwable cause = new Exception(); +public class InvalidBaseExceptionTest{ + private static final String message = "message"; + private static final Throwable cause = new Exception(); @Test - public void testConstructors(){ + public void testConstructor_default(){ InvalidBaseException exception = new InvalidBaseException(); assertNull(exception.getMessage()); assertNull(exception.getCause()); + } - exception = new InvalidBaseException(message); + @Test + public void testConstructor_message(){ + InvalidBaseException exception = new InvalidBaseException(message); assertEquals(message, exception.getMessage()); assertNull(exception.getCause()); + } - exception = new InvalidBaseException(cause); + @Test + public void testConstructor_cause(){ + InvalidBaseException exception = new InvalidBaseException(cause); assertEquals(cause.toString(), exception.getMessage()); assertEquals(cause, exception.getCause()); + } - exception = new InvalidBaseException(message, cause); + @Test + public void testConstructor_messageAndCause(){ + InvalidBaseException exception = new InvalidBaseException(message, cause); assertEquals(message, exception.getMessage()); assertEquals(cause, exception.getCause()); } diff --git a/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidCharacterException.java b/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidCharacterExceptionTest.java similarity index 57% rename from src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidCharacterException.java rename to src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidCharacterExceptionTest.java index cc82831..44846a4 100644 --- a/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidCharacterException.java +++ b/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidCharacterExceptionTest.java @@ -1,36 +1,44 @@ //CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidcharacterException.java //Mattrixwv // Created: 04-14-23 -//Modified: 04-14-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.exceptions; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; -public class TestInvalidCharacterException{ +public class InvalidCharacterExceptionTest{ private String message = "message"; private Throwable cause = new Exception(); @Test - public void testConstructors(){ + public void testConstructor_default(){ InvalidCharacterException exception = new InvalidCharacterException(); assertNull(exception.getMessage()); assertNull(exception.getCause()); + } - exception = new InvalidCharacterException(message); + @Test + public void testConstructor_message(){ + InvalidCharacterException exception = new InvalidCharacterException(message); assertEquals(message, exception.getMessage()); assertNull(exception.getCause()); + } - exception = new InvalidCharacterException(cause); + @Test + public void testConstructor_cause(){ + InvalidCharacterException exception = new InvalidCharacterException(cause); assertEquals(cause.toString(), exception.getMessage()); assertEquals(cause, exception.getCause()); + } - exception = new InvalidCharacterException(message, cause); + @Test + public void testConstructor_messageAndCause(){ + InvalidCharacterException exception = new InvalidCharacterException(message, cause); assertEquals(message, exception.getMessage()); assertEquals(cause, exception.getCause()); } diff --git a/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidInputException.java b/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidInputExceptionTest.java similarity index 58% rename from src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidInputException.java rename to src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidInputExceptionTest.java index 1aeefb0..88f056c 100644 --- a/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidInputException.java +++ b/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidInputExceptionTest.java @@ -1,36 +1,44 @@ //CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/exception/TestInvalidInputException.java //Mattrixwv // Created: 04-14-23 -//Modified: 04-14-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.exceptions; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; -public class TestInvalidInputException{ +public class InvalidInputExceptionTest{ private String message = "message"; private Throwable cause = new Exception(); @Test - public void testConstructors(){ + public void testConstructor_default(){ InvalidInputException exception = new InvalidInputException(); assertNull(exception.getMessage()); assertNull(exception.getCause()); + } - exception = new InvalidInputException(message); + @Test + public void testConstructor_message(){ + InvalidInputException exception = new InvalidInputException(message); assertEquals(message, exception.getMessage()); assertNull(exception.getCause()); + } - exception = new InvalidInputException(cause); + @Test + public void testConstructor_cause(){ + InvalidInputException exception = new InvalidInputException(cause); assertEquals(cause.toString(), exception.getMessage()); assertEquals(cause, exception.getCause()); + } - exception = new InvalidInputException(message, cause); + @Test + public void testConstructor_messageAndCause(){ + InvalidInputException exception = new InvalidInputException(message, cause); assertEquals(message, exception.getMessage()); assertEquals(cause, exception.getCause()); } diff --git a/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidKeyException.java b/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidKeyExceptionTest.java similarity index 58% rename from src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidKeyException.java rename to src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidKeyExceptionTest.java index ef7e2b1..f688f5d 100644 --- a/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidKeyException.java +++ b/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidKeyExceptionTest.java @@ -1,36 +1,44 @@ //CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidKeyException.java //Mattrixwv // Created: 04-14-23 -//Modified: 04-14-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.exceptions; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; -public class TestInvalidKeyException{ +public class InvalidKeyExceptionTest{ public String message = "message"; public Throwable cause = new Exception(); @Test - public void testConstructors(){ + public void testConstructor_default(){ InvalidKeyException exception = new InvalidKeyException(); assertNull(exception.getMessage()); assertNull(exception.getCause()); + } - exception = new InvalidKeyException(message); + @Test + public void testConstructor_message(){ + InvalidKeyException exception = new InvalidKeyException(message); assertEquals(message, exception.getMessage()); assertNull(exception.getCause()); + } - exception = new InvalidKeyException(cause); + @Test + public void testConstructor_cause(){ + InvalidKeyException exception = new InvalidKeyException(cause); assertEquals(cause.toString(), exception.getMessage()); assertEquals(cause, exception.getCause()); + } - exception = new InvalidKeyException(message, cause); + @Test + public void testConstructor_messageAndCause(){ + InvalidKeyException exception = new InvalidKeyException(message, cause); assertEquals(message, exception.getMessage()); assertEquals(cause, exception.getCause()); } diff --git a/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidKeywordException.java b/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidKeywordExceptionTest.java similarity index 57% rename from src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidKeywordException.java rename to src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidKeywordExceptionTest.java index 26222cf..487c5ab 100644 --- a/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidKeywordException.java +++ b/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidKeywordExceptionTest.java @@ -1,36 +1,44 @@ //CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/exceptions/TestInvalidKeywordException.java //Mattrixwv // Created: 04-14-23 -//Modified: 04-14-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.exceptions; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; -public class TestInvalidKeywordException{ +public class InvalidKeywordExceptionTest{ private String message = "message"; private Throwable cause = new Exception(); @Test - public void testConstructor(){ + public void testConstructor_default(){ InvalidKeywordException exception = new InvalidKeywordException(); assertNull(exception.getMessage()); assertNull(exception.getCause()); + } - exception = new InvalidKeywordException(message); + @Test + public void testConstructor_message(){ + InvalidKeywordException exception = new InvalidKeywordException(message); assertEquals(message, exception.getMessage()); assertNull(exception.getCause()); + } - exception = new InvalidKeywordException(cause); + @Test + public void testConstructor_cause(){ + InvalidKeywordException exception = new InvalidKeywordException(cause); assertEquals(cause.toString(), exception.getMessage()); assertEquals(cause, exception.getCause()); + } - exception = new InvalidKeywordException(message, cause); + @Test + public void testConstructor_messageAndCause(){ + InvalidKeywordException exception = new InvalidKeywordException(message, cause); assertEquals(message, exception.getMessage()); assertEquals(cause, exception.getCause()); } diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestAffine.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/AffineTest.java similarity index 91% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestAffine.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/AffineTest.java index d2155db..6d0f993 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestAffine.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/AffineTest.java @@ -1,20 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/polySubstitution/TestAffine.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/polysubstitution/AffineTest.java //Mattrixwv // Created: 01-26-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -28,18 +21,18 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; @ExtendWith(MockitoExtension.class) -public class TestAffine{ +public class AffineTest{ @InjectMocks private Affine cipher; @Mock private Logger logger; //Variables - private String decodedString = "MEssage to^encode"; - private String decodedStringClean = "messagetoencode"; - private String encodedString = "PBtthlb yz^burzwb"; - private String encodedStringClean = "pbtthlbyzburzwb"; - private int key1 = 5; - private int key2 = 7; + private static final String decodedString = "MEssage to^encode"; + private static final String decodedStringClean = "messagetoencode"; + private static final String encodedString = "PBtthlb yz^burzwb"; + private static final String encodedStringClean = "pbtthlbyzburzwb"; + private static final int key1 = 5; + private static final int key2 = 7; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestAtbash.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/AtbashTest.java similarity index 89% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestAtbash.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/AtbashTest.java index 0593001..a475046 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestAtbash.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/AtbashTest.java @@ -1,20 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/monoSubstitution/TestAtbash.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/monosubstitution/AtbashTest.java //Mattrixwv // Created: 07-25-21 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -27,16 +20,16 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException; @ExtendWith(MockitoExtension.class) -public class TestAtbash{ +public class AtbashTest{ @InjectMocks private Atbash cipher; @Mock private Logger logger; //Variables - private String decodedString = "Message to^encode"; - private String decodedStringClean = "MESSAGETOENCODE"; - private String encodedString = "Nvhhztv gl^vmxlwv"; - private String encodedStringClean = "NVHHZTVGLVMXLWV"; + private static final String decodedString = "Message to^encode"; + private static final String decodedStringClean = "MESSAGETOENCODE"; + private static final String encodedString = "Nvhhztv gl^vmxlwv"; + private static final String encodedStringClean = "NVHHZTVGLVMXLWV"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestAutokey.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/AutokeyTest.java similarity index 87% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestAutokey.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/AutokeyTest.java index 5caa199..93a192a 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestAutokey.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/AutokeyTest.java @@ -1,17 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/monoSubstitution/TestAutokey.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/monosubstitution/AutokeyTest.java //Mattrixwv // Created: 07-26-21 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import java.util.ArrayList; import java.util.List; @@ -25,18 +21,18 @@ import org.slf4j.Logger; @ExtendWith(MockitoExtension.class) -public class TestAutokey{ +public class AutokeyTest{ @InjectMocks private Autokey cipher; @Mock(name = "com.mattrixwv.cipherstream.monosubstitution.Autokey") private Logger logger; //Variables - private String decodedString = "MeSsage to^encode"; - private String decodedStringClean = "MESSAGETOENCODE"; - private String encodedString = "WiQooxh fs^wfcuhx"; - private String encodedStringClean = "WIQOOXHFSWFCUHX"; - private String keyword = "keyword"; - private ArrayList offset = new ArrayList<>(List.of(10, 4, 24, 22, 14, 17, 3, 12, 4, 18, 18, 0, 6, 4, 19)); + private static final String decodedString = "MeSsage to^encode"; + private static final String decodedStringClean = "MESSAGETOENCODE"; + private static final String encodedString = "WiQooxh fs^wfcuhx"; + private static final String encodedStringClean = "WIQOOXHFSWFCUHX"; + private static final String keyword = "keyword"; + private static final ArrayList offset = new ArrayList<>(List.of(10, 4, 24, 22, 14, 17, 3, 12, 4, 18, 18, 0, 6, 4, 19)); @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestBaconian.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/BaconianTest.java similarity index 91% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestBaconian.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/BaconianTest.java index 823b9dd..558d61a 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestBaconian.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/BaconianTest.java @@ -1,21 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/TestBaconian.java +//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/BaconianTest.java //Mattrixwv // Created: 01-12-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -29,16 +21,16 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException; @ExtendWith(MockitoExtension.class) -public class TestBaconian{ +public class BaconianTest{ @InjectMocks private Baconian cipher; @Mock private Logger logger; //Variables - private String decodedString = "Message to-encode"; - private String decodedStringClean = "Messagetoencode"; - private String decodedStringCleanLower = "messagetoencode"; - private String encodedString = "ABABB aabaa baaab baaab aaaaa aabba aabaa baaba abbab aabaa abbaa aaaba abbab aaabb aabaa"; + private static final String decodedString = "Message to-encode"; + private static final String decodedStringClean = "Messagetoencode"; + private static final String decodedStringCleanLower = "messagetoencode"; + private static final String encodedString = "ABABB aabaa baaab baaab aaaaa aabba aabaa baaba abbab aabaa abbaa aaaba abbab aaabb aabaa"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestBaseX.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/BaseXTest.java similarity index 90% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestBaseX.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/BaseXTest.java index 4f0315b..f55fd99 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestBaseX.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/BaseXTest.java @@ -1,19 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/monoSubstitution/TestBaseX.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/monosubstitution/BaseXTest.java //Mattrixwv // Created: 01-08-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -28,17 +22,17 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException; @ExtendWith(MockitoExtension.class) -public class TestBaseX{ +public class BaseXTest{ @InjectMocks private BaseX cipher; @Mock private Logger logger; //Variables - private String decodedString = "A+B@C d\te\nf"; - private String encodedString_2 = "1000001 101011 1000010 1000000 1000011 100000 1100100 1001 1100101 1010 1100110"; - private String encodedString_8 = "101 53 102 100 103 40 144 11 145 12 146"; - private String encodedString_10 = "65 43 66 64 67 32 100 9 101 10 102"; - private String encodedString_16 = "41 2B 42 40 43 20 64 9 65 A 66"; + private static final String decodedString = "A+B@C d\te\nf"; + private static final String encodedString_2 = "1000001 101011 1000010 1000000 1000011 100000 1100100 1001 1100101 1010 1100110"; + private static final String encodedString_8 = "101 53 102 100 103 40 144 11 145 12 146"; + private static final String encodedString_10 = "65 43 66 64 67 32 100 9 101 10 102"; + private static final String encodedString_16 = "41 2B 42 40 43 20 64 9 65 A 66"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestBeaufort.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/BeaufortTest.java similarity index 92% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestBeaufort.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/BeaufortTest.java index e8fb27c..a5851c8 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestBeaufort.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/BeaufortTest.java @@ -1,19 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/monoSubstitution/TestBeaufort.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/monosubstitution/BeaufortTest.java //Mattrixwv // Created: 02-23-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -27,18 +21,18 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; @ExtendWith(MockitoExtension.class) -public class TestBeaufort{ +public class BeaufortTest{ @InjectMocks private Beaufort cipher; @Mock private Logger logger; //Variables - private String decodedString = "Message to^encode"; - private String decodedStringClean = "MESSAGETOENCODE"; - private String encodedString = "Yageolz rq^ujmdag"; - private String encodedStringClean = "YAGEOLZRQUJMDAG"; - private String keyword = "Ke*y word"; - private String keywordClean = "KEYWORD"; + private static final String decodedString = "Message to^encode"; + private static final String decodedStringClean = "MESSAGETOENCODE"; + private static final String encodedString = "Yageolz rq^ujmdag"; + private static final String encodedStringClean = "YAGEOLZRQUJMDAG"; + private static final String keyword = "Ke*y word"; + private static final String keywordClean = "KEYWORD"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestCaesar.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/CaesarTest.java similarity index 93% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestCaesar.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/CaesarTest.java index 80ad9d2..2cfdcf9 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestCaesar.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/CaesarTest.java @@ -1,19 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/TestCaesar.java +//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/CaesarTest.java //Matthew Ellison // Created: 07-25-21 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -26,17 +20,17 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException; @ExtendWith(MockitoExtension.class) -public class TestCaesar{ +public class CaesarTest{ @InjectMocks private Caesar cipher; @Mock private Logger logger; //Variables - private String decodedString = "The quick brown fox jumps over - the lAzy dog"; - private String decodedStringClean = "thequickbrownfoxjumpsoverthelazydog"; - private String encodedString = "Qeb nrfzh yoltk clu grjmp lsbo - qeb iXwv ald"; - private String encodedStringClean = "qebnrfzhyoltkclugrjmplsboqebixwvald"; - private int shift = 23; + private static final String decodedString = "The quick brown fox jumps over - the lAzy dog"; + private static final String decodedStringClean = "thequickbrownfoxjumpsoverthelazydog"; + private static final String encodedString = "Qeb nrfzh yoltk clu grjmp lsbo - qeb iXwv ald"; + private static final String encodedStringClean = "qebnrfzhyoltkclugrjmplsboqebixwvald"; + private static final int shift = 23; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestOneTimePad.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/OneTimePadTest.java similarity index 86% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestOneTimePad.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/OneTimePadTest.java index df5fecb..ac47b45 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestOneTimePad.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/OneTimePadTest.java @@ -1,18 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/monoSubstitution/TestOneTimePad.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/monosubstitution/OneTimePadTest.java //Mattrixwv // Created: 02-23-22 //Modified: 05-04-23 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import java.util.ArrayList; import java.util.Arrays; @@ -28,18 +23,18 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; @ExtendWith(MockitoExtension.class) -public class TestOneTimePad{ +public class OneTimePadTest{ @InjectMocks private OneTimePad cipher; @Mock(name = "com.mattrixwv.cipherstream.monosubstitution.OneTimePad") private Logger logger; //Variables - private String decodedString = "Message to^encode"; - private String decodedStringClean = "MESSAGETOENCODE"; - private String encodedString = "Wiqooxh mv^egkgws"; - private String encodedStringClean = "WIQOOXHMVEGKGWS"; - private String keyword = "keywordThatIsTotallyRandom"; - private ArrayList offset = new ArrayList<>(Arrays.asList(10, 4, 24, 22, 14, 17, 3, 19, 7, 0, 19, 8, 18, 19, 14, 19, 0, 11, 11, 24, 17, 0, 13, 3, 14, 12)); + private static final String decodedString = "Message to^encode"; + private static final String decodedStringClean = "MESSAGETOENCODE"; + private static final String encodedString = "Wiqooxh mv^egkgws"; + private static final String encodedStringClean = "WIQOOXHMVEGKGWS"; + private static final String keyword = "keywordThatIsTotallyRandom"; + private static final ArrayList offset = new ArrayList<>(Arrays.asList(10, 4, 24, 22, 14, 17, 3, 19, 7, 0, 19, 8, 18, 19, 14, 19, 0, 11, 11, 24, 17, 0, 13, 3, 14, 12)); @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestPorta.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/PortaTest.java similarity index 95% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestPorta.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/PortaTest.java index 30139dc..55badd9 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestPorta.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/PortaTest.java @@ -1,20 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/monoSubstitution/TestPorta.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/monosubstitution/PortaTest.java //Mattrixwv // Created: 02-28-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -28,18 +21,18 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; @ExtendWith(MockitoExtension.class) -public class TestPorta{ +public class PortaTest{ @InjectMocks private Porta cipher; @Mock private Logger logger; //Variables - private String decodedString = "Message to^encode"; - private String decodedStringClean = "MESSAGETOENCODE"; - private String encodedString = "Rtghuos bm^qcwgrw"; - private String encodedStringClean = "RTGHUOSBMQCWGRW"; - private String keyword = "keyword"; - private String keywordDirty = "Ke yw*ord"; + private static final String decodedString = "Message to^encode"; + private static final String decodedStringClean = "MESSAGETOENCODE"; + private static final String encodedString = "Rtghuos bm^qcwgrw"; + private static final String encodedStringClean = "RTGHUOSBMQCWGRW"; + private static final String keyword = "keyword"; + private static final String keywordDirty = "Ke yw*ord"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestSubstitution.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/SubstitutionTest.java similarity index 91% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestSubstitution.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/SubstitutionTest.java index aaa3c4c..4fec132 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestSubstitution.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/SubstitutionTest.java @@ -1,20 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/monoSubstitution/TestSubstitution.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/monosubstitution/SubstitutionTest.java //Mattrixwv // Created: 02-22-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -28,24 +21,24 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; @ExtendWith(MockitoExtension.class) -public class TestSubstitution{ +public class SubstitutionTest{ @InjectMocks private Substitution cipher; @Mock private Logger logger; //Variables - private String decodedString = "Message to^encode"; - private String decodedStringClean = "MESSAGETOENCODE"; - private String decodedStringAlNum = "Message to^encode 123"; - private String decodedStringAlNumClean = "MESSAGETOENCODE"; - private String encodedString = "Oguucig vq^gpeqfg"; - private String encodedStringClean = "OGUUCIGVQGPEQFG"; - private String encodedStringAlNum = "Oguucig vq^gpeqfg 876"; - private String encodedStringAlNumClean = "OGUUCIGVQGPEQFG"; - private String keyword = "cdefghijklmnopqrstuvwxyzab"; - private String keywordClean = "CDEFGHIJKLMNOPQRSTUVWXYZAB"; - private String keywordAlNum = "cdefghijklmnopqrstuvwxyzab9876543210"; - private String keywordAlNumClean = "CDEFGHIJKLMNOPQRSTUVWXYZAB9876543210"; + private static final String decodedString = "Message to^encode"; + private static final String decodedStringClean = "MESSAGETOENCODE"; + private static final String decodedStringAlNum = "Message to^encode 123"; + private static final String decodedStringAlNumClean = "MESSAGETOENCODE"; + private static final String encodedString = "Oguucig vq^gpeqfg"; + private static final String encodedStringClean = "OGUUCIGVQGPEQFG"; + private static final String encodedStringAlNum = "Oguucig vq^gpeqfg 876"; + private static final String encodedStringAlNumClean = "OGUUCIGVQGPEQFG"; + private static final String keyword = "cdefghijklmnopqrstuvwxyzab"; + private static final String keywordClean = "CDEFGHIJKLMNOPQRSTUVWXYZAB"; + private static final String keywordAlNum = "cdefghijklmnopqrstuvwxyzab9876543210"; + private static final String keywordAlNumClean = "CDEFGHIJKLMNOPQRSTUVWXYZAB9876543210"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestVigenere.java b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/VigenereTest.java similarity index 92% rename from src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestVigenere.java rename to src/test/java/com/mattrixwv/cipherstream/monosubstitution/VigenereTest.java index 4c0c0d8..3846bf8 100644 --- a/src/test/java/com/mattrixwv/cipherstream/monosubstitution/TestVigenere.java +++ b/src/test/java/com/mattrixwv/cipherstream/monosubstitution/VigenereTest.java @@ -1,20 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/monoSubstitution/TestVigenere.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/monosubstitution/VigenereTest.java //Mattrixwv // Created: 07-25-21 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.monosubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import java.util.ArrayList; import java.util.List; @@ -31,18 +24,18 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; @ExtendWith(MockitoExtension.class) -public class TestVigenere{ +public class VigenereTest{ @InjectMocks private Vigenere cipher; @Mock private Logger logger; //Variables - private String inputString = "MeSsage to^encode"; - private String inputStringClean = "MESSAGETOENCODE"; - private String outputString = "WiQooxh ds^cjqfgo"; - private String outputStringClean = "WIQOOXHDSCJQFGO"; - private String keyword = "ke yw*ord"; - private String keywordClean = "KEYWORD"; + private static final String inputString = "MeSsage to^encode"; + private static final String inputStringClean = "MESSAGETOENCODE"; + private static final String outputString = "WiQooxh ds^cjqfgo"; + private static final String outputStringClean = "WIQOOXHDSCJQFGO"; + private static final String keyword = "ke yw*ord"; + private static final String keywordClean = "KEYWORD"; private ArrayList offset = new ArrayList<>(List.of(10, 4, 24, 22, 14, 17, 3)); diff --git a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestBifid.java b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/BifidTest.java similarity index 90% rename from src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestBifid.java rename to src/test/java/com/mattrixwv/cipherstream/polysubstitution/BifidTest.java index e698965..578b0a9 100644 --- a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestBifid.java +++ b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/BifidTest.java @@ -1,21 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/polySubstitution/TestBifid.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/polysubstitution/BifidTest.java //Mattrixwv // Created: 03-03-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.polysubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -29,18 +21,18 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; @ExtendWith(MockitoExtension.class) -public class TestBifid{ +public class BifidTest{ @InjectMocks private Bifid cipher; @Mock private Logger logger; //Test - private String inputString = "Message to^encode"; - private String inputStringClean = "MESSAGETOENCODE"; - private String outputString = "Mqaokne kc^vdodzd"; - private String outputStringClean = "MQAOKNEKCVDODZD"; - private String keyword = "keyword"; - private String keywordClean = "KEYWORDABCFGHILMNPQSTUVXZ"; + private static final String inputString = "Message to^encode"; + private static final String inputStringClean = "MESSAGETOENCODE"; + private static final String outputString = "Mqaokne kc^vdodzd"; + private static final String outputStringClean = "MQAOKNEKCVDODZD"; + private static final String keyword = "keyword"; + private static final String keywordClean = "KEYWORDABCFGHILMNPQSTUVXZ"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestColumnar.java b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/ColumnarTest.java similarity index 95% rename from src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestColumnar.java rename to src/test/java/com/mattrixwv/cipherstream/polysubstitution/ColumnarTest.java index 96ff9c9..aadd15c 100644 --- a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestColumnar.java +++ b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/ColumnarTest.java @@ -1,21 +1,13 @@ -//Mattrixwv/src/test/java/com/mattrixwv/CipherStreamJava/polySubstitution/TestColumnar.java +//Mattrixwv/src/test/java/com/mattrixwv/cipherstream/polysubstitution/ColumnarTest.java //Mattrixwv // Created: 01-16-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.polysubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import java.util.ArrayList; import java.util.List; @@ -33,23 +25,23 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; @ExtendWith(MockitoExtension.class) -public class TestColumnar{ +public class ColumnarTest{ @InjectMocks private Columnar cipher; @Mock private Logger logger; //Variables - private String decodedString = "Message to*encode"; - private String decodedStringPadded = "Message to*encodexxxxxx"; - private String decodedStringClean = "MESSAGETOENCODEXXXXXX"; - private String encodedString = "Edeomte ac*gosnse"; + private static final String decodedString = "Message to*encode"; + private static final String decodedStringPadded = "Message to*encodexxxxxx"; + private static final String decodedStringClean = "MESSAGETOENCODEXXXXXX"; + private static final String encodedString = "Edeomte ac*gosnse"; //TODO: This is a bug that needs fixed - private String encodedStringPadingAdded = "Edxeoxmte ac*xgoxsnxsex"; //When padding is added to outputString for decoding - private String encodedStringPadded = "Edxeoxm te*acxgoxsnxsex"; //When padding is left in outputString - private String encodedStringClean = "EDXEOXMTEACXGOXSNXSEX"; - private String keyword = "ke yw*ord"; - private String keywordClean = "KEYWORD"; - private ArrayList> encodeGrid = new ArrayList<>( + private static final String encodedStringPadingAdded = "Edxeoxmte ac*xgoxsnxsex"; //When padding is added to outputString for decoding + private static final String encodedStringPadded = "Edxeoxm te*acxgoxsnxsex"; //When padding is left in outputString + private static final String encodedStringClean = "EDXEOXMTEACXGOXSNXSEX"; + private static final String keyword = "ke yw*ord"; + private static final String keywordClean = "KEYWORD"; + private static final ArrayList> encodeGrid = new ArrayList<>( List.of( new ArrayList<>( List.of('K', 'E', 'Y', 'W', 'O', 'R', 'D') @@ -65,7 +57,7 @@ public class TestColumnar{ ) ) ); - private ArrayList> decodeGrid = new ArrayList<>( + private static final ArrayList> decodeGrid = new ArrayList<>( List.of( new ArrayList<>( List.of('D', 'E', 'K', 'O', 'R', 'W', 'Y') diff --git a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestHill.java b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/HillTest.java similarity index 95% rename from src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestHill.java rename to src/test/java/com/mattrixwv/cipherstream/polysubstitution/HillTest.java index fa70e71..4aafa5b 100644 --- a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestHill.java +++ b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/HillTest.java @@ -1,22 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamjava/polySubstitution/TestHill.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/polysubstitution/HillTest.java //Mattrixwv // Created: 01-31-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.polysubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import java.util.ArrayList; @@ -34,19 +25,19 @@ import com.mattrixwv.matrix.ModMatrix; @ExtendWith(MockitoExtension.class) -public class TestHill{ +public class HillTest{ @InjectMocks private Hill cipher; @Mock private Logger logger; //Fields - private String decodedString = "Message to^encoded"; - private String decodedStringPadded = "Message to^encodedxx"; - private String decodedStringClean = "MESSAGETOENCODEDXX"; - private String encodedString = "Mgkeqge ul^ikhisplrd"; - private String encodedStringClean = "MGKEQGEULIKHISPLRD"; - private int[][] keyArray = new int[][]{{1, 4, 2}, {2, 4, 1}, {4, 1, 2}}; - private ModMatrix key = new ModMatrix(keyArray, 26); + private static final String decodedString = "Message to^encoded"; + private static final String decodedStringPadded = "Message to^encodedxx"; + private static final String decodedStringClean = "MESSAGETOENCODEDXX"; + private static final String encodedString = "Mgkeqge ul^ikhisplrd"; + private static final String encodedStringClean = "MGKEQGEULIKHISPLRD"; + private static final int[][] keyArray = new int[][]{{1, 4, 2}, {2, 4, 1}, {4, 1, 2}}; + private static final ModMatrix key = new ModMatrix(keyArray, 26); @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestLargePolybiusSquare.java b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/LargePolybiusSquareTest.java similarity index 90% rename from src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestLargePolybiusSquare.java rename to src/test/java/com/mattrixwv/cipherstream/polysubstitution/LargePolybiusSquareTest.java index 91f276e..600d900 100644 --- a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestLargePolybiusSquare.java +++ b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/LargePolybiusSquareTest.java @@ -1,21 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestLargePolybiusSquare.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/polysubstitution/LargePolybiusSquareTest.java //Mattrixwv // Created: 04-21-23 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.polysubstitution; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -29,20 +21,20 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException; @ExtendWith(MockitoExtension.class) -public class TestLargePolybiusSquare{ +public class LargePolybiusSquareTest{ @InjectMocks private LargePolybiusSquare cipher; @Mock(name = "com.mattrixwv.cipherstream.polysubstitution.LargePolybiusSquare") private Logger logger; //Variables - private String decodedString = "Message to^encode"; - private String decodedStringClean = "MESSAGETOENCODE"; - private String encodedString = "35124343222612 4415^123624152112"; - private String encodedStringClean = "31 15 41 41 11 21 15 42 33 15 32 13 33 14 15"; - private String keyword = "ke yw*ord"; - private String keywordClean = "KEYWORDABCFGHIJLMNPQSTUVXZ0123456789"; - private String keywordBlank = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - private char[][] grid = { + private static final String decodedString = "Message to^encode"; + private static final String decodedStringClean = "MESSAGETOENCODE"; + private static final String encodedString = "35124343222612 4415^123624152112"; + private static final String encodedStringClean = "31 15 41 41 11 21 15 42 33 15 32 13 33 14 15"; + private static final String keyword = "ke yw*ord"; + private static final String keywordClean = "KEYWORDABCFGHIJLMNPQSTUVXZ0123456789"; + private static final String keywordBlank = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + private static final char[][] grid = { {'K', 'E', 'Y', 'W', 'O', 'R'}, {'D', 'A', 'B', 'C', 'F', 'G'}, {'H', 'I', 'J', 'L', 'M', 'N'}, @@ -50,7 +42,7 @@ public class TestLargePolybiusSquare{ {'X', 'Z', '0', '1', '2', '3'}, {'4', '5', '6', '7', '8', '9'} }; - private char[][] gridClean = { + private static final char[][] gridClean = { {'A', 'B', 'C', 'D', 'E', 'F'}, {'G', 'H', 'I', 'J', 'K', 'L'}, {'M', 'N', 'O', 'P', 'Q', 'R'}, diff --git a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestMorse.java b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/MorseTest.java similarity index 91% rename from src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestMorse.java rename to src/test/java/com/mattrixwv/cipherstream/polysubstitution/MorseTest.java index 2998568..5bee861 100644 --- a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestMorse.java +++ b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/MorseTest.java @@ -1,18 +1,13 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/TestMorse.java +//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/MoresTest.java //Matthew Ellison // Created: 07-28-21 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.polysubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -25,15 +20,15 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException; @ExtendWith(MockitoExtension.class) -public class TestMorse{ +public class MorseTest{ @InjectMocks private Morse cipher; @Mock private Logger logger; //Fields - private String inputString = "Message to^encode123"; - private String inputStringClean = "MESSAGETOENCODE123"; - private String outputString = "-- . ... ... .- --. . - --- . -. -.-. --- -.. . .---- ..--- ...--"; + private static final String inputString = "Message to^encode123"; + private static final String inputStringClean = "MESSAGETOENCODE123"; + private static final String outputString = "-- . ... ... .- --. . - --- . -. -.-. --- -.. . .---- ..--- ...--"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestPlayfair.java b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/PlayfairTest.java similarity index 96% rename from src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestPlayfair.java rename to src/test/java/com/mattrixwv/cipherstream/polysubstitution/PlayfairTest.java index dc26ed2..5ddefac 100644 --- a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestPlayfair.java +++ b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/PlayfairTest.java @@ -1,23 +1,13 @@ -//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/TestPlayfair.java +//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/PlayfairTest.java //Matthew Ellison // Created: 07-30-21 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.polysubstitution; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -33,20 +23,20 @@ import com.mattrixwv.cipherstream.polysubstitution.Playfair.CharLocation; @ExtendWith(MockitoExtension.class) -public class TestPlayfair{ +public class PlayfairTest{ @InjectMocks private Playfair cipher; @Mock private Logger logger; //Fields - private String decodedString = "Hide the gold in - the@tree+stump"; - private String decodedStringPadded = "Hide the gold in - the@trexe+stump"; - private String decodedStringClean = "HIDETHEGOLDINTHETREXESTUMP"; - private String encodedString = "Bmod zbx dnab ek - udm@uixmm+ouvif"; - private String encodedStringClean = "BMODZBXDNABEKUDMUIXMMOUVIF"; - private String keyword = "Play-fair@Exam ple"; - private String keywordClean = "PLAYFIREXMBCDGHKNOQSTUVWZ"; - private char[][] grid = new char[][]{ + private static final String decodedString = "Hide the gold in - the@tree+stump"; + private static final String decodedStringPadded = "Hide the gold in - the@trexe+stump"; + private static final String decodedStringClean = "HIDETHEGOLDINTHETREXESTUMP"; + private static final String encodedString = "Bmod zbx dnab ek - udm@uixmm+ouvif"; + private static final String encodedStringClean = "BMODZBXDNABEKUDMUIXMMOUVIF"; + private static final String keyword = "Play-fair@Exam ple"; + private static final String keywordClean = "PLAYFIREXMBCDGHKNOQSTUVWZ"; + private static final char[][] grid = new char[][]{ {'P', 'L', 'A', 'Y', 'F'}, {'I', 'R', 'E', 'X', 'M'}, {'B', 'C', 'D', 'G', 'H'}, diff --git a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestPolybiusSquare.java b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/PolybiusSquareTest.java similarity index 95% rename from src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestPolybiusSquare.java rename to src/test/java/com/mattrixwv/cipherstream/polysubstitution/PolybiusSquareTest.java index 64be3ea..f316722 100644 --- a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestPolybiusSquare.java +++ b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/PolybiusSquareTest.java @@ -1,22 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/TestPolybiusSquare.java +//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/PolybiusSquareTest.java //Mattrixwv // Created: 01-04-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.polysubstitution; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -32,26 +23,26 @@ import com.mattrixwv.cipherstream.polysubstitution.PolybiusSquare.CharLocation; @ExtendWith(MockitoExtension.class) -public class TestPolybiusSquare{ +public class PolybiusSquareTest{ @InjectMocks private PolybiusSquare cipher; @Mock private Logger logger; //Fields - private String decodedString = "Message to^encode"; - private String decodedStringClean = "M E S S A G E T O E N C O D E"; - private String encodedString = "41124545233212 5115^124225152212"; - private String encodedStringClean = "41 12 45 45 23 32 12 51 15 12 42 25 15 22 12"; - private String keyword = "ke yw*ord"; - private String keywordClean = "KEYWORDABCFGHILMNPQSTUVXZ"; - private char[][] grid = new char[][]{ + private static final String decodedString = "Message to^encode"; + private static final String decodedStringClean = "M E S S A G E T O E N C O D E"; + private static final String encodedString = "41124545233212 5115^124225152212"; + private static final String encodedStringClean = "41 12 45 45 23 32 12 51 15 12 42 25 15 22 12"; + private static final String keyword = "ke yw*ord"; + private static final String keywordClean = "KEYWORDABCFGHILMNPQSTUVXZ"; + private static final char[][] grid = new char[][]{ {'K', 'E', 'Y', 'W', 'O'}, {'R', 'D', 'A', 'B', 'C'}, {'F', 'G', 'H', 'I', 'L'}, {'M', 'N', 'P', 'Q', 'S'}, {'T', 'U', 'V', 'X', 'Z'} }; - private String gridString = "[K E Y W O]\n[R D A B C]\n[F G H I L]\n[M N P Q S]\n[T U V X Z]"; + private static final String gridString = "[K E Y W O]\n[R D A B C]\n[F G H I L]\n[M N P Q S]\n[T U V X Z]"; @Test diff --git a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestRailFence.java b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/RailFenceTest.java similarity index 92% rename from src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestRailFence.java rename to src/test/java/com/mattrixwv/cipherstream/polysubstitution/RailFenceTest.java index c79d64b..57f7498 100644 --- a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestRailFence.java +++ b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/RailFenceTest.java @@ -1,23 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/polySubstitution/TestRailFence.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/polysubstitution/RailFenceTest.java //Mattrixwv // Created: 03-21-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.polysubstitution; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -31,24 +21,24 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException; @ExtendWith(MockitoExtension.class) -public class TestRailFence{ +public class RailFenceTest{ @InjectMocks private RailFence cipher; @Mock private Logger logger; //Fields - private String decodedString = "Message to^encode"; - private String decodedStringClean = "MESSAGETOENCODE"; - private String encodedString3 = "Maooesg te^cdsene"; - private String encodedString3Clean = "MAOOESGTECDSENE"; - private String encodedString5 = "Moetese ne^sgcdao"; - private String encodedString5Clean = "MOETESENESGCDAO"; - private StringBuilder[] fence3 = new StringBuilder[]{ + private static final String decodedString = "Message to^encode"; + private static final String decodedStringClean = "MESSAGETOENCODE"; + private static final String encodedString3 = "Maooesg te^cdsene"; + private static final String encodedString3Clean = "MAOOESGTECDSENE"; + private static final String encodedString5 = "Moetese ne^sgcdao"; + private static final String encodedString5Clean = "MOETESENESGCDAO"; + private static final StringBuilder[] fence3 = new StringBuilder[]{ new StringBuilder("Maoo"), new StringBuilder("esgtecd"), new StringBuilder("sene") }; - private StringBuilder[] fence5 = new StringBuilder[]{ + private static final StringBuilder[] fence5 = new StringBuilder[]{ new StringBuilder("Mo"), new StringBuilder("ete"), new StringBuilder("sene"), diff --git a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestTrifid.java b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TrifidTest.java similarity index 93% rename from src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestTrifid.java rename to src/test/java/com/mattrixwv/cipherstream/polysubstitution/TrifidTest.java index 3bb65ef..7e59960 100644 --- a/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TestTrifid.java +++ b/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TrifidTest.java @@ -1,22 +1,13 @@ -//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/polySubstitution/TestTrifid.java +//CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/polysubstitution/TrifidTest.java //Mattrixwv // Created: 03-03-22 -//Modified: 05-04-23 +//Modified: 04-19-24 package com.mattrixwv.cipherstream.polysubstitution; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.anyChar; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -35,25 +26,25 @@ import com.mattrixwv.cipherstream.polysubstitution.Trifid.CharLocation; @ExtendWith(MockitoExtension.class) -public class TestTrifid{ +public class TrifidTest{ @InjectMocks private Trifid cipher; @Mock private Logger logger; //Fields - private String decodedString = "Message to^encode+"; - private String decodedStringClean = "MESSAGETOENCODE+"; - private String decodedStringCleanAlt = "MESSAGETOENCODE"; - private String encodedString = "Gqdokxy eg^ranmoqr"; - private String encodedStringAlt = "Gqdokpd od^ljvflf+"; - private String encodedString3 = "Gpjqdvd of^odlklf+"; - private String encodedStringClean = "GQDOKXYEGRANMOQR"; - private String encodedStringCleanAlt = "GQDOKPDODLJVFLF"; - private String encodedStringClean3 = "GPJQDVDOFODLKLF+"; - private String keyword = "ke yw*ord"; - private String keywordClean = "KEYWORDABCFGHIJLMNPQSTUVXZ+"; - private String keywordCleanAlt = "KEYWORDABCFGHIJLMNPQSTUVXZ="; - private char[][][] grid = new char[][][]{ + private static final String decodedString = "Message to^encode+"; + private static final String decodedStringClean = "MESSAGETOENCODE+"; + private static final String decodedStringCleanAlt = "MESSAGETOENCODE"; + private static final String encodedString = "Gqdokxy eg^ranmoqr"; + private static final String encodedStringAlt = "Gqdokpd od^ljvflf+"; + private static final String encodedString3 = "Gpjqdvd of^odlklf+"; + private static final String encodedStringClean = "GQDOKXYEGRANMOQR"; + private static final String encodedStringCleanAlt = "GQDOKPDODLJVFLF"; + private static final String encodedStringClean3 = "GPJQDVDOFODLKLF+"; + private static final String keyword = "ke yw*ord"; + private static final String keywordClean = "KEYWORDABCFGHIJLMNPQSTUVXZ+"; + private static final String keywordCleanAlt = "KEYWORDABCFGHIJLMNPQSTUVXZ="; + private static final char[][][] grid = new char[][][]{ { {'K', 'E', 'Y'}, {'W', 'O', 'R'}, @@ -70,8 +61,8 @@ public class TestTrifid{ {'X', 'Z', '+'} } }; - private String gridString = "[K E Y]\n[W O R]\n[D A B]\n\n[C F G]\n[H I J]\n[L M N]\n\n[P Q S]\n[T U V]\n[X Z +]"; - private char[][][] gridAlt = new char[][][]{ + private static final String gridString = "[K E Y]\n[W O R]\n[D A B]\n\n[C F G]\n[H I J]\n[L M N]\n\n[P Q S]\n[T U V]\n[X Z +]"; + private static final char[][][] gridAlt = new char[][][]{ { {'K', 'E', 'Y'}, {'W', 'O', 'R'},