### Question:
SamlSettings { String getCertificate() { return configuration.get(CERTIFICATE).orElseThrow(() -> new IllegalArgumentException("Certificate is missing")); } SamlSettings(Configuration configuration);   }### Answer:
@Test public void return_certificate() { settings.setProperty("sonar.auth.saml.certificate.secured", "ABCDEFG"); assertThat(underTest.getCertificate()).isEqualTo("ABCDEFG"); }
@Test public void fail_to_get_certificate_when_null() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Certificate is missing"); underTest.getCertificate(); }