### Question:
CryptographyUtils { @Nullable public static String decrypt(@Nullable final String value, @NonNull final Decrypto decrypto) { if (value == null || value.length() == 0) { return value; } try { return new String( decrypto.decrypt(Base64.decode(value.getBytes(Cryptography.CHARSET_NAME), Base64.DEFAULT)), Cryptography.CHARSET_NAME ); } catch (UnsupportedEncodingException e) { e.printStackTrace(); throw new AssertionError(Cryptography.CHARSET_NAME + " encoding is not supported!"); } } private  CryptographyUtils(); @Nullable static String encrypt(@Nullable final String value, @NonNull final Encrypto encrypto); @Nullable static String decrypt(@Nullable final String value, @NonNull final Decrypto decrypto); @Nullable static String makeSHA1(@Nullable final String value);  }### Answer:
@Test public void testDecryptEmptyValue() { final Decrypto mockDecrypto = mock(Decrypto.class); final String decrypted = CryptographyUtils.decrypt("", mockDecrypto); assertThat(decrypted, is("")); verifyZeroInteractions(mockDecrypto); }
@SuppressWarnings("ConstantConditions") @Test public void testDecryptNullValue() { final Decrypto mockDecrypto = mock(Decrypto.class); final String decrypted = CryptographyUtils.decrypt(null, mockDecrypto); assertThat(decrypted, is(nullValue())); verifyZeroInteractions(mockDecrypto); }
@Test public void testDecrypt() throws Exception { final Decrypto mockDecrypto = mock(Decrypto.class); final byte[] decodedDataBytes = Base64.decode("android", Base64.DEFAULT); when(mockDecrypto.decrypt(decodedDataBytes)).thenReturn("android".getBytes(Cryptography.CHARSET_NAME)); final String decrypted = CryptographyUtils.decrypt("android", mockDecrypto); assertThat(decrypted, is("android")); verify(mockDecrypto).decrypt(decodedDataBytes); }