aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-10-04 11:24:27 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-10-04 11:24:27 +0200
commite5ecf075db0a36e45c07bb20669cc654c014293b (patch)
tree03aa9bd8438d34ed0f6593a7a0bc7efa92dab3d1 /sonar-plugin-api
parent8ada60996f32bcb6125ac3f75eecb7ab540fe783 (diff)
downloadsonarqube-e5ecf075db0a36e45c07bb20669cc654c014293b.tar.gz
sonarqube-e5ecf075db0a36e45c07bb20669cc654c014293b.zip
Add unit test to Settings#getBoolean()
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java37
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();