use of net.nemerosa.ontrack.model.support.MessageAnnotation in project ontrack by nemerosa.
the class GitLabIssueServiceExtensionTest method message_annotator.
@Test
public void message_annotator() {
MessageAnnotator messageAnnotator = extension.getMessageAnnotator(configuration).orElse(null);
assertNotNull(messageAnnotator);
Collection<MessageAnnotation> messageAnnotations = messageAnnotator.annotate("Message for #12");
assertEquals(2, messageAnnotations.size());
List<MessageAnnotation> annotationList = new ArrayList<>(messageAnnotations);
{
MessageAnnotation annotation = annotationList.get(0);
assertNull(annotation.getType());
assertEquals("Message for ", annotation.getText());
assertTrue(annotation.getAttributes().isEmpty());
}
{
MessageAnnotation annotation = annotationList.get(1);
assertEquals("a", annotation.getType());
assertEquals("#12", annotation.getText());
assertEquals(Collections.singletonMap("href", "url/nemerosa/ontrack/issues/12"), annotation.getAttributes());
}
}
Aggregations