2222import junit .framework .TestCase ;
2323import org .apache .cloudstack .framework .config .dao .ConfigurationDao ;
2424import org .apache .cloudstack .quota .QuotaStatementImpl .STATEMENT_PERIODS ;
25- import org .apache .cloudstack .quota .constant .QuotaConfig ;
2625import org .apache .cloudstack .quota .dao .QuotaAccountDao ;
2726import org .apache .cloudstack .quota .dao .QuotaUsageDao ;
2827import org .apache .cloudstack .quota .vo .QuotaAccountVO ;
@@ -224,6 +223,7 @@ public void testStatementPeriodYEARLY() {
224223
225224 }
226225
226+
227227 @ Test
228228 public void testSendStatement () throws UnsupportedEncodingException , MessagingException {
229229 Calendar date = Calendar .getInstance ();
@@ -242,13 +242,11 @@ public void testSendStatement() throws UnsupportedEncodingException, MessagingEx
242242 Mockito .when (quotaUsage .findTotalQuotaUsage (Mockito .anyLong (), Mockito .anyLong (), Mockito .anyInt (), Mockito .any (Date .class ), Mockito .any (Date .class )))
243243 .thenReturn (new BigDecimal (100 ));
244244
245- QuotaAlertManagerImpl .DeferredQuotaEmail email = new QuotaAlertManagerImpl .DeferredQuotaEmail (accountVO , acc , new BigDecimal (100 ),
246- QuotaConfig .QuotaEmailTemplateTypes .QUOTA_LOW );
247245 // call real method on send monthly statement
248- Mockito . doCallRealMethod (). when ( quotaStatement ) .sendStatement ();
246+ quotaStatement .sendStatement ();
249247 Calendar period [] = quotaStatement .statementTime (date , STATEMENT_PERIODS .MONTHLY );
250248 if (period != null ){
251- Mockito .verify (alertManager , Mockito .times (1 )).sendQuotaAlert (email );
249+ Mockito .verify (alertManager , Mockito .times (1 )).sendQuotaAlert (Mockito . any ( QuotaAlertManagerImpl . DeferredQuotaEmail . class ) );
252250 }
253251 }
254252
0 commit comments