http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsLocaleDateTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsLocaleDateTest.java b/protocols/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsLocaleDateTest.java index 75f9b8e..91bde58 100644 --- a/protocols/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsLocaleDateTest.java +++ b/protocols/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsLocaleDateTest.java @@ -19,7 +19,7 @@ package org.apache.james.protocols.imap.utils; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.util.Locale; @@ -94,205 +94,205 @@ public class DecoderUtilsLocaleDateTest { @SuppressWarnings("deprecation") private void decodeDateTime() throws Exception { - assertEquals("21 Oct 1972 20:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0000").toGMTString()); - assertEquals("21 Oct 1972 19:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0100").toGMTString()); - assertEquals("21 Oct 1972 18:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0200").toGMTString()); - assertEquals("21 Oct 1972 17:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0300").toGMTString()); - assertEquals("21 Oct 1972 16:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0400").toGMTString()); - assertEquals("21 Oct 1972 15:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0500").toGMTString()); - assertEquals("21 Oct 1972 14:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0600").toGMTString()); - assertEquals("21 Oct 1972 13:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0700").toGMTString()); - assertEquals("21 Oct 1972 12:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0800").toGMTString()); - assertEquals("21 Oct 1972 11:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0900").toGMTString()); - assertEquals("21 Oct 1972 10:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1000").toGMTString()); - assertEquals("21 Oct 1972 09:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1100").toGMTString()); - assertEquals("21 Oct 1972 08:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1200").toGMTString()); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0000").toGMTString()).isEqualTo("21 Oct 1972 20:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0100").toGMTString()).isEqualTo("21 Oct 1972 19:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0200").toGMTString()).isEqualTo("21 Oct 1972 18:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0300").toGMTString()).isEqualTo("21 Oct 1972 17:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0400").toGMTString()).isEqualTo("21 Oct 1972 16:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0500").toGMTString()).isEqualTo("21 Oct 1972 15:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0600").toGMTString()).isEqualTo("21 Oct 1972 14:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0700").toGMTString()).isEqualTo("21 Oct 1972 13:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0800").toGMTString()).isEqualTo("21 Oct 1972 12:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0900").toGMTString()).isEqualTo("21 Oct 1972 11:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1000").toGMTString()).isEqualTo("21 Oct 1972 10:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1100").toGMTString()).isEqualTo("21 Oct 1972 09:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1200").toGMTString()).isEqualTo("21 Oct 1972 08:00:00 GMT"); - assertEquals("21 Oct 1972 10:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1000").toGMTString()); - assertEquals("21 Oct 1972 21:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0100").toGMTString()); - assertEquals("21 Oct 1972 22:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0200").toGMTString()); - assertEquals("21 Oct 1972 23:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0300").toGMTString()); - assertEquals("22 Oct 1972 00:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0400").toGMTString()); - assertEquals("22 Oct 1972 01:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0500").toGMTString()); - assertEquals("22 Oct 1972 02:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0600").toGMTString()); - assertEquals("22 Oct 1972 03:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0700").toGMTString()); - assertEquals("22 Oct 1972 04:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0800").toGMTString()); - assertEquals("22 Oct 1972 05:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0900").toGMTString()); - assertEquals("22 Oct 1972 06:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -1000").toGMTString()); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1000").toGMTString()).isEqualTo("21 Oct 1972 10:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0100").toGMTString()).isEqualTo("21 Oct 1972 21:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0200").toGMTString()).isEqualTo("21 Oct 1972 22:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0300").toGMTString()).isEqualTo("21 Oct 1972 23:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0400").toGMTString()).isEqualTo("22 Oct 1972 00:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0500").toGMTString()).isEqualTo("22 Oct 1972 01:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0600").toGMTString()).isEqualTo("22 Oct 1972 02:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0700").toGMTString()).isEqualTo("22 Oct 1972 03:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0800").toGMTString()).isEqualTo("22 Oct 1972 04:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0900").toGMTString()).isEqualTo("22 Oct 1972 05:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -1000").toGMTString()).isEqualTo("22 Oct 1972 06:00:00 GMT"); - assertEquals("21 Oct 1972 19:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0030").toGMTString()); - assertEquals("21 Oct 1972 18:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0130").toGMTString()); - assertEquals("21 Oct 1972 17:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0230").toGMTString()); - assertEquals("21 Oct 1972 16:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0330").toGMTString()); - assertEquals("21 Oct 1972 15:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0430").toGMTString()); - assertEquals("21 Oct 1972 14:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0530").toGMTString()); - assertEquals("21 Oct 1972 13:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0630").toGMTString()); - assertEquals("21 Oct 1972 12:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0730").toGMTString()); - assertEquals("21 Oct 1972 11:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0830").toGMTString()); - assertEquals("21 Oct 1972 10:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0930").toGMTString()); - assertEquals("21 Oct 1972 09:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1030").toGMTString()); - assertEquals("21 Oct 1972 08:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1130").toGMTString()); - assertEquals("21 Oct 1972 07:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1230").toGMTString()); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0030").toGMTString()).isEqualTo("21 Oct 1972 19:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0130").toGMTString()).isEqualTo("21 Oct 1972 18:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0230").toGMTString()).isEqualTo("21 Oct 1972 17:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0330").toGMTString()).isEqualTo("21 Oct 1972 16:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0430").toGMTString()).isEqualTo("21 Oct 1972 15:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0530").toGMTString()).isEqualTo("21 Oct 1972 14:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0630").toGMTString()).isEqualTo("21 Oct 1972 13:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0730").toGMTString()).isEqualTo("21 Oct 1972 12:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0830").toGMTString()).isEqualTo("21 Oct 1972 11:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0930").toGMTString()).isEqualTo("21 Oct 1972 10:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1030").toGMTString()).isEqualTo("21 Oct 1972 09:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1130").toGMTString()).isEqualTo("21 Oct 1972 08:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1230").toGMTString()).isEqualTo("21 Oct 1972 07:30:00 GMT"); - assertEquals("21 Oct 1972 20:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0030").toGMTString()); - assertEquals("21 Oct 1972 21:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0130").toGMTString()); - assertEquals("21 Oct 1972 22:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0230").toGMTString()); - assertEquals("21 Oct 1972 23:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0330").toGMTString()); - assertEquals("22 Oct 1972 00:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0430").toGMTString()); - assertEquals("22 Oct 1972 01:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0530").toGMTString()); - assertEquals("22 Oct 1972 02:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0630").toGMTString()); - assertEquals("22 Oct 1972 03:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0730").toGMTString()); - assertEquals("22 Oct 1972 04:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0830").toGMTString()); - assertEquals("22 Oct 1972 05:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0930").toGMTString()); - assertEquals("22 Oct 1972 06:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -1030").toGMTString()); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0030").toGMTString()).isEqualTo("21 Oct 1972 20:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0130").toGMTString()).isEqualTo("21 Oct 1972 21:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0230").toGMTString()).isEqualTo("21 Oct 1972 22:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0330").toGMTString()).isEqualTo("21 Oct 1972 23:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0430").toGMTString()).isEqualTo("22 Oct 1972 00:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0530").toGMTString()).isEqualTo("22 Oct 1972 01:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0630").toGMTString()).isEqualTo("22 Oct 1972 02:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0730").toGMTString()).isEqualTo("22 Oct 1972 03:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0830").toGMTString()).isEqualTo("22 Oct 1972 04:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0930").toGMTString()).isEqualTo("22 Oct 1972 05:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -1030").toGMTString()).isEqualTo("22 Oct 1972 06:30:00 GMT"); - assertEquals("21 Oct 1972 20:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0000").toGMTString()); - assertEquals("21 Oct 1972 19:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0100").toGMTString()); - assertEquals("21 Oct 1972 18:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0200").toGMTString()); - assertEquals("21 Oct 1972 17:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0300").toGMTString()); - assertEquals("21 Oct 1972 16:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0400").toGMTString()); - assertEquals("21 Oct 1972 15:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0500").toGMTString()); - assertEquals("21 Oct 1972 14:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0600").toGMTString()); - assertEquals("21 Oct 1972 13:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0700").toGMTString()); - assertEquals("21 Oct 1972 12:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0800").toGMTString()); - assertEquals("21 Oct 1972 11:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0900").toGMTString()); - assertEquals("21 Oct 1972 10:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +1000").toGMTString()); - assertEquals("21 Oct 1972 09:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +1100").toGMTString()); - assertEquals("21 Oct 1972 08:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +1200").toGMTString()); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0000").toGMTString()).isEqualTo("21 Oct 1972 20:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0100").toGMTString()).isEqualTo("21 Oct 1972 19:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0200").toGMTString()).isEqualTo("21 Oct 1972 18:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0300").toGMTString()).isEqualTo("21 Oct 1972 17:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0400").toGMTString()).isEqualTo("21 Oct 1972 16:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0500").toGMTString()).isEqualTo("21 Oct 1972 15:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0600").toGMTString()).isEqualTo("21 Oct 1972 14:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0700").toGMTString()).isEqualTo("21 Oct 1972 13:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0800").toGMTString()).isEqualTo("21 Oct 1972 12:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0900").toGMTString()).isEqualTo("21 Oct 1972 11:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +1000").toGMTString()).isEqualTo("21 Oct 1972 10:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +1100").toGMTString()).isEqualTo("21 Oct 1972 09:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +1200").toGMTString()).isEqualTo("21 Oct 1972 08:16:27 GMT"); - assertEquals("21 Oct 1972 20:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0000").toGMTString()); - assertEquals("21 Oct 1972 21:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0100").toGMTString()); - assertEquals("21 Oct 1972 22:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0200").toGMTString()); - assertEquals("21 Oct 1972 23:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0300").toGMTString()); - assertEquals("22 Oct 1972 00:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0400").toGMTString()); - assertEquals("22 Oct 1972 01:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0500").toGMTString()); - assertEquals("22 Oct 1972 02:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0600").toGMTString()); - assertEquals("22 Oct 1972 03:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0700").toGMTString()); - assertEquals("22 Oct 1972 04:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0800").toGMTString()); - assertEquals("22 Oct 1972 05:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0900").toGMTString()); - assertEquals("22 Oct 1972 06:16:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -1000").toGMTString()); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0000").toGMTString()).isEqualTo("21 Oct 1972 20:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0100").toGMTString()).isEqualTo("21 Oct 1972 21:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0200").toGMTString()).isEqualTo("21 Oct 1972 22:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0300").toGMTString()).isEqualTo("21 Oct 1972 23:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0400").toGMTString()).isEqualTo("22 Oct 1972 00:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0500").toGMTString()).isEqualTo("22 Oct 1972 01:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0600").toGMTString()).isEqualTo("22 Oct 1972 02:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0700").toGMTString()).isEqualTo("22 Oct 1972 03:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0800").toGMTString()).isEqualTo("22 Oct 1972 04:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0900").toGMTString()).isEqualTo("22 Oct 1972 05:16:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -1000").toGMTString()).isEqualTo("22 Oct 1972 06:16:27 GMT"); - assertEquals("21 Oct 1972 19:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0030").toGMTString()); - assertEquals("21 Oct 1972 18:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0130").toGMTString()); - assertEquals("21 Oct 1972 17:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0230").toGMTString()); - assertEquals("21 Oct 1972 16:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0330").toGMTString()); - assertEquals("21 Oct 1972 15:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0430").toGMTString()); - assertEquals("21 Oct 1972 14:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0530").toGMTString()); - assertEquals("21 Oct 1972 13:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0630").toGMTString()); - assertEquals("21 Oct 1972 12:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0730").toGMTString()); - assertEquals("21 Oct 1972 11:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0830").toGMTString()); - assertEquals("21 Oct 1972 10:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +0930").toGMTString()); - assertEquals("21 Oct 1972 09:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +1030").toGMTString()); - assertEquals("21 Oct 1972 08:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +1130").toGMTString()); - assertEquals("21 Oct 1972 07:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 +1230").toGMTString()); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0030").toGMTString()).isEqualTo("21 Oct 1972 19:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0130").toGMTString()).isEqualTo("21 Oct 1972 18:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0230").toGMTString()).isEqualTo("21 Oct 1972 17:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0330").toGMTString()).isEqualTo("21 Oct 1972 16:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0430").toGMTString()).isEqualTo("21 Oct 1972 15:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0530").toGMTString()).isEqualTo("21 Oct 1972 14:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0630").toGMTString()).isEqualTo("21 Oct 1972 13:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0730").toGMTString()).isEqualTo("21 Oct 1972 12:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0830").toGMTString()).isEqualTo("21 Oct 1972 11:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +0930").toGMTString()).isEqualTo("21 Oct 1972 10:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +1030").toGMTString()).isEqualTo("21 Oct 1972 09:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +1130").toGMTString()).isEqualTo("21 Oct 1972 08:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 +1230").toGMTString()).isEqualTo("21 Oct 1972 07:46:27 GMT"); - assertEquals("21 Oct 1972 20:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0030").toGMTString()); - assertEquals("21 Oct 1972 21:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0130").toGMTString()); - assertEquals("21 Oct 1972 22:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0230").toGMTString()); - assertEquals("21 Oct 1972 23:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0330").toGMTString()); - assertEquals("22 Oct 1972 00:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0430").toGMTString()); - assertEquals("22 Oct 1972 01:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0530").toGMTString()); - assertEquals("22 Oct 1972 02:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0630").toGMTString()); - assertEquals("22 Oct 1972 03:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0730").toGMTString()); - assertEquals("22 Oct 1972 04:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0830").toGMTString()); - assertEquals("22 Oct 1972 05:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -0930").toGMTString()); - assertEquals("22 Oct 1972 06:46:27 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:16:27 -1030").toGMTString()); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0030").toGMTString()).isEqualTo("21 Oct 1972 20:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0130").toGMTString()).isEqualTo("21 Oct 1972 21:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0230").toGMTString()).isEqualTo("21 Oct 1972 22:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0330").toGMTString()).isEqualTo("21 Oct 1972 23:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0430").toGMTString()).isEqualTo("22 Oct 1972 00:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0530").toGMTString()).isEqualTo("22 Oct 1972 01:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0630").toGMTString()).isEqualTo("22 Oct 1972 02:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0730").toGMTString()).isEqualTo("22 Oct 1972 03:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0830").toGMTString()).isEqualTo("22 Oct 1972 04:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -0930").toGMTString()).isEqualTo("22 Oct 1972 05:46:27 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:16:27 -1030").toGMTString()).isEqualTo("22 Oct 1972 06:46:27 GMT"); } }
http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsTest.java b/protocols/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsTest.java index 3f67f57..7920658 100644 --- a/protocols/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsTest.java +++ b/protocols/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsTest.java @@ -21,7 +21,6 @@ package org.apache.james.protocols.imap.utils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Fail.fail; -import static org.junit.Assert.assertEquals; import java.util.Calendar; import java.util.Date; @@ -115,74 +114,74 @@ public class DecoderUtilsTest { @Test @SuppressWarnings("deprecation") public void testSimpleDecodeDateTime() throws Exception { - assertEquals("21 Oct 1972 20:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0000").toGMTString()); - assertEquals("21 Oct 1972 19:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0100").toGMTString()); - assertEquals("21 Oct 1972 18:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0200").toGMTString()); - assertEquals("21 Oct 1972 17:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0300").toGMTString()); - assertEquals("21 Oct 1972 16:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0400").toGMTString()); - assertEquals("21 Oct 1972 15:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0500").toGMTString()); - assertEquals("21 Oct 1972 14:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0600").toGMTString()); - assertEquals("21 Oct 1972 13:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0700").toGMTString()); - assertEquals("21 Oct 1972 12:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0800").toGMTString()); - assertEquals("21 Oct 1972 11:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0900").toGMTString()); - assertEquals("21 Oct 1972 10:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1000").toGMTString()); - assertEquals("21 Oct 1972 09:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1100").toGMTString()); - assertEquals("21 Oct 1972 08:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1200").toGMTString()); - - assertEquals("21 Oct 1972 10:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +1000").toGMTString()); - assertEquals("21 Oct 1972 21:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0100").toGMTString()); - assertEquals("21 Oct 1972 22:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0200").toGMTString()); - assertEquals("21 Oct 1972 23:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0300").toGMTString()); - assertEquals("22 Oct 1972 00:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0400").toGMTString()); - assertEquals("22 Oct 1972 01:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0500").toGMTString()); - assertEquals("22 Oct 1972 02:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0600").toGMTString()); - assertEquals("22 Oct 1972 03:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0700").toGMTString()); - assertEquals("22 Oct 1972 04:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0800").toGMTString()); - assertEquals("22 Oct 1972 05:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0900").toGMTString()); - assertEquals("22 Oct 1972 06:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -1000").toGMTString()); - - assertEquals("21 Oct 1972 19:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 +0030").toGMTString()); - assertEquals("21 Oct 1972 20:30:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -0030").toGMTString()); - - assertEquals("22 Oct 1972 06:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 20:00:00 -1000").toGMTString()); - assertEquals("20 Oct 1972 20:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 06:00:00 +1000").toGMTString()); - assertEquals("21 Oct 1972 16:00:00 GMT", DecoderUtils.decodeDateTime( - "21-Oct-1972 06:00:00 -1000").toGMTString()); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0000").toGMTString()).isEqualTo("21 Oct 1972 20:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0100").toGMTString()).isEqualTo("21 Oct 1972 19:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0200").toGMTString()).isEqualTo("21 Oct 1972 18:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0300").toGMTString()).isEqualTo("21 Oct 1972 17:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0400").toGMTString()).isEqualTo("21 Oct 1972 16:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0500").toGMTString()).isEqualTo("21 Oct 1972 15:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0600").toGMTString()).isEqualTo("21 Oct 1972 14:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0700").toGMTString()).isEqualTo("21 Oct 1972 13:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0800").toGMTString()).isEqualTo("21 Oct 1972 12:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0900").toGMTString()).isEqualTo("21 Oct 1972 11:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1000").toGMTString()).isEqualTo("21 Oct 1972 10:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1100").toGMTString()).isEqualTo("21 Oct 1972 09:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1200").toGMTString()).isEqualTo("21 Oct 1972 08:00:00 GMT"); + + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +1000").toGMTString()).isEqualTo("21 Oct 1972 10:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0100").toGMTString()).isEqualTo("21 Oct 1972 21:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0200").toGMTString()).isEqualTo("21 Oct 1972 22:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0300").toGMTString()).isEqualTo("21 Oct 1972 23:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0400").toGMTString()).isEqualTo("22 Oct 1972 00:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0500").toGMTString()).isEqualTo("22 Oct 1972 01:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0600").toGMTString()).isEqualTo("22 Oct 1972 02:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0700").toGMTString()).isEqualTo("22 Oct 1972 03:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0800").toGMTString()).isEqualTo("22 Oct 1972 04:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0900").toGMTString()).isEqualTo("22 Oct 1972 05:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -1000").toGMTString()).isEqualTo("22 Oct 1972 06:00:00 GMT"); + + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 +0030").toGMTString()).isEqualTo("21 Oct 1972 19:30:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -0030").toGMTString()).isEqualTo("21 Oct 1972 20:30:00 GMT"); + + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 20:00:00 -1000").toGMTString()).isEqualTo("22 Oct 1972 06:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 06:00:00 +1000").toGMTString()).isEqualTo("20 Oct 1972 20:00:00 GMT"); + assertThat(DecoderUtils.decodeDateTime( + "21-Oct-1972 06:00:00 -1000").toGMTString()).isEqualTo("21 Oct 1972 16:00:00 GMT"); } @Test @SuppressWarnings("deprecation") public void testAppleMailPrependsZeroNotSpace() throws Exception { - assertEquals("9 Apr 2008 13:17:51 GMT", DecoderUtils.decodeDateTime( - "09-Apr-2008 15:17:51 +0200").toGMTString()); + assertThat(DecoderUtils.decodeDateTime( + "09-Apr-2008 15:17:51 +0200").toGMTString()).isEqualTo("9 Apr 2008 13:17:51 GMT"); } @Test @@ -250,7 +249,7 @@ public class DecoderUtilsTest { private void dateDecode(String in, TimeZone zone) throws Exception { Date date = DecoderUtils.decodeDateTime(in); String out = formatAsImap(date, zone); - assertEquals("Round trip", in, out); + assertThat(out).describedAs("Round trip").isEqualTo(in); } private String formatAsImap(Date date, TimeZone zone) { @@ -266,16 +265,16 @@ public class DecoderUtilsTest { @Test public void testDecodeDigit() throws Exception { - assertEquals(0, DecoderUtils.decodeDigit('0')); - assertEquals(1, DecoderUtils.decodeDigit('1')); - assertEquals(2, DecoderUtils.decodeDigit('2')); - assertEquals(3, DecoderUtils.decodeDigit('3')); - assertEquals(4, DecoderUtils.decodeDigit('4')); - assertEquals(5, DecoderUtils.decodeDigit('5')); - assertEquals(6, DecoderUtils.decodeDigit('6')); - assertEquals(7, DecoderUtils.decodeDigit('7')); - assertEquals(8, DecoderUtils.decodeDigit('8')); - assertEquals(9, DecoderUtils.decodeDigit('9')); + assertThat(DecoderUtils.decodeDigit('0')).isEqualTo(0); + assertThat(DecoderUtils.decodeDigit('1')).isEqualTo(1); + assertThat(DecoderUtils.decodeDigit('2')).isEqualTo(2); + assertThat(DecoderUtils.decodeDigit('3')).isEqualTo(3); + assertThat(DecoderUtils.decodeDigit('4')).isEqualTo(4); + assertThat(DecoderUtils.decodeDigit('5')).isEqualTo(5); + assertThat(DecoderUtils.decodeDigit('6')).isEqualTo(6); + assertThat(DecoderUtils.decodeDigit('7')).isEqualTo(7); + assertThat(DecoderUtils.decodeDigit('8')).isEqualTo(8); + assertThat(DecoderUtils.decodeDigit('9')).isEqualTo(9); try { DecoderUtils.decodeDigit('/'); @@ -294,32 +293,32 @@ public class DecoderUtilsTest { @Test public void testDecodeMonth() throws Exception { - assertEquals(Calendar.JANUARY, DecoderUtils.decodeMonth('J', 'A', 'N')); - assertEquals(Calendar.JANUARY, DecoderUtils.decodeMonth('j', 'a', 'n')); - assertEquals(Calendar.FEBRUARY, DecoderUtils.decodeMonth('F', 'E', 'B')); - assertEquals(Calendar.FEBRUARY, DecoderUtils.decodeMonth('f', 'e', 'b')); - assertEquals(Calendar.MARCH, DecoderUtils.decodeMonth('M', 'A', 'R')); - assertEquals(Calendar.MARCH, DecoderUtils.decodeMonth('m', 'a', 'r')); - assertEquals(Calendar.APRIL, DecoderUtils.decodeMonth('A', 'P', 'R')); - assertEquals(Calendar.APRIL, DecoderUtils.decodeMonth('a', 'p', 'r')); - assertEquals(Calendar.MAY, DecoderUtils.decodeMonth('M', 'A', 'Y')); - assertEquals(Calendar.MAY, DecoderUtils.decodeMonth('m', 'a', 'y')); - assertEquals(Calendar.JUNE, DecoderUtils.decodeMonth('J', 'U', 'N')); - assertEquals(Calendar.JUNE, DecoderUtils.decodeMonth('j', 'u', 'n')); - assertEquals(Calendar.JULY, DecoderUtils.decodeMonth('J', 'U', 'L')); - assertEquals(Calendar.JULY, DecoderUtils.decodeMonth('j', 'u', 'l')); - assertEquals(Calendar.AUGUST, DecoderUtils.decodeMonth('A', 'U', 'G')); - assertEquals(Calendar.AUGUST, DecoderUtils.decodeMonth('a', 'u', 'g')); - assertEquals(Calendar.SEPTEMBER, DecoderUtils - .decodeMonth('S', 'E', 'P')); - assertEquals(Calendar.SEPTEMBER, DecoderUtils - .decodeMonth('s', 'e', 'p')); - assertEquals(Calendar.OCTOBER, DecoderUtils.decodeMonth('O', 'C', 'T')); - assertEquals(Calendar.OCTOBER, DecoderUtils.decodeMonth('o', 'c', 't')); - assertEquals(Calendar.NOVEMBER, DecoderUtils.decodeMonth('N', 'O', 'V')); - assertEquals(Calendar.NOVEMBER, DecoderUtils.decodeMonth('n', 'o', 'v')); - assertEquals(Calendar.DECEMBER, DecoderUtils.decodeMonth('D', 'E', 'C')); - assertEquals(Calendar.DECEMBER, DecoderUtils.decodeMonth('d', 'e', 'c')); + assertThat(DecoderUtils.decodeMonth('J', 'A', 'N')).isEqualTo(Calendar.JANUARY); + assertThat(DecoderUtils.decodeMonth('j', 'a', 'n')).isEqualTo(Calendar.JANUARY); + assertThat(DecoderUtils.decodeMonth('F', 'E', 'B')).isEqualTo(Calendar.FEBRUARY); + assertThat(DecoderUtils.decodeMonth('f', 'e', 'b')).isEqualTo(Calendar.FEBRUARY); + assertThat(DecoderUtils.decodeMonth('M', 'A', 'R')).isEqualTo(Calendar.MARCH); + assertThat(DecoderUtils.decodeMonth('m', 'a', 'r')).isEqualTo(Calendar.MARCH); + assertThat(DecoderUtils.decodeMonth('A', 'P', 'R')).isEqualTo(Calendar.APRIL); + assertThat(DecoderUtils.decodeMonth('a', 'p', 'r')).isEqualTo(Calendar.APRIL); + assertThat(DecoderUtils.decodeMonth('M', 'A', 'Y')).isEqualTo(Calendar.MAY); + assertThat(DecoderUtils.decodeMonth('m', 'a', 'y')).isEqualTo(Calendar.MAY); + assertThat(DecoderUtils.decodeMonth('J', 'U', 'N')).isEqualTo(Calendar.JUNE); + assertThat(DecoderUtils.decodeMonth('j', 'u', 'n')).isEqualTo(Calendar.JUNE); + assertThat(DecoderUtils.decodeMonth('J', 'U', 'L')).isEqualTo(Calendar.JULY); + assertThat(DecoderUtils.decodeMonth('j', 'u', 'l')).isEqualTo(Calendar.JULY); + assertThat(DecoderUtils.decodeMonth('A', 'U', 'G')).isEqualTo(Calendar.AUGUST); + assertThat(DecoderUtils.decodeMonth('a', 'u', 'g')).isEqualTo(Calendar.AUGUST); + assertThat(DecoderUtils + .decodeMonth('S', 'E', 'P')).isEqualTo(Calendar.SEPTEMBER); + assertThat(DecoderUtils + .decodeMonth('s', 'e', 'p')).isEqualTo(Calendar.SEPTEMBER); + assertThat(DecoderUtils.decodeMonth('O', 'C', 'T')).isEqualTo(Calendar.OCTOBER); + assertThat(DecoderUtils.decodeMonth('o', 'c', 't')).isEqualTo(Calendar.OCTOBER); + assertThat(DecoderUtils.decodeMonth('N', 'O', 'V')).isEqualTo(Calendar.NOVEMBER); + assertThat(DecoderUtils.decodeMonth('n', 'o', 'v')).isEqualTo(Calendar.NOVEMBER); + assertThat(DecoderUtils.decodeMonth('D', 'E', 'C')).isEqualTo(Calendar.DECEMBER); + assertThat(DecoderUtils.decodeMonth('d', 'e', 'c')).isEqualTo(Calendar.DECEMBER); } @Test @@ -342,16 +341,16 @@ public class DecoderUtilsTest { @Test public void testDecodeYear() throws Exception { - assertEquals(1999, DecoderUtils.decodeYear('1', '9', '9', '9')); - assertEquals(747, DecoderUtils.decodeYear('0', '7', '4', '7')); - assertEquals(2525, DecoderUtils.decodeYear('2', '5', '2', '5')); - assertEquals(5678, DecoderUtils.decodeYear('5', '6', '7', '8')); - assertEquals(2453, DecoderUtils.decodeYear('2', '4', '5', '3')); - assertEquals(2000, DecoderUtils.decodeYear('2', '0', '0', '0')); - assertEquals(2007, DecoderUtils.decodeYear('2', '0', '0', '7')); - assertEquals(2008, DecoderUtils.decodeYear('2', '0', '0', '8')); - assertEquals(2010, DecoderUtils.decodeYear('2', '0', '1', '0')); - assertEquals(2020, DecoderUtils.decodeYear('2', '0', '2', '0')); + assertThat(DecoderUtils.decodeYear('1', '9', '9', '9')).isEqualTo(1999); + assertThat(DecoderUtils.decodeYear('0', '7', '4', '7')).isEqualTo(747); + assertThat(DecoderUtils.decodeYear('2', '5', '2', '5')).isEqualTo(2525); + assertThat(DecoderUtils.decodeYear('5', '6', '7', '8')).isEqualTo(5678); + assertThat(DecoderUtils.decodeYear('2', '4', '5', '3')).isEqualTo(2453); + assertThat(DecoderUtils.decodeYear('2', '0', '0', '0')).isEqualTo(2000); + assertThat(DecoderUtils.decodeYear('2', '0', '0', '7')).isEqualTo(2007); + assertThat(DecoderUtils.decodeYear('2', '0', '0', '8')).isEqualTo(2008); + assertThat(DecoderUtils.decodeYear('2', '0', '1', '0')).isEqualTo(2010); + assertThat(DecoderUtils.decodeYear('2', '0', '2', '0')).isEqualTo(2020); } @Test @@ -374,58 +373,58 @@ public class DecoderUtilsTest { @Test public void testDecodeZone() throws Exception { - assertEquals(0, DecoderUtils.decodeZone('+', '0', '0', '0', '0')); - assertEquals(100, DecoderUtils.decodeZone('+', '0', '1', '0', '0')); - assertEquals(200, DecoderUtils.decodeZone('+', '0', '2', '0', '0')); - assertEquals(300, DecoderUtils.decodeZone('+', '0', '3', '0', '0')); - assertEquals(400, DecoderUtils.decodeZone('+', '0', '4', '0', '0')); - assertEquals(500, DecoderUtils.decodeZone('+', '0', '5', '0', '0')); - assertEquals(600, DecoderUtils.decodeZone('+', '0', '6', '0', '0')); - assertEquals(700, DecoderUtils.decodeZone('+', '0', '7', '0', '0')); - assertEquals(800, DecoderUtils.decodeZone('+', '0', '8', '0', '0')); - assertEquals(900, DecoderUtils.decodeZone('+', '0', '9', '0', '0')); - assertEquals(1000, DecoderUtils.decodeZone('+', '1', '0', '0', '0')); - assertEquals(1100, DecoderUtils.decodeZone('+', '1', '1', '0', '0')); - assertEquals(1200, DecoderUtils.decodeZone('+', '1', '2', '0', '0')); - assertEquals(30, DecoderUtils.decodeZone('+', '0', '0', '3', '0')); - assertEquals(130, DecoderUtils.decodeZone('+', '0', '1', '3', '0')); - assertEquals(230, DecoderUtils.decodeZone('+', '0', '2', '3', '0')); - assertEquals(330, DecoderUtils.decodeZone('+', '0', '3', '3', '0')); - assertEquals(430, DecoderUtils.decodeZone('+', '0', '4', '3', '0')); - assertEquals(530, DecoderUtils.decodeZone('+', '0', '5', '3', '0')); - assertEquals(630, DecoderUtils.decodeZone('+', '0', '6', '3', '0')); - assertEquals(730, DecoderUtils.decodeZone('+', '0', '7', '3', '0')); - assertEquals(830, DecoderUtils.decodeZone('+', '0', '8', '3', '0')); - assertEquals(930, DecoderUtils.decodeZone('+', '0', '9', '3', '0')); - assertEquals(1030, DecoderUtils.decodeZone('+', '1', '0', '3', '0')); - assertEquals(1130, DecoderUtils.decodeZone('+', '1', '1', '3', '0')); - assertEquals(1111, DecoderUtils.decodeZone('+', '1', '1', '1', '1')); - assertEquals(0, DecoderUtils.decodeZone('-', '0', '0', '0', '0')); - assertEquals(-100, DecoderUtils.decodeZone('-', '0', '1', '0', '0')); - assertEquals(-200, DecoderUtils.decodeZone('-', '0', '2', '0', '0')); - assertEquals(-300, DecoderUtils.decodeZone('-', '0', '3', '0', '0')); - assertEquals(-400, DecoderUtils.decodeZone('-', '0', '4', '0', '0')); - assertEquals(-500, DecoderUtils.decodeZone('-', '0', '5', '0', '0')); - assertEquals(-600, DecoderUtils.decodeZone('-', '0', '6', '0', '0')); - assertEquals(-700, DecoderUtils.decodeZone('-', '0', '7', '0', '0')); - assertEquals(-800, DecoderUtils.decodeZone('-', '0', '8', '0', '0')); - assertEquals(-900, DecoderUtils.decodeZone('-', '0', '9', '0', '0')); - assertEquals(-1000, DecoderUtils.decodeZone('-', '1', '0', '0', '0')); - assertEquals(-1100, DecoderUtils.decodeZone('-', '1', '1', '0', '0')); - assertEquals(-1200, DecoderUtils.decodeZone('-', '1', '2', '0', '0')); - assertEquals(-30, DecoderUtils.decodeZone('-', '0', '0', '3', '0')); - assertEquals(-130, DecoderUtils.decodeZone('-', '0', '1', '3', '0')); - assertEquals(-230, DecoderUtils.decodeZone('-', '0', '2', '3', '0')); - assertEquals(-330, DecoderUtils.decodeZone('-', '0', '3', '3', '0')); - assertEquals(-430, DecoderUtils.decodeZone('-', '0', '4', '3', '0')); - assertEquals(-530, DecoderUtils.decodeZone('-', '0', '5', '3', '0')); - assertEquals(-630, DecoderUtils.decodeZone('-', '0', '6', '3', '0')); - assertEquals(-730, DecoderUtils.decodeZone('-', '0', '7', '3', '0')); - assertEquals(-830, DecoderUtils.decodeZone('-', '0', '8', '3', '0')); - assertEquals(-930, DecoderUtils.decodeZone('-', '0', '9', '3', '0')); - assertEquals(-1030, DecoderUtils.decodeZone('-', '1', '0', '3', '0')); - assertEquals(-1130, DecoderUtils.decodeZone('-', '1', '1', '3', '0')); - assertEquals(-1111, DecoderUtils.decodeZone('-', '1', '1', '1', '1')); + assertThat(DecoderUtils.decodeZone('+', '0', '0', '0', '0')).isEqualTo(0); + assertThat(DecoderUtils.decodeZone('+', '0', '1', '0', '0')).isEqualTo(100); + assertThat(DecoderUtils.decodeZone('+', '0', '2', '0', '0')).isEqualTo(200); + assertThat(DecoderUtils.decodeZone('+', '0', '3', '0', '0')).isEqualTo(300); + assertThat(DecoderUtils.decodeZone('+', '0', '4', '0', '0')).isEqualTo(400); + assertThat(DecoderUtils.decodeZone('+', '0', '5', '0', '0')).isEqualTo(500); + assertThat(DecoderUtils.decodeZone('+', '0', '6', '0', '0')).isEqualTo(600); + assertThat(DecoderUtils.decodeZone('+', '0', '7', '0', '0')).isEqualTo(700); + assertThat(DecoderUtils.decodeZone('+', '0', '8', '0', '0')).isEqualTo(800); + assertThat(DecoderUtils.decodeZone('+', '0', '9', '0', '0')).isEqualTo(900); + assertThat(DecoderUtils.decodeZone('+', '1', '0', '0', '0')).isEqualTo(1000); + assertThat(DecoderUtils.decodeZone('+', '1', '1', '0', '0')).isEqualTo(1100); + assertThat(DecoderUtils.decodeZone('+', '1', '2', '0', '0')).isEqualTo(1200); + assertThat(DecoderUtils.decodeZone('+', '0', '0', '3', '0')).isEqualTo(30); + assertThat(DecoderUtils.decodeZone('+', '0', '1', '3', '0')).isEqualTo(130); + assertThat(DecoderUtils.decodeZone('+', '0', '2', '3', '0')).isEqualTo(230); + assertThat(DecoderUtils.decodeZone('+', '0', '3', '3', '0')).isEqualTo(330); + assertThat(DecoderUtils.decodeZone('+', '0', '4', '3', '0')).isEqualTo(430); + assertThat(DecoderUtils.decodeZone('+', '0', '5', '3', '0')).isEqualTo(530); + assertThat(DecoderUtils.decodeZone('+', '0', '6', '3', '0')).isEqualTo(630); + assertThat(DecoderUtils.decodeZone('+', '0', '7', '3', '0')).isEqualTo(730); + assertThat(DecoderUtils.decodeZone('+', '0', '8', '3', '0')).isEqualTo(830); + assertThat(DecoderUtils.decodeZone('+', '0', '9', '3', '0')).isEqualTo(930); + assertThat(DecoderUtils.decodeZone('+', '1', '0', '3', '0')).isEqualTo(1030); + assertThat(DecoderUtils.decodeZone('+', '1', '1', '3', '0')).isEqualTo(1130); + assertThat(DecoderUtils.decodeZone('+', '1', '1', '1', '1')).isEqualTo(1111); + assertThat(DecoderUtils.decodeZone('-', '0', '0', '0', '0')).isEqualTo(0); + assertThat(DecoderUtils.decodeZone('-', '0', '1', '0', '0')).isEqualTo(-100); + assertThat(DecoderUtils.decodeZone('-', '0', '2', '0', '0')).isEqualTo(-200); + assertThat(DecoderUtils.decodeZone('-', '0', '3', '0', '0')).isEqualTo(-300); + assertThat(DecoderUtils.decodeZone('-', '0', '4', '0', '0')).isEqualTo(-400); + assertThat(DecoderUtils.decodeZone('-', '0', '5', '0', '0')).isEqualTo(-500); + assertThat(DecoderUtils.decodeZone('-', '0', '6', '0', '0')).isEqualTo(-600); + assertThat(DecoderUtils.decodeZone('-', '0', '7', '0', '0')).isEqualTo(-700); + assertThat(DecoderUtils.decodeZone('-', '0', '8', '0', '0')).isEqualTo(-800); + assertThat(DecoderUtils.decodeZone('-', '0', '9', '0', '0')).isEqualTo(-900); + assertThat(DecoderUtils.decodeZone('-', '1', '0', '0', '0')).isEqualTo(-1000); + assertThat(DecoderUtils.decodeZone('-', '1', '1', '0', '0')).isEqualTo(-1100); + assertThat(DecoderUtils.decodeZone('-', '1', '2', '0', '0')).isEqualTo(-1200); + assertThat(DecoderUtils.decodeZone('-', '0', '0', '3', '0')).isEqualTo(-30); + assertThat(DecoderUtils.decodeZone('-', '0', '1', '3', '0')).isEqualTo(-130); + assertThat(DecoderUtils.decodeZone('-', '0', '2', '3', '0')).isEqualTo(-230); + assertThat(DecoderUtils.decodeZone('-', '0', '3', '3', '0')).isEqualTo(-330); + assertThat(DecoderUtils.decodeZone('-', '0', '4', '3', '0')).isEqualTo(-430); + assertThat(DecoderUtils.decodeZone('-', '0', '5', '3', '0')).isEqualTo(-530); + assertThat(DecoderUtils.decodeZone('-', '0', '6', '3', '0')).isEqualTo(-630); + assertThat(DecoderUtils.decodeZone('-', '0', '7', '3', '0')).isEqualTo(-730); + assertThat(DecoderUtils.decodeZone('-', '0', '8', '3', '0')).isEqualTo(-830); + assertThat(DecoderUtils.decodeZone('-', '0', '9', '3', '0')).isEqualTo(-930); + assertThat(DecoderUtils.decodeZone('-', '1', '0', '3', '0')).isEqualTo(-1030); + assertThat(DecoderUtils.decodeZone('-', '1', '1', '3', '0')).isEqualTo(-1130); + assertThat(DecoderUtils.decodeZone('-', '1', '1', '1', '1')).isEqualTo(-1111); } @@ -484,24 +483,24 @@ public class DecoderUtilsTest { @Test public void testDecodeNumber() throws Exception { - assertEquals(1, DecoderUtils.decodeNumber('0', '1')); - assertEquals(2, DecoderUtils.decodeNumber('0', '2')); - assertEquals(3, DecoderUtils.decodeNumber('0', '3')); - assertEquals(4, DecoderUtils.decodeNumber('0', '4')); - assertEquals(5, DecoderUtils.decodeNumber('0', '5')); - assertEquals(6, DecoderUtils.decodeNumber('0', '6')); - assertEquals(7, DecoderUtils.decodeNumber('0', '7')); - assertEquals(8, DecoderUtils.decodeNumber('0', '8')); - assertEquals(9, DecoderUtils.decodeNumber('0', '9')); - assertEquals(19, DecoderUtils.decodeNumber('1', '9')); - assertEquals(28, DecoderUtils.decodeNumber('2', '8')); - assertEquals(37, DecoderUtils.decodeNumber('3', '7')); - assertEquals(46, DecoderUtils.decodeNumber('4', '6')); - assertEquals(55, DecoderUtils.decodeNumber('5', '5')); - assertEquals(64, DecoderUtils.decodeNumber('6', '4')); - assertEquals(73, DecoderUtils.decodeNumber('7', '3')); - assertEquals(82, DecoderUtils.decodeNumber('8', '2')); - assertEquals(91, DecoderUtils.decodeNumber('9', '1')); + assertThat(DecoderUtils.decodeNumber('0', '1')).isEqualTo(1); + assertThat(DecoderUtils.decodeNumber('0', '2')).isEqualTo(2); + assertThat(DecoderUtils.decodeNumber('0', '3')).isEqualTo(3); + assertThat(DecoderUtils.decodeNumber('0', '4')).isEqualTo(4); + assertThat(DecoderUtils.decodeNumber('0', '5')).isEqualTo(5); + assertThat(DecoderUtils.decodeNumber('0', '6')).isEqualTo(6); + assertThat(DecoderUtils.decodeNumber('0', '7')).isEqualTo(7); + assertThat(DecoderUtils.decodeNumber('0', '8')).isEqualTo(8); + assertThat(DecoderUtils.decodeNumber('0', '9')).isEqualTo(9); + assertThat(DecoderUtils.decodeNumber('1', '9')).isEqualTo(19); + assertThat(DecoderUtils.decodeNumber('2', '8')).isEqualTo(28); + assertThat(DecoderUtils.decodeNumber('3', '7')).isEqualTo(37); + assertThat(DecoderUtils.decodeNumber('4', '6')).isEqualTo(46); + assertThat(DecoderUtils.decodeNumber('5', '5')).isEqualTo(55); + assertThat(DecoderUtils.decodeNumber('6', '4')).isEqualTo(64); + assertThat(DecoderUtils.decodeNumber('7', '3')).isEqualTo(73); + assertThat(DecoderUtils.decodeNumber('8', '2')).isEqualTo(82); + assertThat(DecoderUtils.decodeNumber('9', '1')).isEqualTo(91); } @Test http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java ---------------------------------------------------------------------- diff --git a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java index a12a1e4..f97c1a9 100644 --- a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java +++ b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java @@ -19,7 +19,6 @@ package org.apache.james.protocols.lmtp; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import java.io.IOException; import java.net.InetSocketAddress; @@ -223,7 +222,7 @@ public abstract class AbstractLMTPServerTest extends AbstractSMTPServerTest { int[] replies = ((LMTPClient)client).getReplies(); - assertEquals("Expected two replies",2, replies.length); + assertThat(replies.length).describedAs("Expected two replies").isEqualTo(2); assertThat(SMTPReply.isNegativePermanent(replies[0])).isTrue(); assertThat(SMTPReply.isPositiveCompletion(replies[1])).isTrue(); http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractStartTlsPOP3ServerTest.java ---------------------------------------------------------------------- diff --git a/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractStartTlsPOP3ServerTest.java b/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractStartTlsPOP3ServerTest.java index 8df10a5..7f48b1a 100644 --- a/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractStartTlsPOP3ServerTest.java +++ b/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractStartTlsPOP3ServerTest.java @@ -19,7 +19,6 @@ package org.apache.james.protocols.pop3; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import java.net.InetSocketAddress; import java.util.Arrays; @@ -75,7 +74,7 @@ public abstract class AbstractStartTlsPOP3ServerTest { // TODO: Make use of client.capa() once possible // See NET-438 - assertEquals(POP3Reply.OK, client.sendCommand("CAPA")); + assertThat(client.sendCommand("CAPA")).isEqualTo(POP3Reply.OK); client.getAdditionalReply(); boolean startTlsCapa = Arrays.stream(client.getReplyStrings()) http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/core/AbstractInputStreamTest.java ---------------------------------------------------------------------- diff --git a/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/core/AbstractInputStreamTest.java b/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/core/AbstractInputStreamTest.java index bc3153d..477ae31 100644 --- a/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/core/AbstractInputStreamTest.java +++ b/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/core/AbstractInputStreamTest.java @@ -18,12 +18,12 @@ ****************************************************************/ package org.apache.james.protocols.pop3.core; +import static org.assertj.core.api.Assertions.assertThat; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import org.junit.Assert; - public abstract class AbstractInputStreamTest { protected void checkRead(InputStream in, String expected) throws IOException { @@ -34,7 +34,7 @@ public abstract class AbstractInputStreamTest { } in.close(); out.close(); - Assert.assertEquals(expected, new String(out.toByteArray())); + assertThat(new String(out.toByteArray())).isEqualTo(expected); @@ -52,7 +52,7 @@ public abstract class AbstractInputStreamTest { in.close(); out.close(); - Assert.assertEquals(expected, new String(out.toByteArray())); + assertThat(new String(out.toByteArray())).isEqualTo(expected); } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandlerTest.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandlerTest.java index 82b3180..1b96bdb 100644 --- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandlerTest.java +++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandlerTest.java @@ -22,7 +22,6 @@ package org.apache.james.protocols.smtp.core.fastfail; import static org.apache.james.protocols.api.ProtocolSession.State.Connection; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import java.net.InetSocketAddress; import java.util.ArrayList; @@ -185,8 +184,7 @@ public class DNSRBLHandlerTest { rbl.setBlacklist(new String[] { "bl.spamcop.net." }); rbl.setGetDetail(true); rbl.doRcpt(mockedSMTPSession, null, new MailAddress("test@localhost")); - assertEquals("Details","Blocked - see http://www.spamcop.net/bl.shtml?127.0.0.2", - mockedSMTPSession.getAttachment(RBL_DETAIL_MAIL_ATTRIBUTE_NAME, State.Connection)); + assertThat(mockedSMTPSession.getAttachment(RBL_DETAIL_MAIL_ATTRIBUTE_NAME, State.Connection)).describedAs("Details").isEqualTo("Blocked - see http://www.spamcop.net/bl.shtml?127.0.0.2"); assertThat(mockedSMTPSession.getAttachment(RBL_BLOCKLISTED_MAIL_ATTRIBUTE_NAME, Connection)).withFailMessage("Blocked").isNotNull(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandlerTest.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandlerTest.java index a62edc5..0466456 100644 --- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandlerTest.java +++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandlerTest.java @@ -19,7 +19,7 @@ package org.apache.james.protocols.smtp.core.fastfail; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.util.HashMap; import java.util.Map; @@ -62,7 +62,7 @@ public class MaxRcptHandlerTest { handler.setMaxRcpt(2); HookReturnCode resp = handler.doRcpt(session,null,new MailAddress("test@test")).getResult(); - assertEquals("Rejected.. To many recipients", resp, HookReturnCode.deny()); + assertThat(HookReturnCode.deny()).describedAs("Rejected.. To many recipients").isEqualTo(resp); } @@ -74,7 +74,7 @@ public class MaxRcptHandlerTest { handler.setMaxRcpt(4); HookReturnCode resp = handler.doRcpt(session,null,new MailAddress("test@test")).getResult(); - assertEquals("Not Rejected..", resp, HookReturnCode.declined()); + assertThat(HookReturnCode.declined()).describedAs("Not Rejected..").isEqualTo(resp); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandlerTest.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandlerTest.java index cd5319c..128ce7d 100644 --- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandlerTest.java +++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandlerTest.java @@ -20,7 +20,7 @@ package org.apache.james.protocols.smtp.core.fastfail; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.util.HashMap; import java.util.Map; @@ -71,12 +71,12 @@ public class MaxUnknownCmdHandlerTest { MaxUnknownCmdHandler handler = new MaxUnknownCmdHandler(); handler.setMaxUnknownCmdCount(2); HookReturnCode resp = handler.doUnknown(session, "what").getResult(); - assertEquals(HookReturnCode.declined(), resp); + assertThat(resp).isEqualTo(HookReturnCode.declined()); resp = handler.doUnknown(session, "what").getResult(); - assertEquals(HookReturnCode.declined(), resp); + assertThat(resp).isEqualTo(HookReturnCode.declined()); resp = handler.doUnknown(session, "what").getResult(); - assertEquals(new HookReturnCode(HookReturnCode.Action.DENY, HookReturnCode.ConnectionStatus.Disconnected), resp); + assertThat(resp).isEqualTo(new HookReturnCode(HookReturnCode.Action.DENY, HookReturnCode.ConnectionStatus.Disconnected)); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandlerTest.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandlerTest.java index 85dfeef..468e0d3 100644 --- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandlerTest.java +++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandlerTest.java @@ -22,7 +22,6 @@ package org.apache.james.protocols.smtp.core.fastfail; import static org.apache.james.protocols.api.ProtocolSession.State.Transaction; import static org.apache.james.protocols.smtp.core.fastfail.ResolvableEhloHeloHandler.BAD_EHLO_HELO; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import java.net.InetAddress; import java.net.UnknownHostException; @@ -128,7 +127,7 @@ public class ResolvableEhloHeloHandlerTest { assertThat(session.getAttachment(BAD_EHLO_HELO, Transaction)).withFailMessage("Invalid HELO").isNotNull(); HookReturnCode result = handler.doRcpt(session,null, mailAddress).getResult(); - assertEquals("Reject", result,HookReturnCode.deny()); + assertThat(HookReturnCode.deny()).describedAs("Reject").isEqualTo(result); } @Test @@ -142,7 +141,7 @@ public class ResolvableEhloHeloHandlerTest { assertThat(session.getAttachment(BAD_EHLO_HELO, Transaction)).withFailMessage("Valid HELO").isNull(); HookReturnCode result = handler.doRcpt(session,null, mailAddress).getResult(); - assertEquals("Not reject", result,HookReturnCode.declined()); + assertThat(HookReturnCode.declined()).describedAs("Not reject").isEqualTo(result); } @Test @@ -157,7 +156,7 @@ public class ResolvableEhloHeloHandlerTest { HookReturnCode result = handler.doRcpt(session,null, mailAddress).getResult(); - assertEquals("Reject", result,HookReturnCode.deny()); + assertThat(HookReturnCode.deny()).describedAs("Reject").isEqualTo(result); } @@ -173,7 +172,7 @@ public class ResolvableEhloHeloHandlerTest { HookReturnCode result = handler.doRcpt(session,null, mailAddress).getResult(); - assertEquals("Reject", result,HookReturnCode.deny()); + assertThat(HookReturnCode.deny()).describedAs("Reject").isEqualTo(result); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandlerTest.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandlerTest.java index 1eb76c8..ead4197 100644 --- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandlerTest.java +++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandlerTest.java @@ -19,7 +19,7 @@ package org.apache.james.protocols.smtp.core.fastfail; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Fail.fail; import java.net.InetSocketAddress; @@ -65,17 +65,17 @@ public class SpamTrapHandlerTest { HookReturnCode result = handler.doRcpt(setUpSMTPSession(ip),null,new MailAddress(SPAM_TRAP_RECIP1)).getResult(); - assertEquals("Blocked on first connect",HookReturnCode.deny(),result); + assertThat(result).describedAs("Blocked on first connect").isEqualTo(HookReturnCode.deny()); result = handler.doRcpt(setUpSMTPSession(ip),null,new MailAddress(RECIP1)).getResult(); - assertEquals("Blocked on second connect", HookReturnCode.deny(),result); + assertThat(result).describedAs("Blocked on second connect").isEqualTo(HookReturnCode.deny()); result = handler.doRcpt(setUpSMTPSession(ip2),null,new MailAddress(RECIP1)).getResult(); - assertEquals("Not Blocked", HookReturnCode.declined(),result); + assertThat(result).describedAs("Not Blocked").isEqualTo(HookReturnCode.declined()); try { // Wait for the blockTime to exceed @@ -86,6 +86,6 @@ public class SpamTrapHandlerTest { result = handler.doRcpt(setUpSMTPSession(ip),null,new MailAddress(RECIP1)).getResult(); - assertEquals("Not blocked. BlockTime exceeded", HookReturnCode.declined(),result); + assertThat(result).describedAs("Not blocked. BlockTime exceeded").isEqualTo(HookReturnCode.declined()); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java index 1ce6c76..82d8d4b 100644 --- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java +++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java @@ -19,7 +19,7 @@ package org.apache.james.protocols.smtp.core.fastfail; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.util.HashMap; import java.util.Map; @@ -108,7 +108,7 @@ public class ValidSenderDomainHandlerTest { ValidSenderDomainHandler handler = createHandler(); HookReturnCode response = handler.doMail(setupMockedSession(null),null).getResult(); - assertEquals("Not blocked cause its a nullsender", response, HookReturnCode.declined()); + assertThat(HookReturnCode.declined()).describedAs("Not blocked cause its a nullsender").isEqualTo(response); } @Test @@ -117,6 +117,6 @@ public class ValidSenderDomainHandlerTest { SMTPSession session = setupMockedSession(new MailAddress("invalid@invalid")); HookReturnCode response = handler.doMail(session,(MailAddress) session.getAttachment(SMTPSession.SENDER, State.Transaction)).getResult(); - assertEquals("Blocked cause we use reject action", response, HookReturnCode.deny()); + assertThat(HookReturnCode.deny()).describedAs("Blocked cause we use reject action").isEqualTo(response); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/container/core/src/test/java/org/apache/james/server/core/MailHeadersTest.java ---------------------------------------------------------------------- diff --git a/server/container/core/src/test/java/org/apache/james/server/core/MailHeadersTest.java b/server/container/core/src/test/java/org/apache/james/server/core/MailHeadersTest.java index ed74672..f3bf537 100644 --- a/server/container/core/src/test/java/org/apache/james/server/core/MailHeadersTest.java +++ b/server/container/core/src/test/java/org/apache/james/server/core/MailHeadersTest.java @@ -18,7 +18,7 @@ ****************************************************************/ package org.apache.james.server.core; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.io.ByteArrayInputStream; import java.util.Enumeration; @@ -38,8 +38,8 @@ public class MailHeadersTest { header.setHeader(RFC2822Headers.FROM, "<[email protected]>"); Enumeration<String> h = header.getAllHeaderLines(); - assertEquals(h.nextElement(), "Return-Path: <test@test>"); - assertEquals(h.nextElement(), "From: <[email protected]>"); - assertEquals(h.nextElement(), "Subject: testsubject"); + assertThat("Return-Path: <test@test>").isEqualTo(h.nextElement()); + assertThat("From: <[email protected]>").isEqualTo(h.nextElement()); + assertThat("Subject: testsubject").isEqualTo(h.nextElement()); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageCopyOnWriteProxyTest.java ---------------------------------------------------------------------- diff --git a/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageCopyOnWriteProxyTest.java b/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageCopyOnWriteProxyTest.java index b95ec07..1bf1566 100644 --- a/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageCopyOnWriteProxyTest.java +++ b/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageCopyOnWriteProxyTest.java @@ -19,9 +19,8 @@ package org.apache.james.server.core; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; import static org.assertj.core.api.Fail.fail; +import static org.junit.Assert.assertNotSame; import java.util.ArrayList; @@ -95,8 +94,8 @@ public class MimeMessageCopyOnWriteProxyTest extends MimeMessageFromStreamTest { m2.getMessage().setSubject("new Subject"); assertThat(!isSameMimeMessage(m2.getMessage(), mail.getMessage())).isTrue(); // check that the subjects are correct on both mails! - assertEquals(m2.getMessage().getSubject(), "new Subject"); - assertEquals(mail.getMessage().getSubject(), "foo"); + assertThat("new Subject").isEqualTo(m2.getMessage().getSubject()); + assertThat("foo").isEqualTo(mail.getMessage().getSubject()); // cloning again the messages Mail m2clone = m2.duplicate("clone2"); assertThat(isSameMimeMessage(m2clone.getMessage(), m2.getMessage())).isTrue(); @@ -108,7 +107,7 @@ public class MimeMessageCopyOnWriteProxyTest extends MimeMessageFromStreamTest { // dispose m2 and check that the clone has still a valid message and it // is the same! LifecycleUtil.dispose(m2); - assertEquals(mm3, getWrappedMessage(m2clone.getMessage())); + assertThat(getWrappedMessage(m2clone.getMessage())).isEqualTo(mm3); // change the message that should be not referenced by m2 that has // been disposed, so it should not clone it! m2clone.getMessage().setSubject("new Subject 2"); http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageTest.java ---------------------------------------------------------------------- diff --git a/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageTest.java b/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageTest.java index 971c817..36ee6ab 100644 --- a/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageTest.java +++ b/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageTest.java @@ -21,7 +21,6 @@ package org.apache.james.server.core; import static org.apache.mailet.base.RFC2822Headers.RETURN_PATH; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Fail.fail; -import static org.junit.Assert.assertEquals; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -89,7 +88,7 @@ public class MimeMessageTest { @Test public void testSimpleMessage() throws Exception { MimeMessage m = getSimpleMessage(); - assertEquals(getSimpleMessageCleanedSource(), getCleanedMessageSource(m)); + assertThat(getCleanedMessageSource(m)).isEqualTo(getSimpleMessageCleanedSource()); LifecycleUtil.dispose(m); } @@ -199,7 +198,7 @@ public class MimeMessageTest { // .setHeader(RFC2822Headers.CONTENT_TYPE,contentType); mm.saveChanges(); - assertEquals(getMultipartMessageExpected1(), getCleanedMessageSource(mm)); + assertThat(getCleanedMessageSource(mm)).isEqualTo(getMultipartMessageExpected1()); MimeMultipart content2 = (MimeMultipart) mm.getContent(); content2.addBodyPart(new MimeBodyPart(new InternetHeaders(new ByteArrayInputStream( @@ -207,14 +206,14 @@ public class MimeMessageTest { mm.setContent(content2, mm.getContentType()); mm.saveChanges(); - assertEquals(getMultipartMessageExpected2(), getCleanedMessageSource(mm)); + assertThat(getCleanedMessageSource(mm)).isEqualTo(getMultipartMessageExpected2()); mm.setContent("mynewcoòà ùntentâ¬Ã !", "text/plain; charset=cp1252"); mm.setHeader(RFC2822Headers.CONTENT_TYPE, "binary/octet-stream"); // mm.setHeader("Content-Transfer-Encoding","8bit"); mm.saveChanges(); - assertEquals(getMultipartMessageExpected3(), getCleanedMessageSource(mm)); + assertThat(getCleanedMessageSource(mm)).isEqualTo(getMultipartMessageExpected3()); LifecycleUtil.dispose(mm); @@ -369,7 +368,7 @@ public class MimeMessageTest { mm.setHeader("X-Test", "foo"); mm.saveChanges(); - assertEquals(getSimpleMessageCleanedSourceHeaderExpected(), getCleanedMessageSource(mm)); + assertThat(getCleanedMessageSource(mm)).isEqualTo(getSimpleMessageCleanedSourceHeaderExpected()); LifecycleUtil.dispose(mm); LifecycleUtil.dispose(mmorig); @@ -388,7 +387,7 @@ public class MimeMessageTest { message.setHeader(RFC2822Headers.RETURN_PATH, "<[email protected]>"); Enumeration<String> h = message.getAllHeaderLines(); - assertEquals(h.nextElement(), "Return-Path: <[email protected]>"); + assertThat("Return-Path: <[email protected]>").isEqualTo(h.nextElement()); LifecycleUtil.dispose(message); } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageWrapperTest.java ---------------------------------------------------------------------- diff --git a/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageWrapperTest.java b/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageWrapperTest.java index 92ab6c5..426aee7 100644 --- a/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageWrapperTest.java +++ b/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageWrapperTest.java @@ -19,9 +19,6 @@ package org.apache.james.server.core; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; @@ -112,9 +109,9 @@ public class MimeMessageWrapperTest extends MimeMessageFromStreamTest { @Test public void testDeferredMessageLoading() throws MessagingException, IOException { - assertEquals("foo", mw.getSubject()); + assertThat(mw.getSubject()).isEqualTo("foo"); assertThat(mw.messageParsed()).isFalse(); - assertEquals("bar\r\n", mw.getContent()); + assertThat(mw.getContent()).isEqualTo("bar\r\n"); assertThat(mw.messageParsed()).isTrue(); assertThat(mw.isModified()).isFalse(); } @@ -163,21 +160,21 @@ public class MimeMessageWrapperTest extends MimeMessageFromStreamTest { res.append(line).append("\r\n"); } r.close(); - assertEquals(body, res.toString()); + assertThat(res.toString()).isEqualTo(body); } @Test public void testAddHeaderAndSave() throws Exception { mw.addHeader("X-Test", "X-Value"); - assertEquals("X-Value", mw.getHeader("X-Test")[0]); + assertThat(mw.getHeader("X-Test")[0]).isEqualTo("X-Value"); mw.saveChanges(); ByteArrayOutputStream rawMessage = new ByteArrayOutputStream(); mw.writeTo(rawMessage); - assertEquals("X-Value", mw.getHeader("X-Test")[0]); + assertThat(mw.getHeader("X-Test")[0]).isEqualTo("X-Value"); String res = rawMessage.toString(); @@ -190,10 +187,10 @@ public class MimeMessageWrapperTest extends MimeMessageFromStreamTest { MimeMessage message = getMessageWithBadReturnPath(); message.setHeader(RFC2822Headers.RETURN_PATH, "<[email protected]>"); Enumeration<String> e = message.getMatchingHeaderLines(new String[]{"Return-Path"}); - assertEquals("Return-Path: <[email protected]>", e.nextElement()); + assertThat(e.nextElement()).isEqualTo("Return-Path: <[email protected]>"); assertThat(e.hasMoreElements()).isFalse(); Enumeration<String> h = message.getAllHeaderLines(); - assertEquals("Return-Path: <[email protected]>", h.nextElement()); + assertThat(h.nextElement()).isEqualTo("Return-Path: <[email protected]>"); assertThat(h.nextElement().startsWith("Return-Path:")).isFalse(); LifecycleUtil.dispose(message); } @@ -204,11 +201,11 @@ public class MimeMessageWrapperTest extends MimeMessageFromStreamTest { message.addHeader(RFC2822Headers.RETURN_PATH, "<[email protected]>"); // test that we have now 2 return-paths Enumeration<String> e = message.getMatchingHeaderLines(new String[]{"Return-Path"}); - assertEquals("Return-Path: <[email protected]>", e.nextElement()); - assertEquals("Return-Path: <[email protected]>", e.nextElement()); + assertThat(e.nextElement()).isEqualTo("Return-Path: <[email protected]>"); + assertThat(e.nextElement()).isEqualTo("Return-Path: <[email protected]>"); // test that return-path is the first line Enumeration<String> h = message.getAllHeaderLines(); - assertEquals("Return-Path: <[email protected]>", h.nextElement()); + assertThat(h.nextElement()).isEqualTo("Return-Path: <[email protected]>"); LifecycleUtil.dispose(message); } @@ -219,7 +216,7 @@ public class MimeMessageWrapperTest extends MimeMessageFromStreamTest { public void testMessageStreamWithUpatedHeaders() throws MessagingException, IOException { mw.addHeader("X-Test", "X-Value"); - assertEquals("X-Value", mw.getHeader("X-Test")[0]); + assertThat(mw.getHeader("X-Test")[0]).isEqualTo("X-Value"); mw.saveChanges(); @@ -238,7 +235,7 @@ public class MimeMessageWrapperTest extends MimeMessageFromStreamTest { public void testMessageStreamWithUpatedContent() throws MessagingException, IOException { String newContent = "This is the new message content!"; mw.setText(newContent); - assertEquals(newContent, mw.getContent()); + assertThat(mw.getContent()).isEqualTo(newContent); mw.saveChanges(); @@ -252,20 +249,20 @@ public class MimeMessageWrapperTest extends MimeMessageFromStreamTest { @Test public void testSize() throws MessagingException { - assertEquals(body.length(), mw.getSize()); + assertThat(mw.getSize()).isEqualTo(body.length()); } @Test public void testSizeModifiedHeaders() throws MessagingException { mw.addHeader("whatever", "test"); - assertEquals(body.length(), mw.getSize()); + assertThat(mw.getSize()).isEqualTo(body.length()); } @Test public void testSizeModifiedBodyWithoutSave() throws MessagingException { String newBody = "This is the new body of the message"; mw.setText(newBody); - assertEquals(body.length(), mw.getSize()); + assertThat(mw.getSize()).isEqualTo(body.length()); } @Test @@ -273,7 +270,7 @@ public class MimeMessageWrapperTest extends MimeMessageFromStreamTest { String newBody = "This is the new body of the message"; mw.setText(newBody); mw.saveChanges(); - assertEquals(body.length(), mw.getSize()); + assertThat(mw.getSize()).isEqualTo(body.length()); } @Test @@ -283,7 +280,7 @@ public class MimeMessageWrapperTest extends MimeMessageFromStreamTest { InputStream stream = ClassLoader.getSystemResourceAsStream("JAMES-1593.eml"); MimeMessage message = new MimeMessage(session, stream); MimeMessageWrapper wrapper = new MimeMessageWrapper(message); - assertEquals("\"base64\"", wrapper.getEncoding()); + assertThat(wrapper.getEncoding()).isEqualTo("\"base64\""); } @Test --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
