### Question:
SamlSettings { boolean isEnabled() { return configuration.getBoolean(ENABLED).orElse(false) && configuration.get(PROVIDER_ID).isPresent() && configuration.get(APPLICATION_ID).isPresent() && configuration.get(LOGIN_URL).isPresent() && configuration.get(CERTIFICATE).isPresent() && configuration.get(USER_LOGIN_ATTRIBUTE).isPresent() && configuration.get(USER_NAME_ATTRIBUTE).isPresent(); } SamlSettings(Configuration configuration);   }### Answer:
@Test public void is_enabled() { settings.setProperty("sonar.auth.saml.applicationId", "MyApp"); settings.setProperty("sonar.auth.saml.providerId", "http: settings.setProperty("sonar.auth.saml.loginUrl", "http: settings.setProperty("sonar.auth.saml.certificate.secured", "ABCDEFG"); settings.setProperty("sonar.auth.saml.user.login", "login"); settings.setProperty("sonar.auth.saml.user.name", "name"); settings.setProperty("sonar.auth.saml.enabled", true); assertThat(underTest.isEnabled()).isTrue(); settings.setProperty("sonar.auth.saml.enabled", false); assertThat(underTest.isEnabled()).isFalse(); }
@Test public void is_enabled_using_default_values() { settings.setProperty("sonar.auth.saml.providerId", "http: settings.setProperty("sonar.auth.saml.loginUrl", "http: settings.setProperty("sonar.auth.saml.certificate.secured", "ABCDEFG"); settings.setProperty("sonar.auth.saml.user.login", "login"); settings.setProperty("sonar.auth.saml.user.name", "name"); settings.setProperty("sonar.auth.saml.enabled", true); assertThat(underTest.isEnabled()).isTrue(); }
@Test @UseDataProvider("settingsRequiredToEnablePlugin") public void is_enabled_return_false_when_one_required_setting_is_missing(String setting) { initAllSettings(); settings.setProperty(setting, (String) null); assertThat(underTest.isEnabled()).isFalse(); }