public static ReservationDefinition convertReservationDefinition(
      ReservationDefinitionInfo definitionInfo) {
    if (definitionInfo == null || definitionInfo.getReservationRequests() == null
        || definitionInfo.getReservationRequests().getReservationRequest() == null
        || definitionInfo.getReservationRequests().getReservationRequest().isEmpty()) {
      throw new RuntimeException("definitionInfo Or ReservationRequests is Null.");
    }

    // basic variable
    long arrival = definitionInfo.getArrival();
    long deadline = definitionInfo.getDeadline();

    // ReservationRequests reservationRequests
    String name = definitionInfo.getReservationName();
    String recurrenceExpression = definitionInfo.getRecurrenceExpression();
    Priority priority = Priority.newInstance(definitionInfo.getPriority());

    // reservation requests info
    List<ReservationRequest> reservationRequestList = new ArrayList<>();

    ReservationRequestsInfo reservationRequestsInfo = definitionInfo.getReservationRequests();

    List<ReservationRequestInfo> reservationRequestInfos =
        reservationRequestsInfo.getReservationRequest();

    for (ReservationRequestInfo resRequestInfo : reservationRequestInfos) {
      ResourceInfo resourceInfo = resRequestInfo.getCapability();
      Resource capability =
          Resource.newInstance(resourceInfo.getMemorySize(), resourceInfo.getvCores());
      ReservationRequest reservationRequest = ReservationRequest.newInstance(capability,
          resRequestInfo.getNumContainers(), resRequestInfo.getMinConcurrency(),
          resRequestInfo.getDuration());
      reservationRequestList.add(reservationRequest);
    }

    ReservationRequestInterpreter[] values = ReservationRequestInterpreter.values();
    ReservationRequestInterpreter reservationRequestInterpreter =
        values[reservationRequestsInfo.getReservationRequestsInterpreter()];
    ReservationRequests reservationRequests = ReservationRequests.newInstance(
        reservationRequestList, reservationRequestInterpreter);

    ReservationDefinition definition = ReservationDefinition.newInstance(
        arrival, deadline, reservationRequests, name, recurrenceExpression, priority);

    return definition;
  }
@Test
  public void testConvertReservationDefinitionEmpty() throws Exception {

    // param ReservationDefinitionInfo is Null
    ReservationDefinitionInfo definitionInfo = null;

    // null request1
    LambdaTestUtils.intercept(RuntimeException.class,
        "definitionInfo Or ReservationRequests is Null.",
        () -> RouterServerUtil.convertReservationDefinition(definitionInfo));

    // param ReservationRequests is Null
    ReservationDefinitionInfo definitionInfo2 = new ReservationDefinitionInfo();

    // null request2
    LambdaTestUtils.intercept(RuntimeException.class,
        "definitionInfo Or ReservationRequests is Null.",
        () -> RouterServerUtil.convertReservationDefinition(definitionInfo2));

    // param ReservationRequests is Null
    ReservationDefinitionInfo definitionInfo3 = new ReservationDefinitionInfo();
    ReservationRequestsInfo requestsInfo = new ReservationRequestsInfo();
    definitionInfo3.setReservationRequests(requestsInfo);

    // null request3
    LambdaTestUtils.intercept(RuntimeException.class,
        "definitionInfo Or ReservationRequests is Null.",
        () -> RouterServerUtil.convertReservationDefinition(definitionInfo3));
  }