Ejemplo n.º 1
0
 @Before
 public void setUp() throws Exception {
   super.setUp();
   runner = SonarLintTestUtils.mockRunner(getProject());
   action = new UpdateAction();
   getProject().getComponent(SonarLintStatus.class).stopRun();
 }
Ejemplo n.º 2
0
  @Test
  public void testAction() {
    action.actionPerformed(SonarLintTestUtils.createAnActionEvent(getProject()));

    verify(runner).tryUpdate();
    verify(runner).getVersion();
    verifyNoMoreInteractions(runner);

    SonarLintStatus status = getProject().getComponent(SonarLintStatus.class);
    assertThat(status.isRunning()).isFalse();
  }
Ejemplo n.º 3
0
 @Test
 public void testFailIfRunning() {
   SonarLintStatus status = getProject().getComponent(SonarLintStatus.class);
   status.tryRun();
   try {
     action.actionPerformed(SonarLintTestUtils.createAnActionEvent(getProject()));
     fail("Should throw exception");
   } catch (IllegalStateException e) {
     assertThat(e.getMessage()).isEqualTo("Unable to update SonarLint as an analysis is on-going");
   } finally {
     status.stopRun();
   }
 }