Search in sources :

Example 1 with SonarQubeNotificationListener

use of org.sonarsource.sonarlint.core.client.api.notifications.SonarQubeNotificationListener in project sonarlint-core by SonarSource.

the class SonarQubeNotificationsTest method testRegistration.

@Test
public void testRegistration() {
    SonarQubeNotificationListener listener = mock(SonarQubeNotificationListener.class);
    when(config.listener()).thenReturn(listener);
    SonarQubeNotifications notifications = new SonarQubeNotifications(timer, timerTask, checkerFactory);
    notifications.register(config);
    notifications.remove(listener);
    verify(timerTask, times(2)).setProjects(anyCollection());
    verifyNoMoreInteractions(timerTask);
    verify(timer).scheduleAtFixedRate(timerTask, SonarQubeNotifications.DELAY, SonarQubeNotifications.DELAY);
}
Also used : SonarQubeNotificationListener(org.sonarsource.sonarlint.core.client.api.notifications.SonarQubeNotificationListener) Test(org.junit.Test)

Example 2 with SonarQubeNotificationListener

use of org.sonarsource.sonarlint.core.client.api.notifications.SonarQubeNotificationListener in project sonarlint-core by SonarSource.

the class NotificationConfigurationTest method testGetters.

@Test
public void testGetters() {
    SonarQubeNotificationListener listener = mock(SonarQubeNotificationListener.class);
    LastNotificationTime lastNotificationTime = mock(LastNotificationTime.class);
    String projectKey = "key";
    ServerConfiguration serverConfiguration = mock(ServerConfiguration.class);
    NotificationConfiguration configuration = new NotificationConfiguration(listener, lastNotificationTime, projectKey, serverConfiguration);
    assertThat(configuration.lastNotificationTime()).isEqualTo(lastNotificationTime);
    assertThat(configuration.listener()).isEqualTo(listener);
    assertThat(configuration.projectKey()).isEqualTo(projectKey);
    assertThat(configuration.serverConfiguration()).isEqualTo(serverConfiguration);
}
Also used : LastNotificationTime(org.sonarsource.sonarlint.core.client.api.notifications.LastNotificationTime) SonarQubeNotificationListener(org.sonarsource.sonarlint.core.client.api.notifications.SonarQubeNotificationListener) ServerConfiguration(org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 SonarQubeNotificationListener (org.sonarsource.sonarlint.core.client.api.notifications.SonarQubeNotificationListener)2 ServerConfiguration (org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration)1 LastNotificationTime (org.sonarsource.sonarlint.core.client.api.notifications.LastNotificationTime)1