public void update(State state, String summary) {
    if (canTransferToState(state)) {
      _state = state;
      _summary = Utils.validateNotNull(summary, "ProvisionerState summary cannot be null.");
      _updatedMs = System.currentTimeMillis();
    } else {
      throw new IllegalStateException("Cannot set the provisioner state from " + _state.toString() + " to " + state.toString()
                                      + ". The valid target states are " + Collections.unmodifiableSet(VALID_TRANSFER.get(_state)));
    }
  }
@Test
  public void testProvisionerStateInvalidUpdateThrowsException() {
    ProvisionerState.State originalState = ProvisionerState.State.IN_PROGRESS;
    String originalSummary = "Test summary.";
    ProvisionerState provisionerState = new ProvisionerState(originalState, originalSummary);
    ProvisionerState.State updatedState = ProvisionerState.State.COMPLETED_WITH_ERROR;

    assertThrows(IllegalArgumentException.class, () -> provisionerState.update(originalState, null));
    assertThrows(IllegalStateException.class, () -> provisionerState.update(updatedState, originalSummary));
  }