@Test(
        expectedExceptions = XenonRuntimeException.class,
        dataProvider = "fieldNamesWithMissingValue")
    public void testMissingRequiredStateFieldValue(String fieldName) throws Throwable {
      ContainerService.State startState = TestHelper.getContainerServiceStartState();
      Field declaredField = startState.getClass().getDeclaredField(fieldName);
      declaredField.set(startState, null);

      testHost.startServiceSynchronously(containerService, startState);
    }
    @Test(dataProvider = "ValidStartStates")
    public void testValidStartState(String containerId) throws Throwable {
      ContainerService.State startState = TestHelper.getContainerServiceStartState();
      startState.containerId = containerId;
      Operation startOperation = testHost.startServiceSynchronously(containerService, startState);
      assertThat(startOperation.getStatusCode(), is(200));

      ContainerService.State savedState = testHost.getServiceState(ContainerService.State.class);
      assertThat(savedState.containerTemplateServiceLink, is("CONTAINER_TEMPLATE_SERVICE_LINK"));
      assertThat(savedState.vmServiceLink, is("VM_SERVICE_LINK"));
      assertThat(savedState.containerId, is(containerId));
    }
    @Test(expectedExceptions = XenonRuntimeException.class)
    public void testInvalidPatchStateOverwriteExistingContainerId() throws Throwable {
      ContainerService.State startState = TestHelper.getContainerServiceStartState();
      startState.containerId = "CONTAINER_ID";
      Operation startOperation = testHost.startServiceSynchronously(containerService, startState);
      assertThat(startOperation.getStatusCode(), is(200));

      ContainerService.State patchState = new ContainerService.State();
      patchState.containerId = "CONTAINER_ID";

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

      testHost.sendRequestAndWait(patchOperation);
    }
 private void createContainerService() throws Throwable {
   ContainerService.State startState = TestHelper.getContainerServiceStartState();
   Operation startOperation = testHost.startServiceSynchronously(containerService, startState);
   assertThat(startOperation.getStatusCode(), is(200));
 }