Skip to content
Permalink
Browse files
1001: CommentPosterWorkItem@openjdk/jdk#3425
Reviewed-by: tbell
  • Loading branch information
erikj79 committed Apr 27, 2021
1 parent 75a8a62 commit cdc1b020f16c40834e6a930d0901abe32ec39e43
Showing 2 changed files with 22 additions and 1 deletion.
@@ -39,7 +39,7 @@ public class BridgedComment {
private final ZonedDateTime created;

private final static String bridgedMailMarker = "<!-- Bridged id (%s) -->";
private final static Pattern bridgedMailId = Pattern.compile("^<!-- Bridged id \\(([=\\w]+)\\) -->");
final static Pattern bridgedMailId = Pattern.compile("^<!-- Bridged id \\(([=+/\\w]+)\\) -->");
private final static Pattern bridgedSender = Pattern.compile("Mailing list message from \\[(.*?)]\\(mailto:(\\S+)\\)");

private BridgedComment(String body, EmailAddress messageId, HostUser author, ZonedDateTime created) {
@@ -0,0 +1,21 @@
package org.openjdk.skara.bots.mlbridge;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

public class BridgedCommentTests {

@Test
public void bridgeMailPattern() {
assertFalse(BridgedComment.bridgedMailId.matcher("foo").find());
assertFalse(BridgedComment.bridgedMailId.matcher("<-- foo -->").find());
assertTrue(BridgedComment.bridgedMailId.matcher("<!-- Bridged id (foo=) -->").find());
assertTrue(BridgedComment.bridgedMailId.matcher("<!-- Bridged id (PEEzNDJBNUQwLTM" +
"4MjItNEM2Ni05MDc4LUY5QThDOTA2NTRBNkBjYmZpZGRsZS5jb20+RnJvbSB0aGUgQ1NSIHJldmlldzo=) -->").find());

var matcher = BridgedComment.bridgedMailId.matcher("<!-- Bridged id (fo+/o=) -->");
assertTrue(matcher.find());
assertEquals("fo+/o=", matcher.group(1));
}
}

1 comment on commit cdc1b02

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on cdc1b02 Apr 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.