use of com.synopsys.integration.alert.api.channel.issue.model.IssueTrackerModelHolder in project hub-alert by blackducksoftware.
the class IssueTrackerProcessorTest method processMessagesTest.
@Test
public void processMessagesTest() throws AlertException {
IssueTrackerModelExtractor<String> extractor = Mockito.mock(IssueTrackerModelExtractor.class);
IssueTrackerModelHolder<String> simpleMessageResponses = new IssueTrackerModelHolder<>(List.of(), List.of(), List.of());
Mockito.when(extractor.extractSimpleMessageIssueModels(Mockito.anyList(), Mockito.any())).thenReturn(simpleMessageResponses);
IssueTrackerIssueResponseModel<String> response1 = Mockito.mock(IssueTrackerIssueResponseModel.class);
IssueTrackerIssueResponseModel<String> response2 = Mockito.mock(IssueTrackerIssueResponseModel.class);
IssueTrackerIssueResponseModel<String> response3 = Mockito.mock(IssueTrackerIssueResponseModel.class);
List<IssueTrackerIssueResponseModel<String>> simpleMessageResponse = List.of(response1, response2, response3);
IssueTrackerIssueResponseModel<String> response4 = Mockito.mock(IssueTrackerIssueResponseModel.class);
IssueTrackerIssueResponseModel<String> response5 = Mockito.mock(IssueTrackerIssueResponseModel.class);
List<IssueTrackerIssueResponseModel<String>> projectMessageResponses = List.of(response4, response5);
IssueTrackerMessageSender<String> sender = Mockito.mock(IssueTrackerMessageSender.class);
Mockito.when(sender.sendMessages(Mockito.any())).thenReturn(simpleMessageResponse, projectMessageResponses);
IssueTrackerProcessor<String> processor = new IssueTrackerProcessor<>(extractor, sender);
ProjectMessage projectMessage = Mockito.mock(ProjectMessage.class);
ProviderMessageHolder providerMessageHolder = new ProviderMessageHolder(List.of(projectMessage), List.of());
IssueTrackerResponse<String> issueTrackerResponse = processor.processMessages(providerMessageHolder, "jobName");
assertEquals(simpleMessageResponse.size() + projectMessageResponses.size(), issueTrackerResponse.getUpdatedIssues().size());
}
use of com.synopsys.integration.alert.api.channel.issue.model.IssueTrackerModelHolder in project hub-alert by blackducksoftware.
the class IssueTrackerMessageSenderTest method createModelHolder.
private IssueTrackerModelHolder<String> createModelHolder() {
IssueCreationModel issueCreationModel1 = Mockito.mock(IssueCreationModel.class);
IssueCreationModel issueCreationModel2 = Mockito.mock(IssueCreationModel.class);
IssueCommentModel<String> issueCommentModel = Mockito.mock(IssueCommentModel.class);
return new IssueTrackerModelHolder<>(List.of(issueCreationModel1, issueCreationModel2), List.of(), List.of(issueCommentModel));
}
Aggregations