예제 #1
0
 @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);
 }
예제 #2
0
 @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);
 }