Base64PasswordService implements IPasswordService { public String decrypt( String encryptedPassword ) throws PasswordServiceException { return StringUtil.isEmpty( encryptedPassword ) ? encryptedPassword : new String( Base64 .decodeBase64( encryptedPassword.getBytes() ) ); }  String encrypt( String password ); String decrypt( String encryptedPassword );  }
@Test public void testDecryptWhiteSpacePassword( ) throws Exception { res = service.decrypt( "ICAg" ); assertEquals( res, " " ); }
@Test public void testDecryptEmptyPassword( ) throws Exception { res = service.decrypt( "" ); assertEquals( res, "" ); }
@Test public void testDecryptNullPassword( ) throws Exception { res = service.decrypt( null ); assertNull( res ); }
@Test public void testDecryptValidPassword( ) throws Exception { res = service.decrypt( "aGVsbG93b3JsZDEyMzEyIyMkJEAoKCko" ); assertEquals( res, "helloworld12312##$$@(()(" ); }