@Test public void return_global_settings() { settings.setProperty("key", "value"); Settings projectSettings = underTest.newProjectSettings(PROJECT_KEY); assertThat(projectSettings.getProperties()).hasSize(1); assertThat(projectSettings.getString("key")).isEqualTo("value"); }
@Test public void project_settings_override_global_settings() { settings.setProperty("key", "value"); when(dao.selectProjectProperties(PROJECT_KEY)) .thenReturn(newArrayList(new PropertyDto().setKey("key").setValue("value2"))); Settings projectSettings = underTest.newProjectSettings(PROJECT_KEY); assertThat(projectSettings.getString("key")).isEqualTo("value2"); }
@Test public void return_project_settings() { when(dao.selectProjectProperties(PROJECT_KEY)) .thenReturn( newArrayList( new PropertyDto().setKey("1").setValue("val1"), new PropertyDto().setKey("2").setValue("val2"), new PropertyDto().setKey("3").setValue("val3"))); Settings projectSettings = underTest.newProjectSettings(PROJECT_KEY); assertThat(projectSettings.getString("1")).isEqualTo("val1"); assertThat(projectSettings.getString("2")).isEqualTo("val2"); assertThat(projectSettings.getString("3")).isEqualTo("val3"); }