http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/AbstractTestForStatusResponseFactory.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/AbstractTestForStatusResponseFactory.java b/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/AbstractTestForStatusResponseFactory.java index c216469..67f47e2 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/AbstractTestForStatusResponseFactory.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/AbstractTestForStatusResponseFactory.java @@ -20,7 +20,6 @@ package org.apache.james.imap.api.message.response; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import org.apache.james.imap.api.ImapCommand; import org.apache.james.imap.api.display.HumanReadableText; @@ -53,71 +52,71 @@ public abstract class AbstractTestForStatusResponseFactory { public void testTaggedOk() { StatusResponse response = factory.taggedOk(TAG, command, KEY); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.OK, response.getServerResponseType()); - assertEquals(TAG, response.getTag()); - assertEquals(KEY, response.getTextKey()); - assertEquals(command, response.getCommand()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.OK); + assertThat(response.getTag()).isEqualTo(TAG); + assertThat(response.getTextKey()).isEqualTo(KEY); + assertThat(response.getCommand()).isEqualTo(command); assertThat(response.getResponseCode()).isNull(); response = factory.taggedOk(TAG, command, KEY, CODE); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.OK, response.getServerResponseType()); - assertEquals(TAG, response.getTag()); - assertEquals(KEY, response.getTextKey()); - assertEquals(CODE, response.getResponseCode()); - assertEquals(command, response.getCommand()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.OK); + assertThat(response.getTag()).isEqualTo(TAG); + assertThat(response.getTextKey()).isEqualTo(KEY); + assertThat(response.getResponseCode()).isEqualTo(CODE); + assertThat(response.getCommand()).isEqualTo(command); } @Test public void testTaggedNo() { StatusResponse response = factory.taggedNo(TAG, command, KEY); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.NO, response.getServerResponseType()); - assertEquals(TAG, response.getTag()); - assertEquals(KEY, response.getTextKey()); - assertEquals(command, response.getCommand()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.NO); + assertThat(response.getTag()).isEqualTo(TAG); + assertThat(response.getTextKey()).isEqualTo(KEY); + assertThat(response.getCommand()).isEqualTo(command); assertThat(response.getResponseCode()).isNull(); response = factory.taggedNo(TAG, command, KEY, CODE); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.NO, response.getServerResponseType()); - assertEquals(TAG, response.getTag()); - assertEquals(KEY, response.getTextKey()); - assertEquals(CODE, response.getResponseCode()); - assertEquals(command, response.getCommand()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.NO); + assertThat(response.getTag()).isEqualTo(TAG); + assertThat(response.getTextKey()).isEqualTo(KEY); + assertThat(response.getResponseCode()).isEqualTo(CODE); + assertThat(response.getCommand()).isEqualTo(command); } @Test public void testTaggedBad() { StatusResponse response = factory.taggedBad(TAG, command, KEY); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.BAD, response.getServerResponseType()); - assertEquals(TAG, response.getTag()); - assertEquals(KEY, response.getTextKey()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.BAD); + assertThat(response.getTag()).isEqualTo(TAG); + assertThat(response.getTextKey()).isEqualTo(KEY); assertThat(response.getResponseCode()).isNull(); - assertEquals(command, response.getCommand()); + assertThat(response.getCommand()).isEqualTo(command); response = factory.taggedBad(TAG, command, KEY, CODE); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.BAD, response.getServerResponseType()); - assertEquals(TAG, response.getTag()); - assertEquals(KEY, response.getTextKey()); - assertEquals(CODE, response.getResponseCode()); - assertEquals(command, response.getCommand()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.BAD); + assertThat(response.getTag()).isEqualTo(TAG); + assertThat(response.getTextKey()).isEqualTo(KEY); + assertThat(response.getResponseCode()).isEqualTo(CODE); + assertThat(response.getCommand()).isEqualTo(command); } @Test public void testUntaggedOk() { StatusResponse response = factory.untaggedOk(KEY); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.OK, response.getServerResponseType()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.OK); assertThat(response.getTag()).isNull(); - assertEquals(KEY, response.getTextKey()); + assertThat(response.getTextKey()).isEqualTo(KEY); assertThat(response.getResponseCode()).isNull(); assertThat(response.getCommand()).isNull(); response = factory.untaggedOk(KEY, CODE); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.OK, response.getServerResponseType()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.OK); assertThat(response.getTag()).isNull(); - assertEquals(KEY, response.getTextKey()); - assertEquals(CODE, response.getResponseCode()); + assertThat(response.getTextKey()).isEqualTo(KEY); + assertThat(response.getResponseCode()).isEqualTo(CODE); assertThat(response.getCommand()).isNull(); } @@ -126,17 +125,17 @@ public abstract class AbstractTestForStatusResponseFactory { public void testUntaggedNo() { StatusResponse response = factory.untaggedNo(KEY); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.NO, response.getServerResponseType()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.NO); assertThat(response.getTag()).isNull(); - assertEquals(KEY, response.getTextKey()); + assertThat(response.getTextKey()).isEqualTo(KEY); assertThat(response.getResponseCode()).isNull(); assertThat(response.getCommand()).isNull(); response = factory.untaggedNo(KEY, CODE); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.NO, response.getServerResponseType()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.NO); assertThat(response.getTag()).isNull(); - assertEquals(KEY, response.getTextKey()); - assertEquals(CODE, response.getResponseCode()); + assertThat(response.getTextKey()).isEqualTo(KEY); + assertThat(response.getResponseCode()).isEqualTo(CODE); assertThat(response.getCommand()).isNull(); } @@ -144,17 +143,17 @@ public abstract class AbstractTestForStatusResponseFactory { public void testUntaggedBad() { StatusResponse response = factory.untaggedBad(KEY); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.BAD, response.getServerResponseType()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.BAD); assertThat(response.getTag()).isNull(); - assertEquals(KEY, response.getTextKey()); + assertThat(response.getTextKey()).isEqualTo(KEY); assertThat(response.getResponseCode()).isNull(); assertThat(response.getCommand()).isNull(); response = factory.untaggedBad(KEY, CODE); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.BAD, response.getServerResponseType()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.BAD); assertThat(response.getTag()).isNull(); - assertEquals(KEY, response.getTextKey()); - assertEquals(CODE, response.getResponseCode()); + assertThat(response.getTextKey()).isEqualTo(KEY); + assertThat(response.getResponseCode()).isEqualTo(CODE); assertThat(response.getCommand()).isNull(); } @@ -162,19 +161,19 @@ public abstract class AbstractTestForStatusResponseFactory { public void testPreauth() { StatusResponse response = factory.preauth(KEY); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.PREAUTH, response - .getServerResponseType()); + assertThat(response + .getServerResponseType()).isEqualTo(StatusResponse.Type.PREAUTH); assertThat(response.getTag()).isNull(); - assertEquals(KEY, response.getTextKey()); + assertThat(response.getTextKey()).isEqualTo(KEY); assertThat(response.getResponseCode()).isNull(); assertThat(response.getCommand()).isNull(); response = factory.preauth(KEY, CODE); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.PREAUTH, response - .getServerResponseType()); + assertThat(response + .getServerResponseType()).isEqualTo(StatusResponse.Type.PREAUTH); assertThat(response.getTag()).isNull(); - assertEquals(KEY, response.getTextKey()); - assertEquals(CODE, response.getResponseCode()); + assertThat(response.getTextKey()).isEqualTo(KEY); + assertThat(response.getResponseCode()).isEqualTo(CODE); assertThat(response.getCommand()).isNull(); } @@ -182,17 +181,17 @@ public abstract class AbstractTestForStatusResponseFactory { public void testBye() { StatusResponse response = factory.bye(KEY); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.BYE, response.getServerResponseType()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.BYE); assertThat(response.getTag()).isNull(); - assertEquals(KEY, response.getTextKey()); + assertThat(response.getTextKey()).isEqualTo(KEY); assertThat(response.getResponseCode()).isNull(); assertThat(response.getCommand()).isNull(); response = factory.bye(KEY, CODE); assertThat(response).isNotNull(); - assertEquals(StatusResponse.Type.BYE, response.getServerResponseType()); + assertThat(response.getServerResponseType()).isEqualTo(StatusResponse.Type.BYE); assertThat(response.getTag()).isNull(); - assertEquals(KEY, response.getTextKey()); - assertEquals(CODE, response.getResponseCode()); + assertThat(response.getTextKey()).isEqualTo(KEY); + assertThat(response.getResponseCode()).isEqualTo(CODE); assertThat(response.getCommand()).isNull(); }
http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/StatusResponseTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/StatusResponseTest.java b/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/StatusResponseTest.java index 99d709a..e593ea0 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/StatusResponseTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/StatusResponseTest.java @@ -20,7 +20,6 @@ package org.apache.james.imap.api.message.response; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -29,12 +28,10 @@ public class StatusResponseTest { @Test public void testResponseCodeExtension() { - assertEquals("Preserve names beginning with X", "XEXTENSION", - StatusResponse.ResponseCode.createExtension("XEXTENSION") - .getCode()); - assertEquals("Correct other names", "XEXTENSION", - StatusResponse.ResponseCode.createExtension("EXTENSION") - .getCode()); + assertThat(StatusResponse.ResponseCode.createExtension("XEXTENSION") + .getCode()).describedAs("Preserve names beginning with X").isEqualTo("XEXTENSION"); + assertThat(StatusResponse.ResponseCode.createExtension("EXTENSION") + .getCode()).describedAs("Correct other names").isEqualTo("XEXTENSION"); } @Test http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java index 118516b..569f5ba 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java @@ -20,7 +20,6 @@ package org.apache.james.imap.decode; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Fail.fail; import java.util.Collection; @@ -42,77 +41,77 @@ public class FetchPartPathDecoderTest { @Test public void testShouldDetectText() throws Exception { - assertEquals(FetchPartPathDecoder.TEXT, decoder.decode("TEXT")); - assertEquals(FetchPartPathDecoder.TEXT, decoder.decode("3.TEXT")); - assertEquals(FetchPartPathDecoder.TEXT, decoder.decode("3.1.TEXT")); - assertEquals(FetchPartPathDecoder.TEXT, decoder - .decode("3.2.5.7.8.TEXT")); + assertThat(decoder.decode("TEXT")).isEqualTo(FetchPartPathDecoder.TEXT); + assertThat(decoder.decode("3.TEXT")).isEqualTo(FetchPartPathDecoder.TEXT); + assertThat(decoder.decode("3.1.TEXT")).isEqualTo(FetchPartPathDecoder.TEXT); + assertThat(decoder + .decode("3.2.5.7.8.TEXT")).isEqualTo(FetchPartPathDecoder.TEXT); } @Test public void testShouldDetectHeader() throws Exception { - assertEquals(FetchPartPathDecoder.HEADER, decoder.decode("HEADER")); - assertEquals(FetchPartPathDecoder.HEADER, decoder.decode("4.HEADER")); - assertEquals(FetchPartPathDecoder.HEADER, decoder.decode("10.1.HEADER")); - assertEquals(FetchPartPathDecoder.HEADER, decoder - .decode("8.3.5.11.HEADER")); + assertThat(decoder.decode("HEADER")).isEqualTo(FetchPartPathDecoder.HEADER); + assertThat(decoder.decode("4.HEADER")).isEqualTo(FetchPartPathDecoder.HEADER); + assertThat(decoder.decode("10.1.HEADER")).isEqualTo(FetchPartPathDecoder.HEADER); + assertThat(decoder + .decode("8.3.5.11.HEADER")).isEqualTo(FetchPartPathDecoder.HEADER); } @Test public void testShouldDetectHeaderFields() throws Exception { - assertEquals(FetchPartPathDecoder.HEADER_FIELDS, decoder - .decode("HEADER.FIELDS ()")); - assertEquals(FetchPartPathDecoder.HEADER_FIELDS, decoder - .decode("4.HEADER.FIELDS ()")); - assertEquals(FetchPartPathDecoder.HEADER_FIELDS, decoder - .decode("10.1.HEADER.FIELDS ()")); - assertEquals(FetchPartPathDecoder.HEADER_FIELDS, decoder - .decode("8.3.5.11.HEADER.FIELDS ()")); + assertThat(decoder + .decode("HEADER.FIELDS ()")).isEqualTo(FetchPartPathDecoder.HEADER_FIELDS); + assertThat(decoder + .decode("4.HEADER.FIELDS ()")).isEqualTo(FetchPartPathDecoder.HEADER_FIELDS); + assertThat(decoder + .decode("10.1.HEADER.FIELDS ()")).isEqualTo(FetchPartPathDecoder.HEADER_FIELDS); + assertThat(decoder + .decode("8.3.5.11.HEADER.FIELDS ()")).isEqualTo(FetchPartPathDecoder.HEADER_FIELDS); } @Test public void testShouldDetectHeaderFieldsNot() throws Exception { - assertEquals(FetchPartPathDecoder.HEADER_NOT_FIELDS, decoder - .decode("HEADER.FIELDS.NOT ()")); - assertEquals(FetchPartPathDecoder.HEADER_NOT_FIELDS, decoder - .decode("4.HEADER.FIELDS.NOT ()")); - assertEquals(FetchPartPathDecoder.HEADER_NOT_FIELDS, decoder - .decode("10.1.HEADER.FIELDS.NOT ()")); - assertEquals(FetchPartPathDecoder.HEADER_NOT_FIELDS, decoder - .decode("8.3.5.11.HEADER.FIELDS.NOT ()")); + assertThat(decoder + .decode("HEADER.FIELDS.NOT ()")).isEqualTo(FetchPartPathDecoder.HEADER_NOT_FIELDS); + assertThat(decoder + .decode("4.HEADER.FIELDS.NOT ()")).isEqualTo(FetchPartPathDecoder.HEADER_NOT_FIELDS); + assertThat(decoder + .decode("10.1.HEADER.FIELDS.NOT ()")).isEqualTo(FetchPartPathDecoder.HEADER_NOT_FIELDS); + assertThat(decoder + .decode("8.3.5.11.HEADER.FIELDS.NOT ()")).isEqualTo(FetchPartPathDecoder.HEADER_NOT_FIELDS); } @Test public void testShouldDetectMime() throws Exception { - assertEquals(FetchPartPathDecoder.MIME, decoder.decode("MIME")); - assertEquals(FetchPartPathDecoder.MIME, decoder.decode("6.MIME")); - assertEquals(FetchPartPathDecoder.MIME, decoder.decode("2.88.MIME")); - assertEquals(FetchPartPathDecoder.MIME, decoder - .decode("32.3.15.11.MIME")); + assertThat(decoder.decode("MIME")).isEqualTo(FetchPartPathDecoder.MIME); + assertThat(decoder.decode("6.MIME")).isEqualTo(FetchPartPathDecoder.MIME); + assertThat(decoder.decode("2.88.MIME")).isEqualTo(FetchPartPathDecoder.MIME); + assertThat(decoder + .decode("32.3.15.11.MIME")).isEqualTo(FetchPartPathDecoder.MIME); } @Test public void testShouldDetectContent() throws Exception { - assertEquals(FetchPartPathDecoder.CONTENT, decoder.decode("34")); - assertEquals(FetchPartPathDecoder.CONTENT, decoder.decode("6")); - assertEquals(FetchPartPathDecoder.CONTENT, decoder.decode("9.88")); - assertEquals(FetchPartPathDecoder.CONTENT, decoder.decode("17.3.15.11")); + assertThat(decoder.decode("34")).isEqualTo(FetchPartPathDecoder.CONTENT); + assertThat(decoder.decode("6")).isEqualTo(FetchPartPathDecoder.CONTENT); + assertThat(decoder.decode("9.88")).isEqualTo(FetchPartPathDecoder.CONTENT); + assertThat(decoder.decode("17.3.15.11")).isEqualTo(FetchPartPathDecoder.CONTENT); } @Test public void testShouldIgnoreCase() throws Exception { - assertEquals(FetchPartPathDecoder.MIME, decoder.decode("6.MIME")); - assertEquals(FetchPartPathDecoder.MIME, decoder.decode("6.mime")); - assertEquals(FetchPartPathDecoder.MIME, decoder.decode("6.miME")); - assertEquals(FetchPartPathDecoder.MIME, decoder.decode("6.MIme")); - assertEquals(FetchPartPathDecoder.HEADER, decoder.decode("6.HEADER")); - assertEquals(FetchPartPathDecoder.HEADER, decoder.decode("6.header")); - assertEquals(FetchPartPathDecoder.HEADER, decoder.decode("6.HEadER")); - assertEquals(FetchPartPathDecoder.HEADER, decoder.decode("6.heADEr")); - assertEquals(FetchPartPathDecoder.TEXT, decoder.decode("6.TEXT")); - assertEquals(FetchPartPathDecoder.TEXT, decoder.decode("6.text")); - assertEquals(FetchPartPathDecoder.TEXT, decoder.decode("6.TExt")); - assertEquals(FetchPartPathDecoder.TEXT, decoder.decode("6.teXT")); + assertThat(decoder.decode("6.MIME")).isEqualTo(FetchPartPathDecoder.MIME); + assertThat(decoder.decode("6.mime")).isEqualTo(FetchPartPathDecoder.MIME); + assertThat(decoder.decode("6.miME")).isEqualTo(FetchPartPathDecoder.MIME); + assertThat(decoder.decode("6.MIme")).isEqualTo(FetchPartPathDecoder.MIME); + assertThat(decoder.decode("6.HEADER")).isEqualTo(FetchPartPathDecoder.HEADER); + assertThat(decoder.decode("6.header")).isEqualTo(FetchPartPathDecoder.HEADER); + assertThat(decoder.decode("6.HEadER")).isEqualTo(FetchPartPathDecoder.HEADER); + assertThat(decoder.decode("6.heADEr")).isEqualTo(FetchPartPathDecoder.HEADER); + assertThat(decoder.decode("6.TEXT")).isEqualTo(FetchPartPathDecoder.TEXT); + assertThat(decoder.decode("6.text")).isEqualTo(FetchPartPathDecoder.TEXT); + assertThat(decoder.decode("6.TExt")).isEqualTo(FetchPartPathDecoder.TEXT); + assertThat(decoder.decode("6.teXT")).isEqualTo(FetchPartPathDecoder.TEXT); } @Test @@ -194,7 +193,7 @@ public class FetchPartPathDecoderTest { assertThat(results).isNotNull(); Iterator<String> it = results.iterator(); for (String name : names) { - assertEquals(name, it.next()); + assertThat(it.next()).isEqualTo(name); } } @@ -221,9 +220,9 @@ public class FetchPartPathDecoderTest { decoder.decode(encoded); final int[] path = decoder.getPath(); assertThat(path).isNotNull(); - assertEquals(expected.length, path.length); + assertThat(path.length).isEqualTo(expected.length); for (int i = 0; i < expected.length; i++) { - assertEquals(expected[i], path[i]); + assertThat(path[i]).isEqualTo(expected[i]); } } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/main/IdRangeParseTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/main/IdRangeParseTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/main/IdRangeParseTest.java index 2f35eb5..6f302b6 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/main/IdRangeParseTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/main/IdRangeParseTest.java @@ -18,8 +18,8 @@ ****************************************************************/ package org.apache.james.imap.decode.main; +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; @@ -44,14 +44,14 @@ public class IdRangeParseTest { int val2 = 3; IdRange[] ranges1 = ranges(rangeAsString(val1, val2)); - assertEquals(1, ranges1.length); - assertEquals(val1, ranges1[0].getLowVal()); - assertEquals(val2, ranges1[0].getHighVal()); + assertThat(ranges1.length).isEqualTo(1); + assertThat(ranges1[0].getLowVal()).isEqualTo(val1); + assertThat(ranges1[0].getHighVal()).isEqualTo(val2); IdRange[] ranges2 = ranges(rangeAsString(val2, val1)); - assertEquals(1, ranges2.length); - assertEquals(val1, ranges2[0].getLowVal()); - assertEquals(val2, ranges2[0].getHighVal()); + assertThat(ranges2.length).isEqualTo(1); + assertThat(ranges2[0].getLowVal()).isEqualTo(val1); + assertThat(ranges2[0].getHighVal()).isEqualTo(val2); } @Test @@ -74,9 +74,9 @@ public class IdRangeParseTest { } IdRange[] ranges2 = ranges(rangeAsString(ImapConstants.MIN_NZ_NUMBER, ImapConstants.MAX_NZ_NUMBER)); - assertEquals(1, ranges2.length); - assertEquals(ImapConstants.MIN_NZ_NUMBER, ranges2[0].getLowVal()); - assertEquals(ImapConstants.MAX_NZ_NUMBER, ranges2[0].getHighVal()); + assertThat(ranges2.length).isEqualTo(1); + assertThat(ranges2[0].getLowVal()).isEqualTo(ImapConstants.MIN_NZ_NUMBER); + assertThat(ranges2[0].getHighVal()).isEqualTo(ImapConstants.MAX_NZ_NUMBER); } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaParserTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaParserTest.java index 7f24aa6..409e4ac 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaParserTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaParserTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.decode.parser; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -44,6 +44,6 @@ public class GetQuotaParserTest { ImapRequestStreamLineReader lineReader = new ImapRequestStreamLineReader(inputStream, null); GetQuotaRequest request = (GetQuotaRequest) parser.decode(command, lineReader, "A003", null); GetQuotaRequest expected = new GetQuotaRequest("A003", command, "quotaRoot"); - assertEquals(expected.getQuotaRoot(), request.getQuotaRoot()); + assertThat(request.getQuotaRoot()).isEqualTo(expected.getQuotaRoot()); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaRootParserTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaRootParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaRootParserTest.java index 53ea9eb..90a07aa 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaRootParserTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaRootParserTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.decode.parser; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -44,7 +44,7 @@ public class GetQuotaRootParserTest { ImapRequestStreamLineReader lineReader = new ImapRequestStreamLineReader(inputStream, null); GetQuotaRootRequest request = (GetQuotaRootRequest) parser.decode(command, lineReader, "A003", null); GetQuotaRootRequest expected = new GetQuotaRootRequest("A003", command, "INBOX"); - assertEquals(expected.getMailboxName(), request.getMailboxName()); + assertThat(request.getMailboxName()).isEqualTo(expected.getMailboxName()); } @Test @@ -56,7 +56,7 @@ public class GetQuotaRootParserTest { ImapRequestStreamLineReader lineReader = new ImapRequestStreamLineReader(inputStream, null); GetQuotaRootRequest request = (GetQuotaRootRequest) parser.decode(command, lineReader, "A003", null); GetQuotaRootRequest expected = new GetQuotaRootRequest("A003", command, "INBOX"); - assertEquals(expected.getMailboxName(), request.getMailboxName()); + assertThat(request.getMailboxName()).isEqualTo(expected.getMailboxName()); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java index 2842228..e14788e 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.decode.parser; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -190,7 +190,7 @@ public class SearchCommandParserAndParenthesesTest { new ByteArrayOutputStream()); final SearchKey result = parser.decode(null, reader); - assertEquals(in.key, result); + assertThat(result).isEqualTo(in.key); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserCharsetTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserCharsetTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserCharsetTest.java index bc6d203..c866b23 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserCharsetTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserCharsetTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.decode.parser; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.same; import static org.mockito.Mockito.mock; @@ -170,7 +170,7 @@ public class SearchCommandParserCharsetTest { term), BYTES_UTF8_NON_ASCII_SEARCH_TERM)), new ByteArrayOutputStream()); final SearchKey searchKey = parser.searchKey(null, reader, null, true); - assertEquals(key, searchKey); + assertThat(searchKey).isEqualTo(key); } private void checkValid(String input, SearchKey key, boolean isFirst, @@ -180,7 +180,7 @@ public class SearchCommandParserCharsetTest { new ByteArrayOutputStream()); final SearchKey searchKey = parser.searchKey(null, reader, null, isFirst); - assertEquals(key, searchKey); + assertThat(searchKey).isEqualTo(key); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserNotTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserNotTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserNotTest.java index bf9a2e3..86ec857 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserNotTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserNotTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.decode.parser; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -117,9 +117,9 @@ public class SearchCommandParserNotTest { new ByteArrayOutputStream()); SearchKey key = parser.searchKey(null, reader, null, false); List<SearchKey> keys = key.getKeys().get(0).getKeys(); - assertEquals(2, keys.size()); - assertEquals("bar", keys.get(0).getValue()); - assertEquals("foo", keys.get(1).getValue()); + assertThat(keys.size()).isEqualTo(2); + assertThat(keys.get(0).getValue()).isEqualTo("bar"); + assertThat(keys.get(1).getValue()).isEqualTo("foo"); } private void checkValid(String input, SearchKey key) throws Exception { @@ -127,6 +127,6 @@ public class SearchCommandParserNotTest { new ByteArrayInputStream(input.getBytes("US-ASCII")), new ByteArrayOutputStream()); - assertEquals(key, parser.searchKey(null, reader, null, false)); + assertThat(parser.searchKey(null, reader, null, false)).isEqualTo(key); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserOrTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserOrTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserOrTest.java index ddd93ea..b5bb13f 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserOrTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserOrTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.decode.parser; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -175,7 +175,7 @@ public class SearchCommandParserOrTest { new ByteArrayInputStream(input.getBytes("US-ASCII")), new ByteArrayOutputStream()); - assertEquals(key, parser.searchKey(null, reader, null, false)); + assertThat(parser.searchKey(null, reader, null, false)).isEqualTo(key); } public class Input { http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java index 17b1e91..4efb78e 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java @@ -19,8 +19,8 @@ package org.apache.james.imap.decode.parser; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Fail.fail; -import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.same; import static org.mockito.Mockito.mock; @@ -158,7 +158,7 @@ public class SearchCommandParserQuotedCharsetTest { BYTES_QUOTED_UTF8_LENGTHY_NON_ASCII_SEARCH_TERM)), new ByteArrayOutputStream()); final SearchKey searchKey = parser.searchKey(null, reader, null, true); - assertEquals(key, searchKey); + assertThat(searchKey).isEqualTo(key); } @Test @@ -170,7 +170,7 @@ public class SearchCommandParserQuotedCharsetTest { BYTES_QUOTED_UTF8_NON_ASCII_SEARCH_TERM)), new ByteArrayOutputStream()); final SearchKey searchKey = parser.searchKey(null, reader, null, true); - assertEquals(key, searchKey); + assertThat(searchKey).isEqualTo(key); } @Test @@ -273,7 +273,7 @@ public class SearchCommandParserQuotedCharsetTest { BYTES_UTF8_NON_ASCII_SEARCH_TERM)), new ByteArrayOutputStream()); final SearchKey searchKey = parser.searchKey(null, reader, null, true); - assertEquals(key, searchKey); + assertThat(searchKey).isEqualTo(key); } private void checkValid(String input, SearchKey key, boolean isFirst, @@ -283,7 +283,7 @@ public class SearchCommandParserQuotedCharsetTest { new ByteArrayOutputStream()); final SearchKey searchKey = parser.searchKey(null, reader, null, isFirst); - assertEquals(key, searchKey); + assertThat(searchKey).isEqualTo(key); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeySequenceSetTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeySequenceSetTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeySequenceSetTest.java index e41293e..fa6eebb 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeySequenceSetTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeySequenceSetTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.decode.parser; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -134,6 +134,6 @@ public class SearchCommandParserSearchKeySequenceSetTest { new ByteArrayOutputStream()); final SearchKey searchKey = parser.searchKey(null, reader, null, false); - assertEquals(key, searchKey); + assertThat(searchKey).isEqualTo(key); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java index 03ffdd8..2efee6a 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java @@ -19,8 +19,8 @@ package org.apache.james.imap.decode.parser; +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; @@ -377,7 +377,7 @@ public class SearchCommandParserSearchKeyTest { new ByteArrayInputStream(input.getBytes("US-ASCII")), new ByteArrayOutputStream()); - assertEquals(key, parser.searchKey(null, reader, null, false)); + assertThat(parser.searchKey(null, reader, null, false)).isEqualTo(key); } @Test http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java index a31643b..0457fcd 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.decode.parser; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -192,6 +192,6 @@ public class SearchCommandParserTopLevelAndTest { new ByteArrayInputStream(input.getBytes("US-ASCII")), new ByteArrayOutputStream()); - assertEquals(input, key, parser.decode(null, reader)); + assertThat(parser.decode(null, reader)).describedAs(input).isEqualTo(key); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetQuotaCommandParserTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetQuotaCommandParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetQuotaCommandParserTest.java index b3d7d20..095badc 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetQuotaCommandParserTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetQuotaCommandParserTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.decode.parser; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -44,13 +44,13 @@ public class SetQuotaCommandParserTest { InputStream inputStream = new ByteArrayInputStream(commandString.getBytes()); ImapRequestStreamLineReader lineReader = new ImapRequestStreamLineReader(inputStream, null); SetQuotaRequest request = (SetQuotaRequest) parser.decode(command, lineReader, "A003", null); - assertEquals("quotaRoot", request.getQuotaRoot()); + assertThat(request.getQuotaRoot()).isEqualTo("quotaRoot"); List<SetQuotaRequest.ResourceLimit> list = request.getResourceLimits(); - assertEquals("STORAGE", list.get(0).getResource()); - assertEquals(512, list.get(0).getLimit()); - assertEquals("MESSAGE", list.get(1).getResource()); - assertEquals(1024, list.get(1).getLimit()); - assertEquals(2, list.size()); + assertThat(list.get(0).getResource()).isEqualTo("STORAGE"); + assertThat(list.get(0).getLimit()).isEqualTo(512); + assertThat(list.get(1).getResource()).isEqualTo("MESSAGE"); + assertThat(list.get(1).getLimit()).isEqualTo(1024); + assertThat(list.size()).isEqualTo(2); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/encode/EncoderUtilsDateTimeLocaleTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/EncoderUtilsDateTimeLocaleTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/EncoderUtilsDateTimeLocaleTest.java index cf25839..b166bda 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/encode/EncoderUtilsDateTimeLocaleTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/EncoderUtilsDateTimeLocaleTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.encode; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.util.Date; import java.util.Locale; @@ -94,34 +94,34 @@ public class EncoderUtilsDateTimeLocaleTest { private void runEncodeDateTime() { - assertEquals("03-Sep-2004 05:08:43 +0000", EncoderUtils - .encodeDateTime(new Date(1094188123661L))); - assertEquals("10-Dec-2005 04:15:23 +0000", EncoderUtils - .encodeDateTime(new Date(1134188123661L))); - assertEquals("11-Jul-2007 21:08:43 +0000", EncoderUtils - .encodeDateTime(new Date(1184188123661L))); - assertEquals("04-Nov-2007 14:55:23 +0000", EncoderUtils - .encodeDateTime(new Date(1194188123661L))); - assertEquals("31-Aug-2353 20:32:24 +0000", EncoderUtils - .encodeDateTime(new Date(12107305944309L))); - assertEquals("03-Jan-2322 11:42:52 +0000", EncoderUtils - .encodeDateTime(new Date(11108230972614L))); - assertEquals("30-Oct-2321 21:19:44 +0000", EncoderUtils - .encodeDateTime(new Date(11102649584790L))); - assertEquals("30-Sep-2321 05:22:54 +0000", EncoderUtils - .encodeDateTime(new Date(11100000174728L))); - assertEquals("08-Jun-2353 08:38:17 +0000", EncoderUtils - .encodeDateTime(new Date(12100005497072L))); - assertEquals("14-Jun-2353 01:11:35 +0000", EncoderUtils - .encodeDateTime(new Date(12100497095056L))); - assertEquals("13-Jul-2353 18:06:29 +0000", EncoderUtils - .encodeDateTime(new Date(12103063589157L))); - assertEquals("05-Feb-2290 02:32:14 +0000", EncoderUtils - .encodeDateTime(new Date(10101292334681L))); - assertEquals("20-Oct-2321 06:24:33 +0000", EncoderUtils - .encodeDateTime(new Date(11101731873573L))); - assertEquals("31-Jan-2290 02:12:49 +0000", EncoderUtils - .encodeDateTime(new Date(10100859169426L))); + assertThat(EncoderUtils + .encodeDateTime(new Date(1094188123661L))).isEqualTo("03-Sep-2004 05:08:43 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(1134188123661L))).isEqualTo("10-Dec-2005 04:15:23 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(1184188123661L))).isEqualTo("11-Jul-2007 21:08:43 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(1194188123661L))).isEqualTo("04-Nov-2007 14:55:23 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(12107305944309L))).isEqualTo("31-Aug-2353 20:32:24 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(11108230972614L))).isEqualTo("03-Jan-2322 11:42:52 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(11102649584790L))).isEqualTo("30-Oct-2321 21:19:44 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(11100000174728L))).isEqualTo("30-Sep-2321 05:22:54 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(12100005497072L))).isEqualTo("08-Jun-2353 08:38:17 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(12100497095056L))).isEqualTo("14-Jun-2353 01:11:35 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(12103063589157L))).isEqualTo("13-Jul-2353 18:06:29 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(10101292334681L))).isEqualTo("05-Feb-2290 02:32:14 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(11101731873573L))).isEqualTo("20-Oct-2321 06:24:33 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(10100859169426L))).isEqualTo("31-Jan-2290 02:12:49 +0000"); } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/encode/EncoderUtilsTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/EncoderUtilsTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/EncoderUtilsTest.java index 863502b..5ef9976 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/encode/EncoderUtilsTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/EncoderUtilsTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.encode; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.util.Date; @@ -31,34 +31,34 @@ public class EncoderUtilsTest { @Test public void testSimpleEncodeDateTime() { - assertEquals("03-Sep-2004 05:08:43 +0000", EncoderUtils - .encodeDateTime(new Date(1094188123661L))); - assertEquals("10-Dec-2005 04:15:23 +0000", EncoderUtils - .encodeDateTime(new Date(1134188123661L))); - assertEquals("11-Jul-2007 21:08:43 +0000", EncoderUtils - .encodeDateTime(new Date(1184188123661L))); - assertEquals("04-Nov-2007 14:55:23 +0000", EncoderUtils - .encodeDateTime(new Date(1194188123661L))); - assertEquals("31-Aug-2353 20:32:24 +0000", EncoderUtils - .encodeDateTime(new Date(12107305944309L))); - assertEquals("03-Jan-2322 11:42:52 +0000", EncoderUtils - .encodeDateTime(new Date(11108230972614L))); - assertEquals("30-Oct-2321 21:19:44 +0000", EncoderUtils - .encodeDateTime(new Date(11102649584790L))); - assertEquals("30-Sep-2321 05:22:54 +0000", EncoderUtils - .encodeDateTime(new Date(11100000174728L))); - assertEquals("08-Jun-2353 08:38:17 +0000", EncoderUtils - .encodeDateTime(new Date(12100005497072L))); - assertEquals("14-Jun-2353 01:11:35 +0000", EncoderUtils - .encodeDateTime(new Date(12100497095056L))); - assertEquals("13-Jul-2353 18:06:29 +0000", EncoderUtils - .encodeDateTime(new Date(12103063589157L))); - assertEquals("05-Feb-2290 02:32:14 +0000", EncoderUtils - .encodeDateTime(new Date(10101292334681L))); - assertEquals("20-Oct-2321 06:24:33 +0000", EncoderUtils - .encodeDateTime(new Date(11101731873573L))); - assertEquals("31-Jan-2290 02:12:49 +0000", EncoderUtils - .encodeDateTime(new Date(10100859169426L))); + assertThat(EncoderUtils + .encodeDateTime(new Date(1094188123661L))).isEqualTo("03-Sep-2004 05:08:43 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(1134188123661L))).isEqualTo("10-Dec-2005 04:15:23 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(1184188123661L))).isEqualTo("11-Jul-2007 21:08:43 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(1194188123661L))).isEqualTo("04-Nov-2007 14:55:23 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(12107305944309L))).isEqualTo("31-Aug-2353 20:32:24 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(11108230972614L))).isEqualTo("03-Jan-2322 11:42:52 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(11102649584790L))).isEqualTo("30-Oct-2321 21:19:44 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(11100000174728L))).isEqualTo("30-Sep-2321 05:22:54 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(12100005497072L))).isEqualTo("08-Jun-2353 08:38:17 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(12100497095056L))).isEqualTo("14-Jun-2353 01:11:35 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(12103063589157L))).isEqualTo("13-Jul-2353 18:06:29 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(10101292334681L))).isEqualTo("05-Feb-2290 02:32:14 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(11101731873573L))).isEqualTo("20-Oct-2321 06:24:33 +0000"); + assertThat(EncoderUtils + .encodeDateTime(new Date(10100859169426L))).isEqualTo("31-Jan-2290 02:12:49 +0000"); } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java index f3d7397..54d035b 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.encode; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -146,7 +146,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL))\r\n"); } @Test @@ -156,7 +156,7 @@ public class FetchResponseEncoderEnvelopeTest { encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (\"a date\" NIL NIL NIL NIL NIL NIL NIL NIL NIL))\r\n",writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (\"a date\" NIL NIL NIL NIL NIL NIL NIL NIL NIL))\r\n"); } @@ -166,7 +166,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL \"some subject\" NIL NIL NIL NIL NIL NIL NIL NIL))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL \"some subject\" NIL NIL NIL NIL NIL NIL NIL NIL))\r\n"); } @@ -176,7 +176,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL NIL NIL \"some reply to\" NIL))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL NIL NIL \"some reply to\" NIL))\r\n"); } @Test @@ -185,7 +185,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL NIL NIL NIL \"some message id\"))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL NIL NIL NIL \"some message id\"))\r\n"); } @@ -194,7 +194,7 @@ public class FetchResponseEncoderEnvelopeTest { from = mockOneAddress(); envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL NIL NIL NIL NIL NIL))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL NIL NIL NIL NIL NIL))\r\n"); } @@ -204,7 +204,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL NIL NIL NIL NIL NIL))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL NIL NIL NIL NIL NIL))\r\n"); } @@ -214,7 +214,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL NIL NIL NIL NIL))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL NIL NIL NIL NIL))\r\n"); } @@ -224,7 +224,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL NIL NIL NIL NIL))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL NIL NIL NIL NIL))\r\n"); } @@ -235,7 +235,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL NIL NIL NIL))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL NIL NIL NIL))\r\n"); } @@ -245,7 +245,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL NIL NIL NIL))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL NIL NIL NIL))\r\n"); } @@ -255,7 +255,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL NIL NIL))\r\n",writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL NIL NIL))\r\n"); } @@ -265,7 +265,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL NIL NIL))\r\n",writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL NIL NIL))\r\n"); } @@ -275,7 +275,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL NIL))\r\n",writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL NIL))\r\n"); } @@ -285,7 +285,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL NIL))\r\n",writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL NIL))\r\n"); } @@ -295,7 +295,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL))\r\n",writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")) NIL NIL))\r\n"); } @@ -305,7 +305,7 @@ public class FetchResponseEncoderEnvelopeTest { envelopExpects(); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL))\r\n",writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (ENVELOPE (NIL NIL NIL NIL NIL NIL NIL ((\"NAME\" \"DOMAIN LIST\" \"MAILBOX\" \"HOST\")(\"2NAME\" \"2DOMAIN LIST\" \"2MAILBOX\" \"2HOST\")) NIL NIL))\r\n"); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderNoExtensionsTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderNoExtensionsTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderNoExtensionsTest.java index 73049e7..356997b 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderNoExtensionsTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderNoExtensionsTest.java @@ -20,7 +20,6 @@ package org.apache.james.imap.encode; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -73,7 +72,7 @@ public class FetchResponseEncoderNoExtensionsTest { FetchResponse message = new FetchResponse(100, flags, null, null, null, null, null, null, null, null); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (FLAGS (\\Deleted))\r\n",writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (FLAGS (\\Deleted))\r\n"); } @Test @@ -81,7 +80,7 @@ public class FetchResponseEncoderNoExtensionsTest { FetchResponse message = new FetchResponse(100, null, MessageUid.of(72), null, null, null, null, null, null, null); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (UID 72)\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (UID 72)\r\n"); } @@ -90,7 +89,7 @@ public class FetchResponseEncoderNoExtensionsTest { FetchResponse message = new FetchResponse(100, flags, MessageUid.of(72), null, null, null, null, null, null, null); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (FLAGS (\\Deleted) UID 72)\r\n",writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (FLAGS (\\Deleted) UID 72)\r\n"); } @@ -115,7 +114,7 @@ public class FetchResponseEncoderNoExtensionsTest { final FakeImapSession fakeImapSession = new FakeImapSession(); encoder.doEncode(message, composer, fakeImapSession); - assertEquals("* 100 FETCH (FLAGS (\\Deleted) BODYSTRUCTURE (\"TEXT\" \"HTML\" (\"CHARSET\" \"US-ASCII\") \"\" \"\" \"7BIT\" 2279 48) UID 72)\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (FLAGS (\\Deleted) BODYSTRUCTURE (\"TEXT\" \"HTML\" (\"CHARSET\" \"US-ASCII\") \"\" \"\" \"7BIT\" 2279 48) UID 72)\r\n"); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java index de1ff1c..1eee9c8 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java @@ -20,7 +20,6 @@ package org.apache.james.imap.encode; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import javax.mail.Flags; @@ -66,7 +65,7 @@ public class FetchResponseEncoderTest { FetchResponse message = new FetchResponse(100, flags, null, null, null, null, null, null, null, null); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (FLAGS (\\Deleted))\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (FLAGS (\\Deleted))\r\n"); } @@ -76,7 +75,7 @@ public class FetchResponseEncoderTest { FetchResponse message = new FetchResponse(100, null, MessageUid.of(72), null, null, null, null, null, null, null); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (UID 72)\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (UID 72)\r\n"); } @@ -86,7 +85,7 @@ public class FetchResponseEncoderTest { FetchResponse message = new FetchResponse(100, flags, MessageUid.of(72), null, null, null, null, null, null, null); encoder.doEncode(message, composer, new FakeImapSession()); - assertEquals("* 100 FETCH (FLAGS (\\Deleted) UID 72)\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* 100 FETCH (FLAGS (\\Deleted) UID 72)\r\n"); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/encode/MailboxStatusResponseEncoderTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/MailboxStatusResponseEncoderTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/MailboxStatusResponseEncoderTest.java index 18bdd05..cfbed6d 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/encode/MailboxStatusResponseEncoderTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/MailboxStatusResponseEncoderTest.java @@ -20,7 +20,6 @@ package org.apache.james.imap.encode; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import org.apache.james.imap.api.ImapMessage; @@ -65,6 +64,6 @@ public class MailboxStatusResponseEncoderTest { encoder.encode(new MailboxStatusResponse(messages, recent, uidNext, null, uidValidity, unseen, mailbox), composer, new FakeImapSession()); - assertEquals("* STATUS \"A mailbox named desire\" (MESSAGES 2 RECENT 3 UIDNEXT 5 UIDVALIDITY 7 UNSEEN 11)\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* STATUS \"A mailbox named desire\" (MESSAGES 2 RECENT 3 UIDNEXT 5 UIDVALIDITY 7 UNSEEN 11)\r\n"); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/encode/QuotaResponseEncoderTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/QuotaResponseEncoderTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/QuotaResponseEncoderTest.java index f428b08..d4ff764 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/encode/QuotaResponseEncoderTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/QuotaResponseEncoderTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.encode; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import org.apache.james.core.quota.QuotaCount; import org.apache.james.core.quota.QuotaSize; @@ -44,7 +44,7 @@ public class QuotaResponseEncoderTest { QuotaResponseEncoder encoder = new QuotaResponseEncoder(new EndImapEncoder()); encoder.encode(response, composer, null); String responseString = byteImapResponseWriter.getString(); - assertEquals("* QUOTA root (MESSAGE 231 1024)\r\n", responseString); + assertThat(responseString).isEqualTo("* QUOTA root (MESSAGE 231 1024)\r\n"); } @Test @@ -56,7 +56,7 @@ public class QuotaResponseEncoderTest { QuotaResponseEncoder encoder = new QuotaResponseEncoder(new EndImapEncoder()); encoder.encode(response, composer, null); String responseString = byteImapResponseWriter.getString(); - assertEquals("* QUOTA root (STORAGE 231 1024)\r\n", responseString); + assertThat(responseString).isEqualTo("* QUOTA root (STORAGE 231 1024)\r\n"); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/encode/QuotaRootResponseEncoderTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/QuotaRootResponseEncoderTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/QuotaRootResponseEncoderTest.java index 7dccd11..a61190e 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/encode/QuotaRootResponseEncoderTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/QuotaRootResponseEncoderTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.encode; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import org.apache.james.imap.encode.base.ByteImapResponseWriter; import org.apache.james.imap.encode.base.EndImapEncoder; @@ -40,7 +40,7 @@ public class QuotaRootResponseEncoderTest { QuotaRootResponseEncoder encoder = new QuotaRootResponseEncoder(new EndImapEncoder()); encoder.encode(response, composer, null); String responseString = byteImapResponseWriter.getString(); - assertEquals("* QUOTAROOT \"INBOX\" root\r\n", responseString); + assertThat(responseString).isEqualTo("* QUOTAROOT \"INBOX\" root\r\n"); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/encode/SearchResponseEncoderTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/SearchResponseEncoderTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/SearchResponseEncoderTest.java index abdfd0c..10b83af 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/encode/SearchResponseEncoderTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/SearchResponseEncoderTest.java @@ -20,7 +20,6 @@ package org.apache.james.imap.encode; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import org.apache.james.imap.api.ImapMessage; @@ -62,6 +61,6 @@ public class SearchResponseEncoderTest { @Test public void testEncode() throws Exception { encoder.encode(response, composer, new FakeImapSession()); - assertEquals("* SEARCH 1 4 9 16\r\n", writer.getString()); + assertThat(writer.getString()).isEqualTo("* SEARCH 1 4 9 16\r\n"); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java b/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java index 43ad2e2..24a47e5 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java @@ -19,7 +19,7 @@ package org.apache.james.imap.main; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import java.io.ByteArrayOutputStream; @@ -50,7 +50,7 @@ public abstract class AbstractTestOutputStreamImapResponseWriter { for (byte aChar : output) { buffer.append((char) aChar); } - assertEquals(expected, buffer.toString()); + assertThat(buffer.toString()).isEqualTo(expected); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/MailboxMessageResultUtilsTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/MailboxMessageResultUtilsTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/MailboxMessageResultUtilsTest.java index 7f0cabf..751389c 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/MailboxMessageResultUtilsTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/MailboxMessageResultUtilsTest.java @@ -21,7 +21,6 @@ package org.apache.james.imap.processor.fetch; import static org.apache.james.imap.processor.fetch.MessageResultUtils.getMatching; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; import java.io.InputStream; import java.util.ArrayList; @@ -92,10 +91,10 @@ public class MailboxMessageResultUtilsTest { @Test public void testGetAllContent() { List<MessageResult.Header> results = MessageResultUtils.getAll(headers.iterator()); - assertEquals(3, results.size()); - assertEquals(headerOne, results.get(0)); - assertEquals(headerTwo, results.get(1)); - assertEquals(headerThree, results.get(2)); + assertThat(results.size()).isEqualTo(3); + assertThat(results.get(0)).isEqualTo(headerOne); + assertThat(results.get(1)).isEqualTo(headerTwo); + assertThat(results.get(2)).isEqualTo(headerThree); } @Test @@ -103,9 +102,9 @@ public class MailboxMessageResultUtilsTest { List<MessageResult.Header> results = MessageResultUtils .getMatching(NAMES, headers.iterator()); - assertEquals(2, results.size()); - assertEquals(headerOne, results.get(0)); - assertEquals(headerThree, results.get(1)); + assertThat(results.size()).isEqualTo(2); + assertThat(results.get(0)).isEqualTo(headerOne); + assertThat(results.get(1)).isEqualTo(headerThree); } @Test @@ -113,16 +112,16 @@ public class MailboxMessageResultUtilsTest { List<MessageResult.Header> results = MessageResultUtils.getNotMatching(NAMES, headers .iterator()); - assertEquals(1, results.size()); - assertEquals(headerTwo, results.get(0)); + assertThat(results.size()).isEqualTo(1); + assertThat(results.get(0)).isEqualTo(headerTwo); } @Test public void testGetMatchingSingle() throws Exception { - assertEquals(headerOne, MessageResultUtils.getMatching("One", headers - .iterator())); - assertEquals(headerThree, MessageResultUtils.getMatching("Three", - headers.iterator())); + assertThat(MessageResultUtils.getMatching("One", headers + .iterator())).isEqualTo(headerOne); + assertThat(MessageResultUtils.getMatching("Three", + headers.iterator())).isEqualTo(headerThree); assertThat(getMatching("Missing", headers.iterator())).isNull(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/PartialFetchBodyElementTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/PartialFetchBodyElementTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/PartialFetchBodyElementTest.java index 0015c8b..c6090b8 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/PartialFetchBodyElementTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/PartialFetchBodyElementTest.java @@ -19,7 +19,7 @@ package org.apache.james.imap.processor.fetch; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -46,9 +46,7 @@ public class PartialFetchBodyElementTest { PartialFetchBodyElement element = new PartialFetchBodyElement(mockBodyElement, 0, NUMBER_OF_OCTETS); when(mockBodyElement.size()).thenReturn(moreThanNumberOfOctets); - assertEquals( - "Size is more than number of octets so should be number of octets", - NUMBER_OF_OCTETS, element.size()); + assertThat(element.size()).describedAs("Size is more than number of octets so should be number of octets").isEqualTo(NUMBER_OF_OCTETS); } @Test @@ -58,8 +56,7 @@ public class PartialFetchBodyElementTest { PartialFetchBodyElement element = new PartialFetchBodyElement(mockBodyElement, 0, NUMBER_OF_OCTETS); when(mockBodyElement.size()).thenReturn(lessThanNumberOfOctets); - assertEquals("Size is less than number of octets so should be size", - lessThanNumberOfOctets, element.size()); + assertThat(element.size()).describedAs("Size is less than number of octets so should be size").isEqualTo(lessThanNumberOfOctets); } @Test @@ -69,8 +66,7 @@ public class PartialFetchBodyElementTest { PartialFetchBodyElement element = new PartialFetchBodyElement(mockBodyElement, 10, NUMBER_OF_OCTETS); when(mockBodyElement.size()).thenReturn(size); - assertEquals("Size is less than number of octets so should be size", - 50, element.size()); + assertThat(element.size()).describedAs("Size is less than number of octets so should be size").isEqualTo(50); } @Test @@ -80,8 +76,7 @@ public class PartialFetchBodyElementTest { PartialFetchBodyElement element = new PartialFetchBodyElement(mockBodyElement, 10, NUMBER_OF_OCTETS); when(mockBodyElement.size()).thenReturn(size); - assertEquals("Size is less than number of octets so should be size", - 90, element.size()); + assertThat(element.size()).describedAs("Size is less than number of octets so should be size").isEqualTo(90); } @Test @@ -90,8 +85,7 @@ public class PartialFetchBodyElementTest { PartialFetchBodyElement element = new PartialFetchBodyElement(mockBodyElement, 1000, NUMBER_OF_OCTETS); when(mockBodyElement.size()).thenReturn(size); - assertEquals("Size is less than number of octets so should be size", 0, - element.size()); + assertThat(element.size()).describedAs("Size is less than number of octets so should be size").isEqualTo(0); } @Test @@ -101,7 +95,6 @@ public class PartialFetchBodyElementTest { PartialFetchBodyElement element = new PartialFetchBodyElement(mockBodyElement, 1000, NUMBER_OF_OCTETS); when(mockBodyElement.size()).thenReturn(size); - assertEquals("Content size is less than start. Size should be zero.", - NUMBER_OF_OCTETS, element.size()); + assertThat(element.size()).describedAs("Content size is less than start. Size should be zero.").isEqualTo(NUMBER_OF_OCTETS); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
