### Question:
SamlHelper { protected boolean isAssertionEncrypted(org.opensaml.saml2.core.Response samlResponse) { if (samlResponse.getEncryptedAssertions() != null && samlResponse.getEncryptedAssertions().size() != 0) { return true; } return false; }  @PostConstruct void init(); Pair<String, String> createSamlAuthnRequestForRedirect(String destination, boolean forceAuthn, int idpType); org.w3c.dom.Document parseToDoc(String data); String decodeSAMLPostResponse(String encodedReponse); Signature getDigitalSignature(KeyStore.PrivateKeyEntry keystoreEntry); void validateSignature(Response samlResponse, Assertion assertion); LinkedMultiValueMap<String, String> extractAttributesFromResponse(Assertion samlAssertion); String getArtifactUrl(String realmId, String artifact); org.opensaml.saml2.core.Response convertToSAMLResponse(org.w3c.dom.Element element); Assertion getAssertion(org.opensaml.saml2.core.Response samlResponse, KeyStore.PrivateKeyEntry keystoreEntry); void validateStatus(org.opensaml.saml2.core.Response samlResponse); static final Namespace SAML_NS; static final Namespace SAMLP_NS; }### Answer:
@Test public void testIsAssertionEncrypted() { Response samlResponse = Mockito.mock(Response.class); Mockito.when(samlResponse.getEncryptedAssertions()).thenReturn(null); boolean result = samlHelper.isAssertionEncrypted(samlResponse); Assert.assertFalse(result); Mockito.when(samlResponse.getEncryptedAssertions()).thenReturn(new ArrayList<EncryptedAssertion>()); result = samlHelper.isAssertionEncrypted(samlResponse); Assert.assertFalse(result); EncryptedAssertion encryptedAssertion = Mockito.mock(EncryptedAssertion.class); List<EncryptedAssertion> assertionList = new ArrayList<EncryptedAssertion>(); assertionList.add(encryptedAssertion); Mockito.when(samlResponse.getEncryptedAssertions()).thenReturn(assertionList); result = samlHelper.isAssertionEncrypted(samlResponse); Assert.assertTrue(result); }