You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2022/09/13 09:54:41 UTC

[GitHub] [james-project] chibenwa commented on a diff in pull request #1189: JAMES-3775 Refactor GetMailboxMessagesService + Clean code + Fix webadmin task

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


##########
third-party/rspamd/src/test/java/org/apache/james/rspamd/client/RspamdHttpClientTest.java:
##########
@@ -95,24 +115,24 @@ void learnHamWithWrongPasswordShouldThrowUnauthorizedExceptionException() {
         RspamdClientConfiguration configuration = new RspamdClientConfiguration(rspamdExtension.getBaseUrl(), "wrongPassword", Optional.empty());
         RspamdHttpClient client = new RspamdHttpClient(configuration);
 
-        assertThatThrownBy(() -> reportAsHam(client, new ByteArrayInputStream(spamMessage)))
+        assertThatThrownBy(() -> reportAsHam(client, spamMessage.getMessage().getInputStream()))
             .hasMessage("{\"error\":\"Unauthorized\"}")
             .isInstanceOf(UnauthorizedException.class);
     }
 
     @Test
-    void checkSpamMailUsingRspamdClientWithExactPasswordShouldReturnAnalysisResultAsSameAsUsingRawClient() {
+    void checkSpamMailUsingRspamdClientWithExactPasswordShouldReturnAnalysisResultAsSameAsUsingRawClient() throws MessagingException {
         RspamdClientConfiguration configuration = new RspamdClientConfiguration(rspamdExtension.getBaseUrl(), PASSWORD, Optional.empty());
         RspamdHttpClient client = new RspamdHttpClient(configuration);
 
-        AnalysisResult analysisResult = client.checkV2(new ByteArrayInputStream(spamMessage)).block();
+        AnalysisResult analysisResult = client.checkV2(spamMessage).block();
         assertThat(analysisResult.getAction()).isEqualTo(AnalysisResult.Action.REJECT);
 
         RequestSpecification rspamdApi = WebAdminUtils.spec(Port.of(rspamdExtension.dockerRspamd().getPort()));
         rspamdApi
             .header(new Header("Password", PASSWORD))
             .body(ClassLoader.getSystemResourceAsStream(SPAM_MESSAGE_PATH))
-            .post("checkv2")
+            .post("checkv2").prettyPeek()

Review Comment:
   pretty peek



##########
third-party/rspamd/src/test/java/org/apache/james/rspamd/client/RspamdHttpClientTest.java:
##########
@@ -95,24 +115,24 @@ void learnHamWithWrongPasswordShouldThrowUnauthorizedExceptionException() {
         RspamdClientConfiguration configuration = new RspamdClientConfiguration(rspamdExtension.getBaseUrl(), "wrongPassword", Optional.empty());
         RspamdHttpClient client = new RspamdHttpClient(configuration);
 
-        assertThatThrownBy(() -> reportAsHam(client, new ByteArrayInputStream(spamMessage)))
+        assertThatThrownBy(() -> reportAsHam(client, spamMessage.getMessage().getInputStream()))
             .hasMessage("{\"error\":\"Unauthorized\"}")
             .isInstanceOf(UnauthorizedException.class);
     }
 
     @Test
-    void checkSpamMailUsingRspamdClientWithExactPasswordShouldReturnAnalysisResultAsSameAsUsingRawClient() {
+    void checkSpamMailUsingRspamdClientWithExactPasswordShouldReturnAnalysisResultAsSameAsUsingRawClient() throws MessagingException {

Review Comment:
   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: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org