@Test(description = "Testing get devices with Since")
public void testGetDevicesWithSince() {

    String since = new SimpleDateFormat(DEFAULT_DATE_FORMAT).format(new Date());
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService"))
            .toReturn(this.deviceManagementProviderService);
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService"))
            .toReturn(this.deviceAccessAuthorizationService);
    PowerMockito.stub(PowerMockito.method(MultitenantUtils.class, "getTenantAwareUsername"))
            .toReturn(TENANT_AWARE_USERNAME);
    PowerMockito.stub(PowerMockito.method(CarbonContext.class, "getThreadLocalCarbonContext"))
            .toReturn(Mockito.mock(CarbonContext.class, Mockito.RETURNS_MOCKS));
    Response response = this.deviceManagementService
            .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
                    DEFAULT_STATUS, 1, since, null, false, 10, 5);
    Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
    response = this.deviceManagementService
            .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
                    DEFAULT_STATUS, 1, since, null, true, 10, 5);
    Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
    response = this.deviceManagementService
            .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP,
                    DEFAULT_STATUS, 1, "ErrorSince", null, false, 10, 5);
    Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
}