Repository: james-project Updated Branches: refs/heads/master e9c1a72b7 -> fd1c775e7
JAMES-2133 fix warnings Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/0efe1e33 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/0efe1e33 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/0efe1e33 Branch: refs/heads/master Commit: 0efe1e33e527aa2c5822ece508f66e35d7cda9bd Parents: e9c1a72 Author: Matthieu Baechler <matth...@apache.org> Authored: Tue Aug 29 18:18:47 2017 +0200 Committer: Matthieu Baechler <matth...@apache.org> Committed: Fri Sep 1 14:03:47 2017 +0200 ---------------------------------------------------------------------- .../MailAttributesListToMimeHeaders.java | 5 +- .../MailAttributesToMimeHeadersTest.java | 1 - .../integration/SetMessagesMethodTest.java | 1 - .../jmap/json/ParsingWritingObjectsTest.java | 1 - .../jmap/methods/GetMessagesMethodTest.java | 51 +++++++++++--------- .../james/jmap/model/FilterConditionTest.java | 4 +- .../apache/james/jmap/model/KeywordTest.java | 1 - .../jmap/model/UpdateMessagePatchTest.java | 10 ++-- .../jmap/utils/FilterToSearchQueryTest.java | 2 - 9 files changed, 36 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/0efe1e33/mailet/standard/src/main/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeaders.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeaders.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeaders.java index cea486a..60d2208 100644 --- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeaders.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeaders.java @@ -78,7 +78,8 @@ public class MailAttributesListToMimeHeaders extends GenericMailet { private void addAttributeToHeader(Mail mail, MimeMessage message, Entry<String, String> entry) { Serializable attribute = mail.getAttribute(entry.getKey()); if (attribute instanceof Collection) { - Optional<Collection> values = Optional.of((Collection) attribute); + @SuppressWarnings("unchecked") + Optional<Collection<Serializable>> values = Optional.of((Collection<Serializable>) attribute); addCollectionToHeader(message, entry.getValue(), values); } else { if (attribute != null) { @@ -87,7 +88,7 @@ public class MailAttributesListToMimeHeaders extends GenericMailet { } } - private void addCollectionToHeader(MimeMessage message, String headerName, Optional<Collection> values) { + private void addCollectionToHeader(MimeMessage message, String headerName, Optional<Collection<Serializable>> values) { OptionalUtils.toStream(values) .flatMap(Collection::stream) .forEach(value -> addValueToHeader(message, headerName, value)); http://git-wip-us.apache.org/repos/asf/james-project/blob/0efe1e33/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesToMimeHeadersTest.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesToMimeHeadersTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesToMimeHeadersTest.java index fbec22e..690c003 100644 --- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesToMimeHeadersTest.java +++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesToMimeHeadersTest.java @@ -20,7 +20,6 @@ package org.apache.james.transport.mailets; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.within; import javax.mail.MessagingException; http://git-wip-us.apache.org/repos/asf/james-project/blob/0efe1e33/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java index 3fe34bb..4267638 100644 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java @@ -107,7 +107,6 @@ public abstract class SetMessagesMethodTest { private static final String USERNAME = "username@" + USERS_DOMAIN; public static final MailboxPath USER_MAILBOX = new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox"); private static final String NOT_UPDATED = ARGUMENTS + ".notUpdated"; - private static final String NOT_CREATED = ARGUMENTS + ".notCreated"; private ConditionFactory calmlyAwait; http://git-wip-us.apache.org/repos/asf/james-project/blob/0efe1e33/server/protocols/jmap/src/test/java/org/apache/james/jmap/json/ParsingWritingObjectsTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/json/ParsingWritingObjectsTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/json/ParsingWritingObjectsTest.java index bed119d..48ef051 100644 --- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/json/ParsingWritingObjectsTest.java +++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/json/ParsingWritingObjectsTest.java @@ -30,7 +30,6 @@ import java.nio.charset.StandardCharsets; import org.apache.commons.io.IOUtils; import org.apache.james.jmap.methods.GetMessagesMethod; import org.apache.james.jmap.methods.JmapResponseWriterImpl; -import org.apache.james.jmap.model.Message; import org.apache.james.jmap.model.SubMessage; import org.apache.james.mailbox.inmemory.InMemoryId; import org.apache.james.mailbox.model.TestMessageId; http://git-wip-us.apache.org/repos/asf/james-project/blob/0efe1e33/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java index 6d7b06a..fb1353b 100644 --- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java +++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java @@ -527,16 +527,17 @@ public class GetMessagesMethodTest { .extracting(GetMessagesResponse.class::cast) .flatExtracting(GetMessagesResponse::list) .extracting(Message::getKeywords) - .containsOnly( - ImmutableMap.of( - "$Answered", true, - "$Draft", true), - ImmutableMap.of( - "$Answered", true, - "$Draft", true), - ImmutableMap.of( - "$Answered", true, - "$Draft", true)); + .containsOnlyElementsOf( + ImmutableList.of( + ImmutableMap.of( + "$Answered", true, + "$Draft", true), + ImmutableMap.of( + "$Answered", true, + "$Draft", true), + ImmutableMap.of( + "$Answered", true, + "$Draft", true))); } @@ -575,16 +576,17 @@ public class GetMessagesMethodTest { .extracting(GetMessagesResponse.class::cast) .flatExtracting(GetMessagesResponse::list) .extracting(Message::getKeywords) - .containsOnly( - ImmutableMap.of( - "$Answered", true, - "$Draft", true), - ImmutableMap.of( - "$Answered", true, - "$Draft", true), - ImmutableMap.of( - "$Answered", true, - "$Draft", true)); + .containsOnlyElementsOf( + ImmutableList.of( + ImmutableMap.of( + "$Answered", true, + "$Draft", true), + ImmutableMap.of( + "$Answered", true, + "$Draft", true), + ImmutableMap.of( + "$Answered", true, + "$Draft", true))); } @@ -611,9 +613,10 @@ public class GetMessagesMethodTest { .extracting(GetMessagesResponse.class::cast) .flatExtracting(GetMessagesResponse::list) .extracting(Message::getKeywords) - .containsOnly( - ImmutableMap.of( - "$Answered", true, - FORWARDED, true)); + .containsOnlyElementsOf( + ImmutableList.of( + ImmutableMap.of( + "$Answered", true, + FORWARDED, true))); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/0efe1e33/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/FilterConditionTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/FilterConditionTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/FilterConditionTest.java index 5efaecc..79c232f 100644 --- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/FilterConditionTest.java +++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/FilterConditionTest.java @@ -23,16 +23,14 @@ import static org.assertj.core.api.Assertions.assertThat; import java.time.ZonedDateTime; import java.util.Optional; -import java.util.Set; import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; import nl.jqno.equalsverifier.EqualsVerifier; -import org.junit.rules.ExpectedException; public class FilterConditionTest { http://git-wip-us.apache.org/repos/asf/james-project/blob/0efe1e33/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/KeywordTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/KeywordTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/KeywordTest.java index 12fcf0a..3eeb6f5 100644 --- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/KeywordTest.java +++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/KeywordTest.java @@ -31,7 +31,6 @@ import org.junit.Test; import org.junit.rules.ExpectedException; public class KeywordTest { - private final static String FORWARDED = "forwarded"; private final static int FLAG_NAME_MAX_LENTH = 255; private final static String ANY_KEYWORD = "AnyKeyword"; http://git-wip-us.apache.org/repos/asf/james-project/blob/0efe1e33/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/UpdateMessagePatchTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/UpdateMessagePatchTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/UpdateMessagePatchTest.java index e227746..00aeee3 100644 --- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/UpdateMessagePatchTest.java +++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/UpdateMessagePatchTest.java @@ -20,19 +20,19 @@ package org.apache.james.jmap.model; import static org.assertj.core.api.Assertions.assertThat; + import java.util.Arrays; import java.util.List; + import javax.mail.Flags; import org.apache.james.mailbox.FlagsBuilder; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; - import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import com.google.common.collect.ImmutableMap; + public class UpdateMessagePatchTest { private final static String FORWARDED = "forwarded"; @Rule @@ -46,7 +46,7 @@ public class UpdateMessagePatchTest { @Test public void builderShouldSetUnreadFalseWhenBuiltWithIsUnreadFalse() { - UpdateMessagePatch testee = UpdateMessagePatch.builder().isUnread(false).build(); + UpdateMessagePatch.builder().isUnread(false).build(); } @Test http://git-wip-us.apache.org/repos/asf/james-project/blob/0efe1e33/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/FilterToSearchQueryTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/FilterToSearchQueryTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/FilterToSearchQueryTest.java index aca9757..10f7ce0 100644 --- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/FilterToSearchQueryTest.java +++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/FilterToSearchQueryTest.java @@ -32,14 +32,12 @@ import org.apache.james.jmap.model.Filter; import org.apache.james.jmap.model.FilterCondition; import org.apache.james.jmap.model.FilterOperator; import org.apache.james.jmap.model.Header; -import org.apache.james.jmap.model.Keyword; import org.apache.james.mailbox.model.SearchQuery; import org.apache.james.mailbox.model.SearchQuery.AddressType; import org.apache.james.mailbox.model.SearchQuery.DateResolution; import org.junit.Test; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; public class FilterToSearchQueryTest { private final static String FORWARDED = "forwarded"; --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org