Sonarqube fixes
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user