MavenCipherImpl implements MavenCipher { @Override public String decrypt(final String str, final String passPhrase) { checkNotNull(str); checkNotNull(passPhrase); return doDecrypt(peel(str), passPhrase).toString(); } @Inject  MavenCipherImpl(final CryptoHelper cryptoHelper); @Override String encrypt(final CharSequence str, final String passPhrase); @Override String decrypt(final String str, final String passPhrase); @Override char[] decryptChars(final String str, final String passPhrase); @Override boolean isPasswordCipher(final CharSequence str);  }
@Test public void decrypt_withSpecialChars() throws Exception { String specChar = testSubject.decrypt(plaintext_mixed_encrypted, passPhrase); assertThat(specChar, equalTo(plaintext_spec_char_xtrabracket)); String minimalCase = testSubject.decrypt(plaintext_special_encrypted, passPhrase); assertThat(minimalCase, equalTo(plaintext_special_char)); }
@Test (expected = IllegalArgumentException.class) public void decrypt_NonEncrypted_with_Brackets() throws Exception { testSubject.decrypt(plaintext_mixed, passPhrase); }
@Test public void decrypt() throws Exception { String dec = testSubject.decrypt(encrypted, passPhrase); assertThat(dec, equalTo(plaintext)); }
@Test(expected = IllegalArgumentException.class) public void decryptCorruptedMissingEnd() throws Exception { testSubject.decrypt(plaintext_one_bracket, passPhrase); }
@Test(expected = NullPointerException.class) public void decryptNull() throws Exception { testSubject.decrypt(null, passPhrase); }
@Test(expected = NullPointerException.class) public void decryptNullPassPhrase() throws Exception { testSubject.decrypt(encrypted, null); }
@Test public void masterPasswordCreatedWithMaven304Cli() { String passPhrase = "settings.security"; String plaintext = "123321"; String encrypted = "{KW5k/vol4xMHusz6ikZqdj0t4YRClp4/5Dsb30+M9R0=}"; assertThat(testSubject.decrypt(encrypted, passPhrase), equalTo(plaintext)); }
@Test public void masterPasswordCreatedWithMaven322Cli() { String passPhrase = "settings.security"; String plaintext = "123321"; String encrypted = "{eO8Yc66/I/IHaeg4CoF+/o5bwS5IIyfWcgsYhS0s9W8=}"; assertThat(testSubject.decrypt(encrypted, passPhrase), equalTo(plaintext)); }