@Test(expected = NifiClientRuntimeException.class)
public void updateStateByIdWithTimeout() {

    // Mock NiFi REST client
    final NiFiRestClient nifiClient = Mockito.mock(NiFiRestClient.class);
    Mockito.when(nifiClient.getBulletins("MYID")).thenReturn(Collections.emptyList());
    // Mock controller services
    final ControllerServiceDTO response = new ControllerServiceDTO();
    response.setState("ENABLING");
    // Mock NiFi Controller Service REST client
    final AbstractNiFiControllerServicesRestClient client = Mockito.mock(AbstractNiFiControllerServicesRestClient.class, Mockito.CALLS_REAL_METHODS);
    Mockito.when(client.update(Mockito.any())).thenReturn(response);
    Mockito.when(client.findById(Mockito.anyString())).thenReturn(Optional.of(response));
    Mockito.when(client.getClient()).thenReturn(nifiClient);
    // Test updating state
    client.updateStateByIdWithRetries("MYID", "ENABLED", 1, 0, TimeUnit.NANOSECONDS);
}