@Test public void should_resolve_as_removed_when_rule_is_disabled() throws Exception { Issue issue = new DefaultIssue().setEndOfLife(true).setOnDisabledRule(true); when(context.issue()).thenReturn(issue); function.execute(context); verify(context, times(1)).setResolution(Issue.RESOLUTION_REMOVED); }
@Test public void should_fail_if_issue_is_not_resolved() throws Exception { Issue issue = new DefaultIssue().setEndOfLife(false); when(context.issue()).thenReturn(issue); try { function.execute(context); fail(); } catch (IllegalStateException e) { assertThat(e.getMessage()).contains("Issue is still alive"); verify(context, never()).setResolution(anyString()); } }