import javax.ws.rs.core.Response;
public class PasswordResourceTest {
@Test
public void testEncodePassword() throws Exception {
final IAuthorizationPolicy policy = Mockito.mock( IAuthorizationPolicy.class );
PasswordResource resource = getPasswordResource( policy );
Mockito.when( policy.isAllowed( AdministerSecurityAction.NAME ) ).thenReturn( true );
Response response = resource.encryptPassword( "password" );
Assert.assertTrue( response.getEntity().toString().contains( "ENC:cGFzc3dvcmQ=" ) );
Assert.assertEquals( 200, response.getStatus() );
Assert.assertEquals( 200, resource.encryptionForm().getStatus() );
}