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

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