diff --git a/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/util/TestCommonUtil.scala b/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/util/TestCommonUtil.scala index 6ee62235d..a8a27ba89 100644 --- a/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/util/TestCommonUtil.scala +++ b/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/util/TestCommonUtil.scala @@ -1,5 +1,6 @@ package org.ekstep.analytics.api.util +import org.ekstep.analytics.api.util.CommonUtil.monthPeriod import org.ekstep.analytics.api.{BaseSpec, Range, ResponseCode} import org.joda.time.format.{DateTimeFormat, DateTimeFormatter} import org.joda.time.{DateTime, DateTimeZone, Duration} @@ -14,7 +15,7 @@ class TestCommonUtil extends BaseSpec { val thisYear: Int = (new DateTime).getYear val thisMonth: Int = (new DateTime).getMonthOfYear val thisWeekNo = (new DateTime).getWeekOfWeekyear - val monthYear = Integer.parseInt(s"$thisYear"+s"$thisMonth") + val monthYear = monthPeriod.print(new DateTime).toInt val now = DateTime.now(DateTimeZone.UTC) val dateInt = Integer.parseInt(dateFormat.print(now).replace("-", "")) @@ -32,7 +33,8 @@ class TestCommonUtil extends BaseSpec { resp3.params.status should be("successful"); resp3.result.get should be(Map("ttl" -> 24.asInstanceOf[AnyRef])); CommonUtil.getDayRange(7) should be(Range(Integer.parseInt(dateFormat.print(now.minusDays(7)).replace("-", "")), dateInt)) - CommonUtil.getMonthRange(2) should be(Range(monthYear-2, monthYear)) + val startMonth = monthPeriod.print((new DateTime).minusMonths(2)).toInt + CommonUtil.getMonthRange(2) should be(Range(startMonth, monthYear)) CommonUtil.getRemainingHours() should be(remainingTime) CommonUtil.getWeeksBetween(1451650400000L, 1454650400000L) should be(5);