Update error messages and test names
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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());
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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<Integer> 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<Integer> offset = new ArrayList<>(List.of(10, 4, 24, 22, 14, 17, 3, 12, 4, 18, 18, 0, 6, 4, 19));
|
||||
|
||||
|
||||
@Test
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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<Integer> 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<Integer> 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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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<Integer> offset = new ArrayList<>(List.of(10, 4, 24, 22, 14, 17, 3));
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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<ArrayList<Character>> 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<ArrayList<Character>> 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<ArrayList<Character>> decodeGrid = new ArrayList<>(
|
||||
private static final ArrayList<ArrayList<Character>> decodeGrid = new ArrayList<>(
|
||||
List.of(
|
||||
new ArrayList<>(
|
||||
List.of('D', 'E', 'K', 'O', 'R', 'W', 'Y')
|
||||
@@ -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
|
||||
@@ -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'},
|
||||
@@ -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
|
||||
@@ -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'},
|
||||
@@ -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
|
||||
@@ -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"),
|
||||
@@ -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'},
|
||||
Reference in New Issue
Block a user