@Test
 public void testPrepareVmGetMksTicketInvalidVmState() throws Throwable {
   try {
     vmDcpBackend.prepareVmGetMksTicket(vmId);
   } catch (InvalidVmStateException e) {
     assertThat(
         e.getMessage(), is("Get Mks Ticket is not allowed on vm that is not powered on."));
   }
 }
    @Test
    public void testPrepareVmGetMksTicket() throws Throwable {
      vmDcpBackend.updateState(vmDcpBackend.findById(vmId), VmState.STARTED);
      TaskEntity task = vmDcpBackend.prepareVmGetMksTicket(vmId);

      assertThat(task, is(notNullValue()));
      assertThat(task.getState(), is(TaskEntity.State.QUEUED));
      assertThat(task.getSteps().size(), is(1));
      assertThat(
          task.getSteps().get(0).getOperation(),
          is(com.vmware.photon.controller.api.Operation.GET_MKS_TICKET));
    }