Repository: james-project
Updated Branches:
  refs/heads/master 5ee21fec0 -> c2b85a004


MAILBOX-333 Notice should handle size units


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/8982f4a6
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/8982f4a6
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/8982f4a6

Branch: refs/heads/master
Commit: 8982f4a69334a62a3f08c1609b5717292e597120
Parents: 5ee21fe
Author: benwa <btell...@linagora.com>
Authored: Thu May 10 09:46:01 2018 +0700
Committer: benwa <btell...@linagora.com>
Committed: Thu May 10 09:46:01 2018 +0700

----------------------------------------------------------------------
 .../subscribers/QuotaThresholdNoticeTest.java   | 24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/8982f4a6/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNoticeTest.java
----------------------------------------------------------------------
diff --git 
a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNoticeTest.java
 
b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNoticeTest.java
index e47adc2..0898b18 100644
--- 
a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNoticeTest.java
+++ 
b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNoticeTest.java
@@ -202,6 +202,30 @@ class QuotaThresholdNoticeTest {
     }
 
     @Test
+    void generateReportShouldFormatSizeUnits() throws Exception {
+        QuotaThresholdChange sizeThresholdChange = new 
QuotaThresholdChange(_80, NOW);
+
+        assertThat(QuotaThresholdNotice.builder()
+            .withConfiguration(DEFAULT_CONFIGURATION)
+            .sizeQuota(Quota.<QuotaSize>builder()
+                .used(QuotaSize.size(801 * 1024 * 1024))
+                .computedLimit(QuotaSize.size(1024 * 1024 * 1024))
+                .build())
+            .countQuota(Counts._72_PERCENT)
+            
.sizeThreshold(HistoryEvolution.higherThresholdReached(sizeThresholdChange, 
NotAlreadyReachedDuringGracePeriod))
+            .build()
+            .get()
+            .generateReport(fileSystem))
+            .isEqualTo("You receive this email because you recently exceeded a 
threshold related to the quotas of your email account.\n" +
+                "\n" +
+                "You currently occupy more than 80 % of the total size 
allocated to you.\n" +
+                "You currently occupy 801 MB on a total of 1 GB allocated to 
you.\n" +
+                "\n" +
+                "You need to be aware that actions leading to exceeded quotas 
will be denied. This will result in a degraded service.\n" +
+                "To mitigate this issue you might reach your administrator in 
order to increase your configured quota. You might also delete some non 
important emails.");
+    }
+
+    @Test
     void generateReportShouldOmitSizePartWhenNone() throws Exception {
         QuotaThresholdChange countThresholdChange = new 
QuotaThresholdChange(_80, NOW);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to