@Test
public void testPrepareBaseTransactionCommand() throws JsonProcessingException {

    // Setup
    final BaseTransactionCommand command = mock(BaseTransactionCommand.class);
    final AbstractCommand abstractCommand = mock(AbstractCommand.class);
    ArgumentCaptor<OutboundCommand> commandArgumentCaptor = ArgumentCaptor.forClass(OutboundCommand.class);
    BubbleMessage message = mock(BubbleMessage.class);
    when(mockBubbleCache.getBubble(anyString())).thenReturn(Optional.of(message));
    when(mockMapper.writeValueAsString(anyString())).thenReturn(PAYLOAD);
    when(abstractCommand.buildMeta()).thenReturn(mockCommandMeta);
    when(mockCommandRepository.save(any(AbstractCommand.class))).thenReturn(abstractCommand);
    when(mockEnvironment.getProperty(same("kermoss.serviceName"), anyString())).thenReturn("source");
    // Run the test
    commandOrchestratorImplUnderTest.prepare(command);
    // Verify the results
    verify(mockCommandRepository).save(commandArgumentCaptor.capture());
    OutboundCommand mappedCommand = commandArgumentCaptor.getValue();
    verify(mockPublisher).publishEvent(any(OutboundCommandStarted.class));
    Assert.assertEquals(mappedCommand.getPayload(), PAYLOAD);
    Assert.assertEquals(mappedCommand.getSource(), "source");
    Assert.assertEquals(mappedCommand.getStatus(), OutboundCommand.Status.PREPARED);
    verify(mockPublisher).publishEvent(any(OutboundCommandPrepared.class));
}