use of com.synopsys.integration.alert.api.channel.issue.convert.mock.MockIssueTrackerMessageFormatter in project hub-alert by blackducksoftware.
the class IssueComponentUnknownDetailsConverterTest method callCreateSectionPieces.
private List<String> callCreateSectionPieces(IssueComponentUnknownVersionDetails details) {
MockIssueTrackerMessageFormatter formatter = MockIssueTrackerMessageFormatter.withIntegerMaxValueLength();
IssueComponentUnknownVersionDetailsConverter converter = new IssueComponentUnknownVersionDetailsConverter(formatter);
return converter.createEstimatedRiskDetailsSectionPieces(details);
}
use of com.synopsys.integration.alert.api.channel.issue.convert.mock.MockIssueTrackerMessageFormatter in project hub-alert by blackducksoftware.
the class ComponentVulnerabilitiesConverterTest method callCreateComponentVulnerabilitiesSectionPieces.
private List<String> callCreateComponentVulnerabilitiesSectionPieces(ComponentVulnerabilities componentVulnerabilities) {
MockIssueTrackerMessageFormatter formatter = MockIssueTrackerMessageFormatter.withIntegerMaxValueLength();
ComponentVulnerabilitiesConverter converter = new ComponentVulnerabilitiesConverter(formatter);
return converter.createComponentVulnerabilitiesSectionPieces(componentVulnerabilities);
}
use of com.synopsys.integration.alert.api.channel.issue.convert.mock.MockIssueTrackerMessageFormatter in project hub-alert by blackducksoftware.
the class IssuePolicyDetailsConverterTest method callCreatePolicyDetailsSectionPieces.
private List<String> callCreatePolicyDetailsSectionPieces(IssuePolicyDetails policyDetails) {
MockIssueTrackerMessageFormatter formatter = MockIssueTrackerMessageFormatter.withIntegerMaxValueLength();
IssuePolicyDetailsConverter converter = new IssuePolicyDetailsConverter(formatter);
return converter.createPolicyDetailsSectionPieces(ISSUE_BOM_COMPONENT_DETAILS, policyDetails);
}
use of com.synopsys.integration.alert.api.channel.issue.convert.mock.MockIssueTrackerMessageFormatter in project hub-alert by blackducksoftware.
the class IssueTrackerSimpleMessageConverterTest method convertToIssueCreationModelTruncateTitleTest.
@Test
void convertToIssueCreationModelTruncateTitleTest() {
int maxTitleLength = 10;
int maxDescriptionLength = 12;
MockIssueTrackerMessageFormatter formatter = new MockIssueTrackerMessageFormatter(maxTitleLength, maxDescriptionLength, 1000);
IssueTrackerSimpleMessageConverter converter = new IssueTrackerSimpleMessageConverter(formatter);
IssueCreationModel issueCreationModel = converter.convertToIssueCreationModel(SIMPLE_MESSAGE, "jobName");
assertEquals(maxTitleLength, issueCreationModel.getTitle().length());
assertTrue(maxDescriptionLength >= issueCreationModel.getDescription().length(), "Expected max description length to be greater than or equal to the created description");
assertTrue(issueCreationModel.getPostCreateComments().size() > 0, "Expected truncated title/description to continue in comments");
}
use of com.synopsys.integration.alert.api.channel.issue.convert.mock.MockIssueTrackerMessageFormatter in project hub-alert by blackducksoftware.
the class IssueTrackerSimpleMessageConverterTest method convertToIssueCreationModelUnboundedTest.
@Test
void convertToIssueCreationModelUnboundedTest() {
MockIssueTrackerMessageFormatter formatter = MockIssueTrackerMessageFormatter.withIntegerMaxValueLength();
IssueTrackerSimpleMessageConverter converter = new IssueTrackerSimpleMessageConverter(formatter);
IssueCreationModel issueCreationModel = converter.convertToIssueCreationModel(SIMPLE_MESSAGE, "jobName");
assertTrue(issueCreationModel.getTitle().contains(SIMPLE_MESSAGE.getSummary()), "Expected title to contain the simple message's summary");
String issueCreationModelDescription = issueCreationModel.getDescription();
assertTrue(issueCreationModelDescription.contains(SIMPLE_MESSAGE.getDescription()), "Expected description to contain the simple message's description");
for (LinkableItem detail : SIMPLE_MESSAGE.getDetails()) {
assertTrue(issueCreationModelDescription.contains(detail.getLabel()) && issueCreationModelDescription.contains(detail.getValue()), "Expected description to contain the simple message's details");
}
}
Aggregations