You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/06/05 03:21:28 UTC
[2/3] james-mime4j git commit: JAMES-2045 Improve DateTimeTest
readability with assertJ messages
JAMES-2045 Improve DateTimeTest readability with assertJ messages
It was impossible to know wich dates differed before
Project: http://git-wip-us.apache.org/repos/asf/james-mime4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-mime4j/commit/149e3010
Tree: http://git-wip-us.apache.org/repos/asf/james-mime4j/tree/149e3010
Diff: http://git-wip-us.apache.org/repos/asf/james-mime4j/diff/149e3010
Branch: refs/heads/master
Commit: 149e3010ade21239c2c4a2f9f28ddf7626017832
Parents: 7829f79
Author: benwa <bt...@linagora.com>
Authored: Mon Jun 5 09:01:39 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Mon Jun 5 10:15:51 2017 +0700
----------------------------------------------------------------------
dom/pom.xml | 6 ++++++
.../apache/james/mime4j/field/datetime/DateTimeTest.java | 11 +++++++----
pom.xml | 6 ++++++
3 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/149e3010/dom/pom.xml
----------------------------------------------------------------------
diff --git a/dom/pom.xml b/dom/pom.xml
index 1b8ee4b..3a549f4 100644
--- a/dom/pom.xml
+++ b/dom/pom.xml
@@ -46,8 +46,14 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/149e3010/dom/src/test/java/org/apache/james/mime4j/field/datetime/DateTimeTest.java
----------------------------------------------------------------------
diff --git a/dom/src/test/java/org/apache/james/mime4j/field/datetime/DateTimeTest.java b/dom/src/test/java/org/apache/james/mime4j/field/datetime/DateTimeTest.java
index 37dfe08..02510ba 100644
--- a/dom/src/test/java/org/apache/james/mime4j/field/datetime/DateTimeTest.java
+++ b/dom/src/test/java/org/apache/james/mime4j/field/datetime/DateTimeTest.java
@@ -19,6 +19,8 @@
package org.apache.james.mime4j.field.datetime;
+import static org.assertj.core.api.Assertions.assertThat;
+
import org.apache.james.mime4j.MimeException;
import org.apache.james.mime4j.field.datetime.parser.DateTimeParser;
import org.apache.james.mime4j.field.datetime.parser.ParseException;
@@ -101,10 +103,11 @@ public class DateTimeTest {
private void ensureAllEqual(String[] dateStrings) throws ParseException {
for (int i = 0; i < dateStrings.length - 1; i++) {
- Assert.assertEquals(
- new DateTimeParser(new StringReader(dateStrings[i])).parseAll().getDate().getTime(),
- new DateTimeParser(new StringReader(dateStrings[i + 1])).parseAll().getDate().getTime()
- );
+ long date1 = new DateTimeParser(new StringReader(dateStrings[i])).parseAll().getDate().getTime();
+ long date2 = new DateTimeParser(new StringReader(dateStrings[i + 1])).parseAll().getDate().getTime();
+ assertThat(date1)
+ .as(dateStrings[i] + " == " + dateStrings[i + 1])
+ .isEqualTo(date2);
}
}
http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/149e3010/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 354e2ec..359bf04 100644
--- a/pom.xml
+++ b/pom.xml
@@ -128,6 +128,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>1.7.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org