chibenwa commented on code in PR #1856:
URL: https://github.com/apache/james-project/pull/1856#discussion_r1427644030


##########
server/mailet/integration-testing/src/test/java/org/apache/james/mailets/ForwardIntegrationTest.java:
##########
@@ -333,6 +333,26 @@ void forwardShouldHandleLocalCopy() throws Exception {
         }));
     }
 
+    @Test
+    void forwardShouldKeepMessageWhenOnlyLocalCopy() throws Exception {
+        jamesServer.getProbe(DataProbeImpl.class)
+            .addMapping(MappingSource.fromUser(BOB),
+                Mapping.forward(BOB.asString()));
+
+        messageSender.connect(LOCALHOST_IP, 
jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
+            .authenticate(FROM, PASSWORD)
+            .sendMessage(FROM, BOB.asString());
+
+        Awaitility.await().until(() -> 
mailRepositoryProbe.getRepositoryMailCount(CUSTOM_REPOSITORY) == 1L);
+
+        SoftAssertions.assertSoftly(Throwing.consumer(softly -> {
+            Mail forwardedMail = 
mailRepositoryProbe.listMails(CUSTOM_REPOSITORY)
+                .findAny().get();
+            
softly.assertThat(forwardedMail.getRecipients()).containsOnly(BOB.asMailAddress());
+            
softly.assertThat(forwardedMail.getMaybeSender().asOptional()).contains(BOB.asMailAddress());

Review Comment:
   If we only have the local copy maybe we should not rewrite the sender?
   
   AKA only local copy -> noop ?



-- 
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]

Reply via email to