NMProtoUtils { public static DockerContainerDeletionTask convertProtoToDockerContainerDeletionTask( DeletionServiceDeleteTaskProto proto, DeletionService deletionService, int taskId) { String user = proto.hasUser() ? proto.getUser() : null; String containerId = proto.hasDockerContainerId() ? proto.getDockerContainerId() : null; return new DockerContainerDeletionTask(taskId, deletionService, user, containerId); } private  NMProtoUtils(); static DeletionTask convertProtoToDeletionTask(
      DeletionServiceDeleteTaskProto proto, DeletionService deletionService); static FileDeletionTask convertProtoToFileDeletionTask(
      DeletionServiceDeleteTaskProto proto, DeletionService deletionService,
      int taskId); static DockerContainerDeletionTask convertProtoToDockerContainerDeletionTask(
      DeletionServiceDeleteTaskProto proto, DeletionService deletionService,
      int taskId); static DeletionTaskRecoveryInfo convertProtoToDeletionTaskRecoveryInfo(
      DeletionServiceDeleteTaskProto proto, DeletionService deletionService);  }
@Test public void testConvertProtoToDockerContainerDeletionTask() throws Exception { DeletionService deletionService = mock(DeletionService.class); int id = 0; String user = "user"; String dockerContainerId = "container_e123_12321231_00001"; DeletionServiceDeleteTaskProto.Builder protoBuilder = DeletionServiceDeleteTaskProto.newBuilder(); protoBuilder .setId(id) .setUser(user) .setDockerContainerId(dockerContainerId); DeletionServiceDeleteTaskProto proto = protoBuilder.build(); DeletionTask deletionTask = NMProtoUtils.convertProtoToDockerContainerDeletionTask(proto, deletionService, id); assertEquals(DeletionTaskType.DOCKER_CONTAINER.name(), deletionTask.getDeletionTaskType().name()); assertEquals(id, deletionTask.getTaskId()); assertEquals(dockerContainerId, ((DockerContainerDeletionTask) deletionTask).getContainerId()); }