Sonarqube fixes

This commit is contained in:
2023-04-29 11:38:32 -04:00
parent bbcd6ea416
commit b3ca4754ea
3 changed files with 13 additions and 6 deletions

View File

@@ -272,7 +272,7 @@ public class Columnar{
//Save and return the output //Save and return the output
outputString = output.toString(); outputString = output.toString();
logger.debug("Output string '{}'", output.toString()); logger.debug("Output string '{}'", outputString);
} }
protected void createOutputStringFromRows(){ protected void createOutputStringFromRows(){
logger.debug("Creating output string for decoding"); logger.debug("Creating output string for decoding");

View File

@@ -193,8 +193,9 @@ public class Hill{
} }
} }
logger.debug("Polished string '{}'", outputBuilder.toString()); String cleanString = outputBuilder.toString();
return outputBuilder.toString(); logger.debug("Polished string '{}'", cleanString);
return cleanString;
} }
protected ArrayList<ModMatrix> getInputVectors(){ protected ArrayList<ModMatrix> getInputVectors(){
logger.debug("Generating input vectors"); logger.debug("Generating input vectors");

View File

@@ -157,8 +157,10 @@ public class TestHill{
@Test @Test
public void testSetKey_invalidMod(){ public void testSetKey_invalidMod(){
ModMatrix matrix = new ModMatrix(keyArray, 30);
assertThrows(InvalidKeyException.class, () -> { assertThrows(InvalidKeyException.class, () -> {
cipher.setKey(new ModMatrix(keyArray, 30)); cipher.setKey(matrix);
}); });
assertEquals(new ModMatrix(26), cipher.key); assertEquals(new ModMatrix(26), cipher.key);
@@ -171,8 +173,10 @@ public class TestHill{
@Test @Test
public void testSetKey_NotSquare(){ public void testSetKey_NotSquare(){
ModMatrix matrix = new ModMatrix(new int[][]{{10, 11}}, 26);
assertThrows(InvalidKeyException.class, () -> { assertThrows(InvalidKeyException.class, () -> {
cipher.setKey(new ModMatrix(new int[][]{{10, 11}}, 26)); cipher.setKey(matrix);
}); });
assertEquals(new ModMatrix(26), cipher.key); assertEquals(new ModMatrix(26), cipher.key);
@@ -185,8 +189,10 @@ public class TestHill{
@Test @Test
public void testSetKey_notInvertable(){ public void testSetKey_notInvertable(){
ModMatrix matrix = new ModMatrix(new int[][]{{10, 11}, {12, 13}}, 26);
assertThrows(InvalidKeyException.class, () -> { assertThrows(InvalidKeyException.class, () -> {
cipher.setKey(new ModMatrix(new int[][]{{10, 11}, {12, 13}}, 26)); cipher.setKey(matrix);
}); });
assertEquals(new ModMatrix(26), cipher.key); assertEquals(new ModMatrix(26), cipher.key);