@Test
public void newChainCanBeStarted() throws TbNodeException {

    init();
    AssetId assetId = new AssetId(UUIDs.timeBased());
    CustomerId customerId = new CustomerId(UUIDs.timeBased());
    Asset asset = new Asset();
    asset.setCustomerId(customerId);
    RuleChainId ruleChainId = new RuleChainId(UUIDs.timeBased());
    RuleNodeId ruleNodeId = new RuleNodeId(UUIDs.timeBased());
    TbMsg msg = new TbMsg(UUIDs.timeBased(), "ASSET", assetId, new TbMsgMetaData(), "{}", ruleChainId, ruleNodeId, 0L);
    when(ctx.getAssetService()).thenReturn(assetService);
    when(assetService.findAssetByIdAsync(assetId)).thenReturn(Futures.immediateFuture(asset));
    node.onMsg(ctx, msg);
    ArgumentCaptor<TbMsg> msgCaptor = ArgumentCaptor.forClass(TbMsg.class);
    ArgumentCaptor<String> typeCaptor = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<EntityId> originatorCaptor = ArgumentCaptor.forClass(EntityId.class);
    ArgumentCaptor<TbMsgMetaData> metadataCaptor = ArgumentCaptor.forClass(TbMsgMetaData.class);
    ArgumentCaptor<String> dataCaptor = ArgumentCaptor.forClass(String.class);
    verify(ctx).transformMsg(msgCaptor.capture(), typeCaptor.capture(), originatorCaptor.capture(), metadataCaptor.capture(), dataCaptor.capture());
    assertEquals(customerId, originatorCaptor.getValue());
}