when(controller.getNodes((ClusterSpec) any())).thenReturn(
(Set) Sets.newLinkedHashSet(Lists.newArrayList(node1, node2)));
when(controller.getInstances((ClusterSpec)any(), (ClusterStateStore)any()))
.thenCallRealMethod();
ClusterStateStore memStore = new MemoryClusterStateStore();
memStore.save(createTestCluster(
new String[]{"id1", "id2"}, new String[]{"role1", "role2"}));
ClusterStateStoreFactory stateStoreFactory = mock(ClusterStateStoreFactory.class);
when(stateStoreFactory.create((ClusterSpec) any())).thenReturn(memStore);