private void isMetricForFirstMessageInStoreOK(StorableId msgId, Date storedOn) throws KapuaException {
KapuaId tmpAccId = ((Account) stepData.get("LastAccount")).getId();
String tmpClId = ((Device) stepData.get("LastDevice")).getClientId();
AndPredicate andPredicate = new AndPredicateImpl();
andPredicate.getPredicates().add(new TermPredicateImpl(MetricInfoField.CLIENT_ID, tmpClId));
MetricInfoQuery metricInfoQuery = DatastoreQueryFactory.createBaseMetricInfoQuery(tmpAccId, 100);
metricInfoQuery.setPredicate(andPredicate);
metricInfoQuery.addFetchAttributes(MetricInfoField.TIMESTAMP_FULL.field());
MetricInfoListResult metricInfoList = metricInfoRegistryService.query(metricInfoQuery);
assertNotNull("Cannot find the metric info registry!", metricInfoList);
assertNotEquals("Cannot find the metric info registry!", metricInfoList.getSize(), 0);
assertNotNull("Cannot find the metric info registry!", metricInfoList.getFirstItem());
assertEquals("Wrong metric info message id!", metricInfoList.getFirstItem().getFirstMessageId(), msgId);
assertEquals("Wrong metric info message on!", metricInfoList.getFirstItem().getFirstMessageOn(), storedOn);
}