diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-10-04 11:24:27 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-10-04 11:24:27 +0200 |
commit | e5ecf075db0a36e45c07bb20669cc654c014293b (patch) | |
tree | 03aa9bd8438d34ed0f6593a7a0bc7efa92dab3d1 /sonar-plugin-api/src/test/java/org/sonar/api/config | |
parent | 8ada60996f32bcb6125ac3f75eecb7ab540fe783 (diff) | |
download | sonarqube-e5ecf075db0a36e45c07bb20669cc654c014293b.tar.gz sonarqube-e5ecf075db0a36e45c07bb20669cc654c014293b.zip |
Add unit test to Settings#getBoolean()
Diffstat (limited to 'sonar-plugin-api/src/test/java/org/sonar/api/config')
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java index ee5bc28bcab..8e5ec036fe6 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java @@ -77,17 +77,6 @@ public class SettingsTest { } @Test - public void set_property_boolean() { - Settings settings = new Settings(); - settings.setProperty("foo", true); - settings.setProperty("bar", false); - assertThat(settings.getBoolean("foo")).isTrue(); - assertThat(settings.getBoolean("bar")).isFalse(); - assertThat(settings.getString("foo")).isEqualTo("true"); - assertThat(settings.getString("bar")).isEqualTo("false"); - } - - @Test public void default_number_values_are_zero() { Settings settings = new Settings(); assertThat(settings.getInt("foo")).isEqualTo(0); @@ -290,7 +279,31 @@ public class SettingsTest { } @Test - public void testGetBoolean() { + public void set_property_boolean() { + Settings settings = new Settings(); + settings.setProperty("foo", true); + settings.setProperty("bar", false); + assertThat(settings.getBoolean("foo")).isTrue(); + assertThat(settings.getBoolean("bar")).isFalse(); + assertThat(settings.getString("foo")).isEqualTo("true"); + assertThat(settings.getString("bar")).isEqualTo("false"); + } + + @Test + public void ignore_case_of_boolean_values() { + Settings settings = new Settings(); + settings.setProperty("foo", "true"); + settings.setProperty("bar", "TRUE"); + // labels in UI + settings.setProperty("baz", "True"); + + assertThat(settings.getBoolean("foo")).isTrue(); + assertThat(settings.getBoolean("bar")).isTrue(); + assertThat(settings.getBoolean("baz")).isTrue(); + } + + @Test + public void get_boolean() { Settings settings = new Settings(definitions); assertThat(settings.getBoolean("boolean")).isTrue(); assertThat(settings.getBoolean("falseboolean")).isFalse(); |