KillTaskRequest killTaskRequest = recordFactory.newRecordInstance(
KillTaskRequest.class);
killTaskRequest.setTaskId(task.getID());
try {
client.killTask(killTaskRequest);
fail("viewonlyuser killed task");
} catch (YarnRemoteException e) {
Assert.assertTrue(e.getMessage().contains("User viewonlyuser cannot"));
}