### Question:
UnknownMethodAlgorithmLogger { public static void probeAssertionForMethodAlgorithm(final Assertion assertion, final String typeOfAssertion) { String prefixAssertion = typeOfAssertion + Assertion.DEFAULT_ELEMENT_LOCAL_NAME; if (assertion != null) { Signature signature = assertion.getSignature(); if (signature != null) { logMethodAlgorithm(Role.IDP, signature, prefixAssertion); } } }  static void probeResponseForMethodAlgorithm(final InboundResponseFromIdp response); static void probeAssertionForMethodAlgorithm(final Assertion assertion, final String typeOfAssertion); static void probeAuthnRequestForMethodAlgorithm(final AuthnRequestFromRelyingParty authnRequest); static final String SIGNATURE_AND_DIGEST_ALGORITHMS_MESSAGE; static final String SIGNATURE_ALGORITHM_MESSAGE; static final String DIGEST_ALGORITHM_MESSAGE; }### Answer:
@Test public void shouldNotReportStrongAlgorithmsInIDPAssertion() throws Exception { Assertion authnStatementAssertion = anAssertion() .withIssuer(anIssuer().withIssuerId(ISSUER_IDP).build()) .buildUnencrypted(); UnknownMethodAlgorithmLogger.probeAssertionForMethodAlgorithm(authnStatementAssertion, AUTHN_STATEMENT); verify(mockAppender, times(0)).doAppend(captorLoggingEvent.capture()); }
@Test public void shouldReportUnknownSignatureAlgorithmInIDPAssertion() throws Exception { Assertion authnStatementAssertion = anAssertion() .withIssuer(anIssuer().withIssuerId(ISSUER_IDP).build()) .withSignature(signatureWithUnknownSignatureAlgorithm.get()) .buildUnencrypted(); UnknownMethodAlgorithmLogger.probeAssertionForMethodAlgorithm(authnStatementAssertion, AUTHN_STATEMENT); verifyLog(mockAppender, captorLoggingEvent, 1, String.format(UnknownMethodAlgorithmLogger.SIGNATURE_ALGORITHM_MESSAGE, IDP, SIGNATURE_RSA_SHA1_ID, AUTHN_STATEMENT + Assertion.DEFAULT_ELEMENT_LOCAL_NAME)); }
@Test public void shouldReportUnknownDigestAlgorithmInIDPAssertion() throws Exception { Assertion authnStatementAssertion = anAssertion() .withId(ID) .withIssuer(anIssuer().withIssuerId(ISSUER_IDP).build()) .withSignature(signatureWithUnknownDigestAlgorithm.get()) .buildUnencrypted(); UnknownMethodAlgorithmLogger.probeAssertionForMethodAlgorithm(authnStatementAssertion, AUTHN_STATEMENT); verifyLog(mockAppender, captorLoggingEvent, 1, String.format(UnknownMethodAlgorithmLogger.DIGEST_ALGORITHM_MESSAGE, IDP, DIGEST_SHA1_ID, AUTHN_STATEMENT + Assertion.DEFAULT_ELEMENT_LOCAL_NAME)); }
@Test public void shouldReportUnknownSignatureAndDigestAlgorithmsInIDPAssertion() throws Exception { Assertion authnStatementAssertion = anAssertion() .withId(ID) .withIssuer(anIssuer().withIssuerId(ISSUER_IDP).build()) .withSignature(signatureWithUnknownSignatureAndDigestAlgorithms.get()) .buildUnencrypted(); UnknownMethodAlgorithmLogger.probeAssertionForMethodAlgorithm(authnStatementAssertion, AUTHN_STATEMENT); verifyLog(mockAppender, captorLoggingEvent, 1, String.format(UnknownMethodAlgorithmLogger.SIGNATURE_AND_DIGEST_ALGORITHMS_MESSAGE, IDP, SIGNATURE_RSA_SHA1_ID, DIGEST_SHA1_ID, AUTHN_STATEMENT + Assertion.DEFAULT_ELEMENT_LOCAL_NAME)); }