### Question:
ProtectiveMonitoringLogFormatter { public String formatAuthnRequest(AuthnRequest authnRequest, Direction direction, SignatureStatus signatureStatus) { Issuer issuer = authnRequest.getIssuer(); String issuerId = issuer != null ? issuer.getValue() : ""; return String.format(AUTHN_REQUEST, authnRequest.getID(), direction, authnRequest.getDestination(), issuerId, signatureStatus.valid()); }  String formatAuthnRequest(AuthnRequest authnRequest, Direction direction, SignatureStatus signatureStatus); String formatAuthnResponse(Response samlResponse, Direction direction, SignatureStatus signatureStatus);  }### Answer:
@Test public void shouldFormatAuthnRequest() { AuthnRequest authnRequest = anAuthnRequest().withId("test-id").withDestination("veganistan").build(); String logString = new ProtectiveMonitoringLogFormatter().formatAuthnRequest(authnRequest, Direction.INBOUND, SignatureStatus.VALID_SIGNATURE); String expectedLogMessage = "Protective Monitoring – Authn Request Event – {" + "requestId: test-id, " + "direction: INBOUND, " + "destination: veganistan, " + "issuerId: a-test-entity, " + "validSignature: true}"; assertThat(logString).isEqualTo(expectedLogMessage); }
@Test public void shouldFormatAuthnRequestWithoutIssuer() { AuthnRequest authnRequest = anAuthnRequest().withId("test-id").withDestination("veganistan").withIssuer(null).build(); String logString = new ProtectiveMonitoringLogFormatter().formatAuthnRequest(authnRequest, Direction.INBOUND, SignatureStatus.VALID_SIGNATURE); assertThat(logString).contains("issuerId: ,"); }