@Test
    public void testInvalidErrorThreshold() throws Throwable {
      String resourcePool = UUID.randomUUID().toString();
      ResourceAllocationTaskState startState =
          createAllocationRequest(resourcePool, "http://computeDescription", null, null);
      startState.errorThreshold = -1;

      host.postServiceSynchronously(
          ResourceAllocationTaskFactoryService.SELF_LINK,
          startState,
          ResourceAllocationTaskState.class,
          IllegalArgumentException.class);
    }
  private static ResourceAllocationTaskState createAllocationRequestWithResourceDescription(
      String resourcePool,
      ComputeDescriptionService.ComputeDescription cd,
      ResourceDescriptionService.ResourceDescription rd) {
    ResourceAllocationTaskState state = new ResourceAllocationTaskState();
    state.taskSubStage =
        ResourceAllocationTaskService.SubStage.QUERYING_AVAILABLE_COMPUTE_RESOURCES;
    state.resourceCount = 2;
    state.resourcePoolLink = resourcePool;
    state.resourceDescriptionLink = rd.documentSelfLink;

    return state;
  }
  private static ResourceAllocationTaskState createAllocationRequest(
      String resourcePool,
      String computeDescriptionLink,
      List<String> diskDescriptionLinks,
      List<String> networkDescriptionLinks) {
    ResourceAllocationTaskState state = new ResourceAllocationTaskState();
    state.taskSubStage =
        ResourceAllocationTaskService.SubStage.QUERYING_AVAILABLE_COMPUTE_RESOURCES;
    state.resourceCount = 2;
    state.resourcePoolLink = resourcePool;
    state.computeDescriptionLink = computeDescriptionLink;
    state.computeType = ComputeType.VM_GUEST.toString();
    state.customProperties = new HashMap<>();
    state.customProperties.put("testProp", "testValue");

    // For most tests, we override resourceDescription.
    state.resourceDescriptionLink = null;

    state.diskDescriptionLinks = diskDescriptionLinks;
    state.networkDescriptionLinks = networkDescriptionLinks;

    return state;
  }