Skip to content

Commit ee2ccc4

Browse files
committed
Merge release branch 4.7 to master
* 4.7: QuotaStatementTest: fix the method invocation verification
2 parents 67b753c + d681574 commit ee2ccc4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import junit.framework.TestCase;
2323
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
2424
import org.apache.cloudstack.quota.QuotaStatementImpl.STATEMENT_PERIODS;
25-
import org.apache.cloudstack.quota.constant.QuotaConfig;
2625
import org.apache.cloudstack.quota.dao.QuotaAccountDao;
2726
import org.apache.cloudstack.quota.dao.QuotaUsageDao;
2827
import 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

Comments
 (0)