Updated test coverage

This commit is contained in:
2023-04-17 01:17:59 -04:00
parent 575ff04ecd
commit 494293c311
22 changed files with 2479 additions and 2970 deletions

View File

@@ -1,7 +1,7 @@
//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/monoSubstitution/Beaufort.java
//Mattrixwv
// Created: 02-23-22
//Modified: 07-09-22
//Modified: 04-16-23
package com.mattrixwv.cipherstream.monosubstitution;
@@ -13,19 +13,19 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
public class Beaufort{
private static final Logger logger = LoggerFactory.getLogger(Beaufort.class);
protected static Logger logger = LoggerFactory.getLogger(Beaufort.class);
//Fields
private String inputString; //This is the string that needs encoded/decoded
private String outputString; //This is the string that is output after encoding/decoding
private String keyword; //This is the keyword that is responsible for determining the offsets that you change each character by
private boolean preserveCapitals; //Whether to respect capitals in the output string
private boolean preserveWhitespace; //Whether to respect whitespace in the output string
private boolean preserveSymbols; //Whether to respect symbols in the output string
protected String inputString; //This is the string that needs encoded/decoded
protected String outputString; //This is the string that is output after encoding/decoding
protected String keyword; //This is the keyword that is responsible for determining the offsets that you change each character by
protected boolean preserveCapitals; //Whether to respect capitals in the output string
protected boolean preserveWhitespace; //Whether to respect whitespace in the output string
protected boolean preserveSymbols; //Whether to respect symbols in the output string
//Internal ciphers
private Atbash atbash; //The first step in encoding/decoding the cipher
private Caesar caesar; //The second step in encoding/decoding the cipher
private Vigenere vigenere; //The third step in encoding/decoding the cipher
protected Atbash atbash; //The first step in encoding/decoding the cipher
protected Caesar caesar; //The second step in encoding/decoding the cipher
protected Vigenere vigenere; //The third step in encoding/decoding the cipher
//Ensures inputString constraints
public void setInputString(String inputString) throws InvalidInputException{
@@ -88,9 +88,20 @@ public class Beaufort{
}
}
//Encodes the inputString and stores the result in outputString
public void encode() throws InvalidKeywordException, InvalidInputException{
protected void encode() throws InvalidKeywordException, InvalidInputException{
logger.debug("Encoding");
code();
}
//Decodes the inputString and stores the result in outputString
protected void decode() throws InvalidKeywordException, InvalidInputException{
logger.debug("Decoding");
//Decoding is just encoding again
code();
}
//Codes input and saves to output
protected void code(){
//Reverse the string
logger.debug("Encoding with Atbash");
String atbashString = atbash.encode(inputString);
@@ -106,13 +117,6 @@ public class Beaufort{
logger.debug("Saving output string '{}'", vigenereString);
this.outputString = vigenereString;
}
//Decodes the inputString and stores the result in outputString
public void decode() throws InvalidKeywordException, InvalidInputException{
logger.debug("Decoding");
//Decoding is just encoding again
encode();
}
//Constructor