@Test
  public void shouldNotSendAnyEventThroughGatewayIfDestinationIsDisabled() throws Exception {
    destinationUri =
        new RESTDestinationURIDealer() {}.toRestDestinationURI(
            tenant.getDomainName(), REGISTERED_AND_INACTIVE_DESTINATION_GUID);

    subject.send(event, destinationUri, null, tenant);

    verify(httpGateway, never()).request(any(), any(), any(), any(), any(), any());
    verify(eventRepository, never()).saveIncoming(tenant, event);
  }
  @Test
  public void shouldRaiseAnExceptionIfDestinationIsUnknown() throws Exception {
    destinationUri =
        new RESTDestinationURIDealer() {}.toRestDestinationURI(
            tenant.getDomainName(), "unknown_guid");

    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage(MessageFormat.format("REST Destination is unknown : {0}", destinationUri));

    subject.send(event, destinationUri, null, tenant);
  }
  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    EventPublisherRest.class.cast(subject).setEventRepository(eventRepository);

    tenant = tenantRepository.findByDomainName("konker");
    destination =
        destinationService.getByGUID(tenant, REGISTERED_AND_ACTIVE_DESTINATION_GUID).getResult();

    destinationUri =
        new RESTDestinationURIDealer() {}.toRestDestinationURI(
            tenant.getDomainName(), destination.getGuid());

    event =
        Event.builder()
            //                .channel(DEVICE_MQTT_CHANNEL)
            .payload(validEventPayload)
            .timestamp(Instant.now())
            .build();
  }