@Test public void ComparatorTest0() throws IOException, InvalidEncryptionKeyException { when(algCom1.getMaxKeyValue()).thenReturn(4); when(algCom2.getMaxKeyValue()).thenReturn(2); doCallRealMethod().when(algCom1).getKeyStrength(); doCallRealMethod().when(algCom2).getKeyStrength(); AlgorithmComparator com = new AlgorithmComparator(); int expected = com.compare(algCom1, algCom2); int actual = 0; assertEquals(expected, actual); }
@Test public void ComparatorTestMinus1() throws IOException, InvalidEncryptionKeyException { // doubleEncryption.setAlgorithem(alg); when(algCom1.getMaxKeyValue()).thenReturn(4); when(algCom2.getMaxKeyValue()).thenReturn(31); doCallRealMethod().when(algCom1).getKeyStrength(); doCallRealMethod().when(algCom2).getKeyStrength(); // System.out.println(algCom1.getKeyStrength());System.out.println(algCom2.getKeyStrength()); AlgorithmComparator com = new AlgorithmComparator(); int expected = com.compare(algCom1, algCom2); int actual = -1; assertEquals(expected, actual); }