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 2019/01/08 08:00:38 UTC
[19/47] james-project git commit: MAILBOX-359 Improving QuotaScope
coverage
MAILBOX-359 Improving QuotaScope coverage
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/07818491
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/07818491
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/07818491
Branch: refs/heads/master
Commit: 07818491e7884bd671b141bdfb7a301e58efcd04
Parents: 7776d2a
Author: Benoit Tellier <bt...@linagora.com>
Authored: Mon Jan 7 18:07:12 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Tue Jan 8 14:39:53 2019 +0700
----------------------------------------------------------------------
.../james/event/json/dtos/QuotaCountTest.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/07818491/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaCountTest.java
----------------------------------------------------------------------
diff --git a/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaCountTest.java b/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaCountTest.java
index 88adaa6..e203cc6 100644
--- a/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaCountTest.java
+++ b/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaCountTest.java
@@ -22,6 +22,7 @@ package org.apache.james.event.json.dtos;
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;
import static org.apache.james.event.json.SerializerFixture.DTO_JSON_SERIALIZE;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.apache.james.core.quota.QuotaCount;
import org.apache.james.event.json.DTOs;
@@ -202,4 +203,21 @@ class QuotaCountTest {
}
}
}
+
+ @Nested
+ class UnknownQuotaScope {
+ private final String json = "{\"used\":12,\"limit\":100,\"limits\":{\"Invalid\":100}}";
+
+ @Test
+ void fromJsonShouldThrowOnInvalidScope() {
+ assertThatThrownBy(() -> DTO_JSON_SERIALIZE.quotaCReads().reads(Json.parse(json)).get().toJava())
+ .isInstanceOf(IllegalArgumentException.class);
+ }
+
+ @Test
+ void scopesShouldBeString() {
+ assertThat(DTO_JSON_SERIALIZE.quotaScopeReads().reads(Json.parse("3")))
+ .isInstanceOf(JsError.class);
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org