Arsnael commented on code in PR #1643:
URL: https://github.com/apache/james-project/pull/1643#discussion_r1265021681
##########
server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringTest.java:
##########
@@ -1057,4 +1058,75 @@ void actionShouldCombineFlags(JMAPFilteringTestSystem
testSystem) throws Excepti
assertThat(StorageDirective.fromMail(Username.of("recipient1"),
mail).getFlags().get())
.isEqualTo(expectedFlags);
}
+
+ @Test
+ void andShouldMatchWhenAllConditionsAreMet(JMAPFilteringTestSystem
testSystem) throws Exception {
+
Mono.from(testSystem.getFilteringManagement().defineRulesForUser(RECIPIENT_1_USERNAME,
+ Optional.empty(),
+ Rule.builder()
+ .id(Rule.Id.of("1"))
+ .name("rule 1")
+
.conditionGroup(Rule.ConditionGroup.of(Rule.ConditionCombiner.AND,
Rule.Condition.of(FROM, CONTAINS, USER_2_USERNAME), Rule.Condition.of(SUBJECT,
CONTAINS, "cd")))
+
.action(Rule.Action.of(Rule.Action.AppendInMailboxes.withMailboxIds(testSystem.getRecipient1MailboxId().serialize())))
+ .build())).block();
+
+ FakeMail mail =
testSystem.asMail(mimeMessageBuilder().addHeader(FROM.asString(),
USER_2_ADDRESS).addHeader(SUBJECT.asString(), "abcdef"));
+
+ testSystem.getJmapFiltering().service(mail);
+
+
assertThatAttribute(mail.getAttribute(RECIPIENT_1_USERNAME_ATTRIBUTE_NAME))
+ .isEqualTo(RECIPIENT_1_MAILBOX_1_ATTRIBUTE);
+ }
+
+ @Test
+ void andShouldNotMatchWhenSomeConditionsAreMet(JMAPFilteringTestSystem
testSystem) throws Exception {
Review Comment:
```suggestion
void
andShouldNotMatchWhenSomeConditionsAreNotMet(JMAPFilteringTestSystem
testSystem) throws Exception {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]