@Test
public void testUpdateCapacity() {

    ExtTestSubscriber<Object> testSubscriber = new ExtTestSubscriber<>();
    AgentInstanceGroup instanceGroup = instanceGroups.get(0);
    String instanceGroupId = instanceGroup.getId();
    when(agentCache.updateInstanceGroupStoreAndSyncCloud(eq(instanceGroupId), any()))
            .thenReturn(Single.just(instanceGroup));
    service.updateCapacity(instanceGroups.get(0).getId(), Optional.of(100), Optional.of(1000)).toObservable().subscribe(testSubscriber);
    verify(connector, times(1)).updateCapacity(instanceGroups.get(0).getId(), Optional.of(100), Optional.of(1000));
    verify(agentCache, times(1)).updateInstanceGroupStoreAndSyncCloud(eq(instanceGroupId), any());
}