@Test
public void updateStateByIdWithRetries() {

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