@Test
public void testUpdateLifecycle() {

    InstanceGroupLifecycleStatus updatedInstanceGroupLifecycleStatus = InstanceGroupLifecycleStatus.newBuilder().withState(InstanceGroupLifecycleState.Removable).build();
    ExtTestSubscriber<Object> testSubscriber = new ExtTestSubscriber<>();
    AgentInstanceGroup instanceGroup = instanceGroups.get(0);
    String instanceGroupId = instanceGroup.getId();
    when(agentCache.updateInstanceGroupStore(eq(instanceGroupId), any()))
            .thenReturn(Single.just(instanceGroup.toBuilder().withLifecycleStatus(updatedInstanceGroupLifecycleStatus).build()));
    service.updateInstanceGroupLifecycle(instanceGroupId, updatedInstanceGroupLifecycleStatus).toObservable().subscribe(testSubscriber);
    verify(agentCache, times(1)).updateInstanceGroupStore(eq(instanceGroupId), any());
}