Skip to content

Commit 2b06f1d

Browse files
committed
Merge remote-tracking branch 'origin/4.9' into 4.10
2 parents ffddd6d + 047bb1c commit 2b06f1d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.apache.cloudstack.quota.dao.QuotaUsageDao;
3333
import org.apache.cloudstack.quota.vo.QuotaAccountVO;
3434
import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
35-
import org.joda.time.DateTime;
3635
import org.junit.Before;
3736
import org.junit.Test;
3837
import org.junit.runner.RunWith;
@@ -47,8 +46,10 @@
4746
import java.lang.reflect.Field;
4847
import java.math.BigDecimal;
4948
import java.util.ArrayList;
49+
import java.util.Calendar;
5050
import java.util.Date;
5151
import java.util.List;
52+
import java.util.TimeZone;
5253

5354
@RunWith(MockitoJUnitRunner.class)
5455
public class QuotaAlertManagerImplTest extends TestCase {
@@ -179,7 +180,11 @@ public void testSendQuotaAlert() throws UnsupportedEncodingException, MessagingE
179180
public void testGetDifferenceDays() {
180181
Date now = new Date();
181182
assertTrue(QuotaAlertManagerImpl.getDifferenceDays(now, now) == 0L);
182-
assertTrue(QuotaAlertManagerImpl.getDifferenceDays(now, new DateTime(now).plusDays(1).toDate()) == 1L);
183+
Calendar c = Calendar.getInstance();
184+
c.setTimeZone(TimeZone.getTimeZone("UTC"));
185+
Calendar c2 = (Calendar) c.clone();
186+
c2.add(Calendar.DATE, 1);
187+
assertEquals(1L, QuotaAlertManagerImpl.getDifferenceDays(c.getTime(), c2.getTime()));
183188
}
184189

185190
@Test

0 commit comments

Comments
 (0)