use of com.synopsys.integration.alert.api.channel.issue.callback.IssueTrackerCallbackInfoCreator in project hub-alert by blackducksoftware.
the class IssueTrackerIssueTransitionerTest method transitionIssueThrowsExceptionTest.
@Test
public void transitionIssueThrowsExceptionTest() throws AlertException {
IssueOperation testOperation = IssueOperation.RESOLVE;
IssueTransitionModel<String> issueTransitionModel = new IssueTransitionModel<>(null, testOperation, List.of("comment 1"), null);
IssueTrackerCallbackInfoCreator callbackInfoCreator = new IssueTrackerCallbackInfoCreator();
IssueTrackerIssueResponseCreator issueResponseCreator = new IssueTrackerIssueResponseCreator(callbackInfoCreator);
IssueTrackerIssueCommenter<String> exceptionThrowingCommenter = Mockito.mock(IssueTrackerIssueCommenter.class);
Mockito.when(exceptionThrowingCommenter.commentOnIssue(Mockito.any())).thenThrow(new AlertException("Test exception"));
IssueTrackerIssueTransitioner<String> transitioner = new TestTransitioner(exceptionThrowingCommenter, issueResponseCreator, "TODO", true, true);
try {
transitioner.transitionIssue(issueTransitionModel);
fail("Expected an exception to be thrown");
} catch (IssueMissingTransitionException e) {
assertEquals(TEST_EXCEPTION, e);
}
}
use of com.synopsys.integration.alert.api.channel.issue.callback.IssueTrackerCallbackInfoCreator in project hub-alert by blackducksoftware.
the class IssueTrackerIssueResponseCreatorTest method createIssueResponseWithCallbackInfoTest.
@Test
public void createIssueResponseWithCallbackInfoTest() {
IssueTrackerCallbackInfo callbackInfo = Mockito.mock(IssueTrackerCallbackInfo.class);
IssueTrackerCallbackInfoCreator callbackInfoCreator = Mockito.mock(IssueTrackerCallbackInfoCreator.class);
Mockito.when(callbackInfoCreator.createCallbackInfo(Mockito.any())).thenReturn(Optional.of(callbackInfo));
ProjectIssueModel source = Mockito.mock(ProjectIssueModel.class);
runTest(source, callbackInfoCreator);
}
use of com.synopsys.integration.alert.api.channel.issue.callback.IssueTrackerCallbackInfoCreator in project hub-alert by blackducksoftware.
the class IssueTrackerIssueResponseCreatorTest method createIssueResponseTest.
@Test
public void createIssueResponseTest() {
IssueTrackerCallbackInfoCreator callbackInfoCreator = Mockito.mock(IssueTrackerCallbackInfoCreator.class);
Mockito.when(callbackInfoCreator.createCallbackInfo(Mockito.any())).thenReturn(Optional.empty());
ProjectIssueModel source = Mockito.mock(ProjectIssueModel.class);
runTest(source, callbackInfoCreator);
}
Aggregations