Search in sources :

Example 1 with MessageAnnotator

use of net.nemerosa.ontrack.model.support.MessageAnnotator 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());
    }
}
Also used : MessageAnnotator(net.nemerosa.ontrack.model.support.MessageAnnotator) MessageAnnotation(net.nemerosa.ontrack.model.support.MessageAnnotation) Test(org.junit.Test)

Aggregations

MessageAnnotation (net.nemerosa.ontrack.model.support.MessageAnnotation)1 MessageAnnotator (net.nemerosa.ontrack.model.support.MessageAnnotator)1 Test (org.junit.Test)1