@Test(dataProvider = "ImmutableFieldNames", expectedExceptions = DcpRuntimeException.class)
    public void testInvalidPatchImmutableFieldChanged(String fieldName) throws Throwable {
      InitializeDeploymentMigrationWorkflowService.State startState =
          buildValidStartState(null, null);
      Operation startOperation =
          testHost.startServiceSynchronously(
              initializeDeploymentMigrationWorkflowService, startState);
      assertThat(startOperation.getStatusCode(), is(200));
      serviceCreated = true;

      InitializeDeploymentMigrationWorkflowService.State patchState =
          buildValidPatchState(
              TaskState.TaskStage.STARTED,
              InitializeDeploymentMigrationWorkflowService.TaskState.SubStage
                  .PAUSE_DESTINATION_SYSTEM);

      Field declaredField = patchState.getClass().getDeclaredField(fieldName);
      if (declaredField.getType() == Integer.class) {
        declaredField.set(patchState, new Integer(0));
      } else if (declaredField.getType() == Set.class) {
        declaredField.set(patchState, new HashSet<>());
      } else {
        declaredField.set(patchState, declaredField.getType().newInstance());
      }

      Operation patchOperation =
          Operation.createPatch(UriUtils.buildUri(testHost, TestHost.SERVICE_URI))
              .setBody(patchState);

      testHost.sendRequestAndWait(patchOperation);
    }
 @Test(dataProvider = "RequiredFieldNames", expectedExceptions = DcpRuntimeException.class)
 public void testInvalidStartStateMissingRequiredField(String fieldName) throws Throwable {
   InitializeDeploymentMigrationWorkflowService.State startState =
       buildValidStartState(null, null);
   startState.getClass().getDeclaredField(fieldName).set(startState, null);
   startService(startState);
 }