@Test public void testProjectDoesntExist() { when(projectRepo.exists()).thenReturn(false); when(loader.loadDefault(anyString())).thenReturn(response); when(props.property(QualityProfiles.SONAR_PROFILE_PROP)).thenReturn("profile"); QualityProfiles qps = qualityProfileProvider.provide(loader, projectRepo, props); assertResponse(qps); verify(loader).loadDefault(anyString()); verifyNoMoreInteractions(loader); }
@Test public void testProfileProp() { when(loader.load(eq("project"), eq("custom"))).thenReturn(response); when(props.property(QualityProfiles.SONAR_PROFILE_PROP)).thenReturn("custom"); when(props.properties()).thenReturn(ImmutableMap.of(QualityProfiles.SONAR_PROFILE_PROP, "custom")); QualityProfiles qps = qualityProfileProvider.provide(loader, projectRepo, props); assertResponse(qps); verify(loader).load(eq("project"), eq("custom")); verifyNoMoreInteractions(loader); assertThat(logTester.logs(LoggerLevel.WARN)).contains("Ability to set quality profile from command line using '" + QualityProfiles.SONAR_PROFILE_PROP + "' is deprecated and will be dropped in a future SonarQube version. Please configure quality profile used by your project on SonarQube server."); }
@Test public void testProvide() { when(loader.load("project", null)).thenReturn(response); QualityProfiles qps = qualityProfileProvider.provide(loader, projectRepo, props); assertResponse(qps); verify(loader).load("project", null); verifyNoMoreInteractions(loader); }
@Test public void testProfilePropDefault() { when(projectRepo.exists()).thenReturn(false); when(loader.loadDefault(eq("custom"))).thenReturn(response); when(props.property(QualityProfiles.SONAR_PROFILE_PROP)).thenReturn("custom"); when(props.properties()).thenReturn(ImmutableMap.of(QualityProfiles.SONAR_PROFILE_PROP, "custom")); QualityProfiles qps = qualityProfileProvider.provide(loader, projectRepo, props); assertResponse(qps); verify(loader).loadDefault(eq("custom")); verifyNoMoreInteractions(loader); assertThat(logTester.logs(LoggerLevel.WARN)).contains("Ability to set quality profile from command line using '" + QualityProfiles.SONAR_PROFILE_PROP + "' is deprecated and will be dropped in a future SonarQube version. Please configure quality profile used by your project on SonarQube server."); }