@Test public void testExists_True() throws Exception { initializeExpectedOperation(3); Compute.OperationOption[] expectedOptions = {Compute.OperationOption.fields()}; expect(compute.getOptions()).andReturn(mockOptions); expect(compute.getOperation(GLOBAL_OPERATION_ID, expectedOptions)).andReturn(globalOperation); replay(compute); initializeOperation(); assertTrue(operation.exists()); verify(compute); }
@Test public void testExists_False() throws Exception { initializeExpectedOperation(3); Compute.OperationOption[] expectedOptions = {Compute.OperationOption.fields()}; expect(compute.getOptions()).andReturn(mockOptions); expect(compute.getOperation(GLOBAL_OPERATION_ID, expectedOptions)).andReturn(null); replay(compute); initializeOperation(); assertFalse(operation.exists()); verify(compute); }