This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 255b23735e09ce6b39b7a74daa5873631ba004b2 Author: Rene Cordier <rcord...@linagora.com> AuthorDate: Mon Dec 9 11:20:19 2019 +0700 [Refactoring] Move SearchQueryTest to JUnit 5 --- .../elasticsearch/query/SearchQueryTest.java | 53 +++++++++------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/query/SearchQueryTest.java b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/query/SearchQueryTest.java index 5d64c0c..e5502fd 100644 --- a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/query/SearchQueryTest.java +++ b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/query/SearchQueryTest.java @@ -19,59 +19,50 @@ package org.apache.james.mailbox.elasticsearch.query; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + import java.util.Date; import org.apache.james.mailbox.model.SearchQuery; import org.apache.james.mailbox.model.SearchQuery.DateResolution; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -public class SearchQueryTest { +import org.junit.jupiter.api.Test; - @Rule - public ExpectedException expectedException = ExpectedException.none(); +class SearchQueryTest { @Test - public void sentDateOnShouldThrowOnNullDate() { - expectedException.expect(NullPointerException.class); - - SearchQuery.sentDateOn(null, DateResolution.Day); + void sentDateOnShouldThrowOnNullDate() { + assertThatThrownBy(() -> SearchQuery.sentDateOn(null, DateResolution.Day)) + .isInstanceOf(NullPointerException.class); } @Test - public void sentDateOnShouldThrowOnNullResolution() { - expectedException.expect(NullPointerException.class); - - SearchQuery.sentDateOn(new Date(), null); + void sentDateOnShouldThrowOnNullResolution() { + assertThatThrownBy(() -> SearchQuery.sentDateOn(new Date(), null)) + .isInstanceOf(NullPointerException.class); } @Test - public void sentDateAfterShouldThrowOnNullDate() { - expectedException.expect(NullPointerException.class); - - SearchQuery.sentDateAfter(null, DateResolution.Day); + void sentDateAfterShouldThrowOnNullDate() { + assertThatThrownBy(() -> SearchQuery.sentDateAfter(null, DateResolution.Day)) + .isInstanceOf(NullPointerException.class); } @Test - public void sentDateAfterShouldThrowOnNullResolution() { - expectedException.expect(NullPointerException.class); - - SearchQuery.sentDateAfter(new Date(), null); + void sentDateAfterShouldThrowOnNullResolution() { + assertThatThrownBy(() -> SearchQuery.sentDateAfter(new Date(), null)) + .isInstanceOf(NullPointerException.class); } @Test - public void sentDateBeforeShouldThrowOnNullDate() { - expectedException.expect(NullPointerException.class); - - SearchQuery.sentDateBefore(null, DateResolution.Day); + void sentDateBeforeShouldThrowOnNullDate() { + assertThatThrownBy(() -> SearchQuery.sentDateBefore(null, DateResolution.Day)) + .isInstanceOf(NullPointerException.class); } @Test - public void sentDateBeforeShouldThrowOnNullResolution() { - expectedException.expect(NullPointerException.class); - - SearchQuery.sentDateOn(new Date(), null); + void sentDateBeforeShouldThrowOnNullResolution() { + assertThatThrownBy(() -> SearchQuery.sentDateOn(new Date(), null)) + .isInstanceOf(NullPointerException.class); } } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org