@Test
public void Should_executeQueryAndSendData()
        throws Exception {

    Collection dataMock = mock(Collection.class);
    when(queryExecutorMock.execute(same(schedulerEntryMock))).thenReturn(dataMock).thenThrow(QueryExecutionException.class);
    IObject state = IOC.resolve(Keys.getOrAdd("info.smart_tools.smartactors.iobject.iobject.IObject"),
            ("{" +
                    "'queryExecutor':'that query executor'," +
                    "'statisticsChain':'the_statistics_chain'" +
                    "}").replace('\'','"'));
    when(schedulerEntryMock.getState()).thenReturn(state);
    when(schedulerEntryMock.getLastTime()).thenReturn(100600L);
    new QuerySensorSchedulerAction().execute(schedulerEntryMock);
    ArgumentCaptor<IObject> messageCaptor = ArgumentCaptor.forClass(IObject.class);
    verify(messageBusHandlerMock).handle(messageCaptor.capture(), eq("the_statistics_chain__0"));
    assertSame(dataMock, messageCaptor.getValue().getValue(IOC.resolve(Keys.getOrAdd("info.smart_tools.smartactors.iobject.ifield_name.IFieldName"), "data")));
    assertEquals(100600L, messageCaptor.getValue().getValue(IOC.resolve(Keys.getOrAdd("info.smart_tools.smartactors.iobject.ifield_name.IFieldName"),
            "periodStart")));
    assertEquals(100600L, messageCaptor.getValue().getValue(IOC.resolve(Keys.getOrAdd("info.smart_tools.smartactors.iobject.ifield_name.IFieldName"),
            "periodEnd")));
}