@SuppressWarnings("unchecked")
@Test
public void testWhenInstancesPresentSingleCall() {
AWSEC2Api client = createMock(AWSEC2Api.class);
AWSInstanceApi instanceApi = createMock(AWSInstanceApi.class);
Function<SpotInstanceRequest, AWSRunningInstance> converter = createMock(Function.class);
expect(client.getInstanceApi()).andReturn((Optional) Optional.of(instanceApi));
// avoid imatcher fail. if you change this, be sure to check multiple jres
expect(instanceApi.describeInstancesInRegion("us-east-1", "i-aaaa", "i-bbbb")).andReturn(
Set.class.cast(ImmutableSet.of(Reservation.<AWSRunningInstance> builder().region("us-east-1")
.instances(ImmutableSet.of(instance1, instance2)).build())));
replay(client, instanceApi, converter);