### Question:
KeyConversion { public String encryptKey(SessionID key) { try { return SessionUtils.getEncryptedStorageKey(key); } catch (Exception e) { String message = MessageFormat.format( "Failed to create encrypted storage key for:\n" + "Session ID: {0}", key); throw new IllegalStateException(message, e); } }  String encodeKey(final String key); String decodeKey(final String hexEncodedKey); String encryptKey(SessionID key);  }### Answer:
@Test public void shouldNotFailToEncryptKey() { SessionID key = mock(SessionID.class); SessionIDExtensions extensions = mock(SessionIDExtensions.class); given(key.getExtension()).willReturn(extensions); given(extensions.getStorageKey()).willReturn("badger"); KeyConversion conversion = new KeyConversion(); String result = conversion.encryptKey(key); assertNotNull(result); }
@Test public void shouldNotFailToEncryptKey() { SessionID key = mock(SessionID.class); given(key.getExtension(SessionID.STORAGE_KEY)).willReturn("badger"); KeyConversion conversion = new KeyConversion(); String result = conversion.encryptKey(key); assertNotNull(result); }