@Test public void do_not_auto_assign_existing_issues() { inputIssue.setIsNew(false); inputIssue.setAuthorLogin("charlie"); when(scmAccountCache.getNullable("charlie")).thenReturn("char.lie"); process(); assertThat(Iterators.getOnlyElement(outputIssues.traverse()).assignee()).isNull(); }
@Test public void auto_assign_new_issues() { inputIssue.setIsNew(true); inputIssue.setAuthorLogin("charlie"); when(scmAccountCache.getNullable("charlie")).thenReturn("char.lie"); process(); assertThat(Iterators.getOnlyElement(outputIssues.traverse()).assignee()).isEqualTo("char.lie"); }
@Test public void do_not_override_author_and_assignee_set_by_old_batch_plugins() { inputIssue.setIsNew(true); // these fields were provided during project analysis, for instance // by developer cockpit or issue-assign plugins inputIssue.setAuthorLogin("charlie"); inputIssue.setAssignee("cabu"); process(); // keep the values, without trying to update them DefaultIssue cachedIssue = Iterators.getOnlyElement(outputIssues.traverse()); assertThat(cachedIssue.assignee()).isEqualTo("cabu"); assertThat(cachedIssue.authorLogin()).isEqualTo("charlie"); verifyZeroInteractions(scmAccountCache); }