@Test(groups = "unit", testName = "ClientForGroupTest")
public class ClientForGroupTest {
public void testWhenNoClientsInList() throws IOException {
ChefApi chefApi = createMock(ChefApi.class);
Client client = createMock(Client.class);
PrivateKey privateKey = createMock(PrivateKey.class);
ClientForGroup fn = new ClientForGroup(chefApi);
expect(chefApi.listClients()).andReturn(ImmutableSet.<String> of());
expect(chefApi.createClient("foo-client-00")).andReturn(client);
expect(client.getPrivateKey()).andReturn(privateKey);
replay(client);
replay(chefApi);
Client compare = fn.apply("foo");
assertEquals(compare.getClientname(), "foo-client-00");
assertEquals(compare.getName(), "foo-client-00");
assertEquals(compare.getPrivateKey(), privateKey);
verify(client);
verify(chefApi);
}