Example usage for org.apache.commons.lang3.time DateUtils addDays

List of usage examples for org.apache.commons.lang3.time DateUtils addDays

Introduction

In this page you can find the example usage for org.apache.commons.lang3.time DateUtils addDays.

Prototype

public static Date addDays(final Date date, final int amount) 

Source Link

Document

Adds a number of days to a date returning a new object.

Usage

From source file:gov.va.isaac.gui.preferences.plugins.ViewCoordinatePreferencesPluginViewController.java

public static Date getStartOfNextDay(Date date) {
    return getStartOfDay(DateUtils.addDays(date, 1));
}

From source file:gov.va.isaac.gui.preferences.plugins.ViewCoordinatePreferencesPluginViewController.java

public static Date getPriorDay(Date date) {
    return DateUtils.addDays(date, -1);
}

From source file:alfio.manager.EventManagerIntegrationTest.java

@Test
public void testNewBoundedCategoryWithExistingBoundedAndPendingTicket() {
    List<TicketCategoryModification> categories = Collections.singletonList(new TicketCategoryModification(null,
            "default", AVAILABLE_SEATS, new DateTimeModification(LocalDate.now(), LocalTime.now()),
            new DateTimeModification(LocalDate.now(), LocalTime.now()), DESCRIPTION, BigDecimal.TEN, false, "",
            false, null, null, null, null, null));
    Pair<Event, String> pair = initEvent(categories, organizationRepository, userManager, eventManager,
            eventRepository);/*from   w  w  w .  j  a  v a 2  s . c om*/
    Event event = pair.getLeft();
    String username = pair.getRight();
    assertEquals(new Integer(AVAILABLE_SEATS), ticketRepository.countFreeTicketsForUnbounded(event.getId()));
    TicketReservationModification trm = new TicketReservationModification();
    trm.setAmount(1);
    trm.setTicketCategoryId(ticketCategoryRepository.findByEventId(event.getId()).get(0).getId());
    TicketReservationWithOptionalCodeModification reservation = new TicketReservationWithOptionalCodeModification(
            trm, Optional.empty());
    ticketReservationManager.createTicketReservation(event, Collections.singletonList(reservation),
            Collections.emptyList(), DateUtils.addDays(new Date(), 1), Optional.empty(), Optional.empty(),
            Locale.ENGLISH, false);
    TicketCategoryModification tcm = new TicketCategoryModification(null, "new", 1,
            DateTimeModification.fromZonedDateTime(ZonedDateTime.now()),
            DateTimeModification.fromZonedDateTime(ZonedDateTime.now().plusDays(1)), Collections.emptyMap(),
            BigDecimal.TEN, false, "", true, null, null, null, null, null);
    Result<Integer> insertResult = eventManager.insertCategory(event, tcm, username);
    assertTrue(insertResult.isSuccess());
    Integer categoryID = insertResult.getData();
    tcm = new TicketCategoryModification(categoryID, tcm.getName(), AVAILABLE_SEATS, tcm.getInception(),
            tcm.getExpiration(), tcm.getDescription(), tcm.getPrice(), false, "", true, null, null, null, null,
            null);
    Result<TicketCategory> result = eventManager.updateCategory(categoryID, event, tcm, username);
    assertFalse(result.isSuccess());
}

From source file:com.silverpeas.gallery.dao.MediaDaoTest.java

@Test
public void saveExistingPhoto() throws Exception {
    performDAOTest(new DAOTest() {
        @Override//w  ww . j  av a 2s  . com
        public void test(final Connection connection) throws Exception {
            Date now = DateUtil.getNow();
            Date endVisibilityDate = DateUtils.addMonths(now, 4);
            Date beginDownloadDate = DateUtils.addDays(now, -10);

            IDataSet actualDataSet = getActualDataSet();
            ITable mediaTable = actualDataSet.getTable("SC_Gallery_Media");
            assertThat(mediaTable.getRowCount(), is(MEDIA_ROW_COUNT));
            ITable internalTable = actualDataSet.getTable("SC_Gallery_Internal");
            assertThat(internalTable.getRowCount(), is(MEDIA_INTERNAL_ROW_COUNT));
            ITable photoTable = actualDataSet.getTable("SC_Gallery_Photo");
            assertThat(photoTable.getRowCount(), is(MEDIA_PHOTO_ROW_COUNT));
            ITable videoTable = actualDataSet.getTable("SC_Gallery_Video");
            assertThat(videoTable.getRowCount(), is(MEDIA_VIDEO_ROW_COUNT));
            ITable soundTable = actualDataSet.getTable("SC_Gallery_Sound");
            assertThat(soundTable.getRowCount(), is(MEDIA_SOUND_ROW_COUNT));
            ITable streamingTable = actualDataSet.getTable("SC_Gallery_Streaming");
            assertThat(streamingTable.getRowCount(), is(MEDIA_STREAMING_ROW_COUNT));
            ITable pathTable = actualDataSet.getTable("SC_Gallery_Path");
            assertThat(pathTable.getRowCount(), is(MEDIA_PATH_ROW_COUNT));

            String mediaIdToUpdate = "2";

            TableRow mediaRow = getTableRowFor(mediaTable, "mediaId", mediaIdToUpdate);
            assertThat(mediaRow.getString("mediaId"), is(mediaIdToUpdate));
            assertThat(mediaRow.getString("mediaType"), is(MediaType.Photo.name()));
            assertThat(mediaRow.getString("instanceId"), is(INSTANCE_A));
            assertThat(mediaRow.getString("title"), is("title 2"));
            assertThat(mediaRow.getValue("description"), nullValue());
            assertThat(mediaRow.getValue("author"), nullValue());
            assertThat(mediaRow.getValue("keyword"), nullValue());
            assertThat(mediaRow.getLong("beginVisibilityDate"), is(DateUtil.MINIMUM_DATE.getTime()));
            assertThat(mediaRow.getLong("endVisibilityDate"), is(DateUtil.MAXIMUM_DATE.getTime()));
            assertThat(mediaRow.getDate("createDate"), is(CREATE_DATE));
            assertThat(mediaRow.getString("createdBy"), is("0"));
            assertThat(mediaRow.getDate("lastUpdateDate"), is(CREATE_DATE));
            assertThat(mediaRow.getString("lastUpdatedBy"), is("0"));

            TableRow iMediaRow = getTableRowFor(internalTable, "mediaId", mediaIdToUpdate);
            assertThat(iMediaRow.getString("mediaId"), is(mediaIdToUpdate));
            assertThat(iMediaRow.getString("fileName"), is("fileName_2"));
            assertThat(iMediaRow.getLong("fileSize"), is(102L));
            assertThat(iMediaRow.getString("fileMimeType"), is("image/png"));
            assertThat(iMediaRow.getInteger("download"), is(0));
            assertThat(iMediaRow.getValue("beginDownloadDate"), nullValue());
            assertThat(iMediaRow.getValue("endDownloadDate"), nullValue());

            TableRow photoRow = getTableRowFor(photoTable, "mediaId", mediaIdToUpdate);
            assertThat(photoRow.getString("mediaId"), is(mediaIdToUpdate));
            assertThat(photoRow.getInteger("resolutionH"), is(600));
            assertThat(photoRow.getInteger("resolutionW"), is(800));

            Photo photoToUpdate = MediaDAO
                    .getByCriteria(connection, defaultMediaCriteria().identifierIsOneOf(mediaIdToUpdate))
                    .getPhoto();

            photoToUpdate.setTitle(photoToUpdate.getTitle() + "_updated");
            photoToUpdate.setKeyWord("keywords_updated");
            photoToUpdate.setVisibilityPeriod(Period.from(DateUtil.MINIMUM_DATE, endVisibilityDate));

            photoToUpdate.setFileName(photoToUpdate.getFileName() + "_updated");
            photoToUpdate.setFileSize(2048);
            photoToUpdate.setFileMimeType(MediaMimeType.TIFF);
            photoToUpdate.setDownloadAuthorized(true);
            photoToUpdate.setDownloadPeriod(Period.from(beginDownloadDate, DateUtil.MAXIMUM_DATE));

            photoToUpdate.setDefinition(Definition.of(200, 100));

            String savedMediaId = photoToUpdate.getId();
            String mediaId = MediaDAO.saveMedia(connection, OperationContext.fromUser(publisherUser),
                    photoToUpdate);
            assertThat(mediaId, is(savedMediaId));
            assertThat(mediaId, is(photoToUpdate.getId()));

            actualDataSet = getActualDataSet();
            mediaTable = actualDataSet.getTable("SC_Gallery_Media");
            assertThat(mediaTable.getRowCount(), is(MEDIA_ROW_COUNT));
            internalTable = actualDataSet.getTable("SC_Gallery_Internal");
            assertThat(internalTable.getRowCount(), is(MEDIA_INTERNAL_ROW_COUNT));
            photoTable = actualDataSet.getTable("SC_Gallery_Photo");
            assertThat(photoTable.getRowCount(), is(MEDIA_PHOTO_ROW_COUNT));
            videoTable = actualDataSet.getTable("SC_Gallery_Video");
            assertThat(videoTable.getRowCount(), is(MEDIA_VIDEO_ROW_COUNT));
            soundTable = actualDataSet.getTable("SC_Gallery_Sound");
            assertThat(soundTable.getRowCount(), is(MEDIA_SOUND_ROW_COUNT));
            streamingTable = actualDataSet.getTable("SC_Gallery_Streaming");
            assertThat(streamingTable.getRowCount(), is(MEDIA_STREAMING_ROW_COUNT));
            pathTable = actualDataSet.getTable("SC_Gallery_Path");
            assertThat(pathTable.getRowCount(), is(MEDIA_PATH_ROW_COUNT));

            mediaRow = getTableRowFor(mediaTable, "mediaId", mediaIdToUpdate);
            assertThat(mediaRow.getString("mediaId"), is(mediaIdToUpdate));
            assertThat(mediaRow.getString("mediaType"), is(MediaType.Photo.name()));
            assertThat(mediaRow.getString("instanceId"), is(INSTANCE_A));
            assertThat(mediaRow.getString("title"), is("title 2_updated"));
            assertThat(mediaRow.getString("description"), isEmptyString());
            assertThat(mediaRow.getString("author"), isEmptyString());
            assertThat(mediaRow.getString("keyword"), is("keywords_updated"));
            assertThat(mediaRow.getLong("beginVisibilityDate"), is(DateUtil.MINIMUM_DATE.getTime()));
            assertThat(mediaRow.getLong("endVisibilityDate"), is(endVisibilityDate.getTime()));
            assertThat(mediaRow.getDate("createDate"), is(CREATE_DATE));
            assertThat(mediaRow.getString("createdBy"), is("0"));
            assertThat(mediaRow.getDate("lastUpdateDate"), greaterThanOrEqualTo(now));
            assertThat(mediaRow.getString("lastUpdatedBy"), is(publisherUser.getId()));

            iMediaRow = getTableRowFor(internalTable, "mediaId", mediaIdToUpdate);
            assertThat(iMediaRow.getString("mediaId"), is(mediaIdToUpdate));
            assertThat(iMediaRow.getString("fileName"), is("fileName_2_updated"));
            assertThat(iMediaRow.getLong("fileSize"), is(2048L));
            assertThat(iMediaRow.getString("fileMimeType"), is("image/tiff"));
            assertThat(iMediaRow.getInteger("download"), is(1));
            assertThat(iMediaRow.getLong("beginDownloadDate"), is(beginDownloadDate.getTime()));
            assertThat(iMediaRow.getValue("endDownloadDate"), nullValue());

            photoRow = getTableRowFor(photoTable, "mediaId", mediaIdToUpdate);
            assertThat(photoRow.getString("mediaId"), is(mediaIdToUpdate));
            assertThat(photoRow.getInteger("resolutionH"), is(100));
            assertThat(photoRow.getInteger("resolutionW"), is(200));
        }
    });
}

From source file:com.silverpeas.gallery.dao.MediaDaoTest.java

@Test
public void saveNewVideo() throws Exception {
    performDAOTest(new DAOTest() {
        @Override/*from  w  w w.  j a v  a 2  s .  c  o  m*/
        public void test(final Connection connection) throws Exception {
            Date now = DateUtil.getNow();
            Date beginVisibilityDate = DateUtils.addMonths(now, -1);
            Date endDownloadDate = DateUtils.addDays(now, 5);

            Video newVideo = new Video();

            newVideo.setComponentInstanceId(INSTANCE_A);
            newVideo.setTitle("A video title");
            newVideo.setAuthor("A video author");
            newVideo.setKeyWord("video keywords");
            newVideo.setVisibilityPeriod(Period.from(beginVisibilityDate, DateUtil.MAXIMUM_DATE));

            newVideo.setFileName("new video file name");
            newVideo.setFileSize(2048);
            newVideo.setFileMimeType(MediaMimeType.MP4);
            newVideo.setDownloadAuthorized(false);
            newVideo.setDownloadPeriod(Period.from(DateUtil.MINIMUM_DATE, endDownloadDate));

            newVideo.setDefinition(Definition.of(1920, 1080));

            assertThat(newVideo.getId(), nullValue());
            String newId = MediaDAO.saveMedia(connection, OperationContext.fromUser(writerUser), newVideo);
            assertThat(newVideo.getId(), notNullValue());
            assertThat(newVideo.getId(), is(newId));

            IDataSet actualDataSet = getActualDataSet();
            ITable mediaTable = actualDataSet.getTable("SC_Gallery_Media");
            assertThat(mediaTable.getRowCount(), is(MEDIA_ROW_COUNT + 1));
            ITable internalTable = actualDataSet.getTable("SC_Gallery_Internal");
            assertThat(internalTable.getRowCount(), is(MEDIA_INTERNAL_ROW_COUNT + 1));
            ITable photoTable = actualDataSet.getTable("SC_Gallery_Photo");
            assertThat(photoTable.getRowCount(), is(MEDIA_PHOTO_ROW_COUNT));
            ITable videoTable = actualDataSet.getTable("SC_Gallery_Video");
            assertThat(videoTable.getRowCount(), is(MEDIA_VIDEO_ROW_COUNT + 1));
            ITable soundTable = actualDataSet.getTable("SC_Gallery_Sound");
            assertThat(soundTable.getRowCount(), is(MEDIA_SOUND_ROW_COUNT));
            ITable streamingTable = actualDataSet.getTable("SC_Gallery_Streaming");
            assertThat(streamingTable.getRowCount(), is(MEDIA_STREAMING_ROW_COUNT));
            ITable pathTable = actualDataSet.getTable("SC_Gallery_Path");
            assertThat(pathTable.getRowCount(), is(MEDIA_PATH_ROW_COUNT));

            TableRow mediaRow = getTableRowFor(mediaTable, "mediaId", newVideo.getId());
            assertThat(mediaRow.getString("mediaId"), is(newId));
            assertThat(mediaRow.getString("mediaType"), is(MediaType.Video.name()));
            assertThat(mediaRow.getString("instanceId"), is(INSTANCE_A));
            assertThat(mediaRow.getString("title"), is("A video title"));
            assertThat(mediaRow.getString("description"), isEmptyString());
            assertThat(mediaRow.getString("author"), is("A video author"));
            assertThat(mediaRow.getString("keyword"), is("video keywords"));
            assertThat(mediaRow.getLong("beginVisibilityDate"), is(beginVisibilityDate.getTime()));
            assertThat(mediaRow.getLong("endVisibilityDate"), is(DateUtil.MAXIMUM_DATE.getTime()));
            assertThat(mediaRow.getDate("createDate"), greaterThanOrEqualTo(now));
            assertThat(mediaRow.getString("createdBy"), is(writerUser.getId()));
            assertThat(mediaRow.getDate("lastUpdateDate"), is(mediaRow.getDate("createDate")));
            assertThat(mediaRow.getString("lastUpdatedBy"), is(writerUser.getId()));

            TableRow iMediaRow = getTableRowFor(internalTable, "mediaId", newVideo.getId());
            assertThat(iMediaRow.getString("mediaId"), is(newId));
            assertThat(iMediaRow.getString("fileName"), is("new video file name"));
            assertThat(iMediaRow.getLong("fileSize"), is(2048L));
            assertThat(iMediaRow.getString("fileMimeType"), is("video/mp4"));
            assertThat(iMediaRow.getInteger("download"), is(0));
            assertThat(iMediaRow.getLong("beginDownloadDate"), nullValue());
            assertThat(iMediaRow.getLong("endDownloadDate"), is(endDownloadDate.getTime()));

            TableRow videoRow = getTableRowFor(videoTable, "mediaId", newVideo.getId());
            assertThat(videoRow.getString("mediaId"), is(newId));
            assertThat(videoRow.getInteger("resolutionH"), is(1080));
            assertThat(videoRow.getInteger("resolutionW"), is(1920));
            assertThat(videoRow.getLong("bitrate"), is(0L));
            assertThat(videoRow.getLong("duration"), is(0L));
        }
    });
}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/cashPay.do", method = RequestMethod.POST)
public String cashPay( //? 
        HttpServletRequest request,//  w ww  .  j  a va2 s. co  m

        @RequestParam("dType") String o_type, //
        @RequestParam("pPricee") int o_price, // ?
        @RequestParam("o_name") String o_name, //??
        @RequestParam("o_phone") String o_phone, //? 
        @RequestParam("o_adress") String o_adress, //? 
        @RequestParam("o_orderMessage") String o_omessage, //
        @RequestParam("o_delivMessage") String o_dmessage, //
        @RequestParam("useCash") int useCash, // ?
        @RequestParam("cashSum") int cashSum, //? ?
        Model model, SessionStatus status) throws Exception {

    if (o_omessage.isEmpty()) {
        o_omessage = "";
    }
    if (o_dmessage.isEmpty()) {
        o_dmessage = "";
    }

    //System.out.println("1"+ o_type+"2"+ o_price+"3"+o_name +"4"+o_phone +"5"+ o_adress+"6"+ o_omessage+"7"+o_dmessage +"8"+useCash );
    ///// ?//
    Date orderDate = DateUtils.addDays(new Date(), 0);
    orderDate = DateUtils.addSeconds(orderDate, 0);
    Format sdf = FastDateFormat.getInstance("yyyyMMddhhmmss", Locale.getDefault());
    String orderDates = sdf.format(orderDate);

    String code = "";
    for (int i = 1; i <= 4; i++) {
        char ch = (char) ((Math.random() * 26) + 65);
        code = ch + code;
    }
    String orderCode = orderDates + code;
    //System.out.println("-"+orderCode);
    ////////////////////////////////////////////////////
    OrderResult or = new OrderResult(o_omessage, o_dmessage, o_name, o_phone, o_adress, orderCode, o_price,
            useCash);

    model.addAttribute("orderList", or);

    HttpSession hs = request.getSession();
    Account loginInfo = (Account) hs.getAttribute("userInfo");

    Account acc = new Account();
    model.addAttribute("myCash", loginInfo.getA_cash());
    //? ? (? -  ? +? ?)
    //       loginInfo.getA_cash() -   useCash +     cashSum        
    //int resultCash = (loginInfo.getA_cash() - useCash) +cashSum;
    int resultCash = (loginInfo.getA_cash() - useCash);
    acc.setA_cash(resultCash);
    acc.setA_id(loginInfo.getA_id());

    sampleService.useCash(acc);
    status.setComplete();
    System.out.println("? ");

    KartVO kart = new KartVO();
    kart.setK_id(loginInfo.getA_id());
    List<KartVO> kartList = sampleService.kartList(kart);

    String ol_name = kartList.get(0).getK_name();
    model.addAttribute("resultList", kartList);
    for (int i = 0; i < kartList.size(); i++) {
        int pSeq = kartList.get(i).getK_seq();
        int pEa = kartList.get(i).getK_ea();
        String pname = kartList.get(i).getK_name();
        //System.out.println(pname);

        // ?

        //TODO  ? ?(??   )
        Product product = new Product();
        product.setP_seq(pSeq);
        Product product2 = sampleService.selectProduct(product);
        int proEa = product2.getP_ea();
        int setEa = proEa - pEa;
        product.setP_ea(setEa);
        sampleService.updateEa(product);
        ///?

        OrderSeetVO orderVO = new OrderSeetVO(orderCode, loginInfo.getA_id(), o_type, o_name, o_phone, o_adress,
                o_omessage, o_dmessage, pname, pEa, o_price, pSeq);
        sampleService.orderSeet(orderVO);
        status.setComplete();
        System.out.println(i + " ? ?");
        if (i == kartList.size() - 1) {
            ol_name = ol_name + " " + i + "";
        }
    }

    //?
    OrderSeetListVO oslVO = new OrderSeetListVO(orderCode, loginInfo.getA_id(), " ", ol_name,
            o_omessage, o_dmessage, o_price);
    sampleService.orderSeetList(oslVO);
    System.out.println("? ?");
    //       

    sampleService.allDeleteKart(kart);
    status.setComplete();
    System.out.println(" ");

    ////? refresh  ?  /////////
    Account ac = new Account();
    ac.setA_id(loginInfo.getA_id());

    Account ac2 = sampleService.getAccount(ac);

    hs.setAttribute("userInfo", ac2);
    //      hs.setMaxInactiveInterval(1*60*60);

    //////////////////////////////////////////////   

    model.addAttribute("login", "loginOK.jsp");
    model.addAttribute("main", "orderResult.jsp");

    return "sample/home";

}

From source file:com.virtusa.isq.vtaf.runtime.SeleniumTestBase.java

/**
 * Gets the date.//from w w w  .ja  va 2s . c  o m
 * 
 * @param format
 *            the format
 * @param skipWeekend
 *            the skip weekend
 * @param day
 *            the day
 * @return the date
 */
private String getDate(final String format, final boolean skipWeekend, final int day) {

    DateFormat dateFormat = new SimpleDateFormat(format);
    Date date = null;

    if (skipWeekend) {
        final int five = 5;
        final int two = 2;
        final int seven = 7;
        int days = day;
        days = ((days / five) * two) + days;
        date = DateUtils.addDays(Calendar.getInstance().getTime(), days);
        Calendar myCal = new GregorianCalendar();
        myCal.setTime(date);
        if (myCal.get(Calendar.DAY_OF_WEEK) == seven) {
            date = DateUtils.addDays(date, 2);
        } else if (myCal.get(Calendar.DAY_OF_WEEK) == 1) {
            date = DateUtils.addDays(date, 1);
        }
    } else {
        date = DateUtils.addDays(Calendar.getInstance().getTime(), day);
    }
    return dateFormat.format(date);

}

From source file:org.apache.marmotta.ldclient.model.ClientResponse.java

@Deprecated
public ClientResponse(int httpStatus, Repository triples) {
    this.expires = DateUtils.addDays(new Date(), DEFAULT_EXPIRATION_IN_DAYS);
    this.httpStatus = httpStatus;

    try {//from w  w  w  .j ava  2s  . c o m
        this.data = ModelCommons.asModel(triples);
    } catch (RepositoryException e) {
        this.data = new TreeModel();
    }
}

From source file:org.apache.marmotta.ldclient.model.ClientResponse.java

public ClientResponse(int httpStatus, Model triples) {
    this.data = triples;
    this.expires = DateUtils.addDays(new Date(), DEFAULT_EXPIRATION_IN_DAYS);
    this.httpStatus = httpStatus;
}

From source file:org.bonitasoft.engine.process.ProcessExecutionIT.java

@Test
public void should_update_and_sort_due_date_with_null_values() throws Exception {
    //given//from ww  w.j a va 2s  .  co m
    final ProcessDefinitionBuilder builder = new ProcessDefinitionBuilder()
            .createNewInstance("processWithNullDueDate", "7.4");
    builder.addActor(ACTOR_NAME);
    builder.addUserTask("step1", ACTOR_NAME).addExpectedDuration(3600L);
    final ProcessDefinition processDefinition = deployAndEnableProcessWithActor(builder.done(), ACTOR_NAME,
            user);
    final ProcessInstance processInstance1 = getProcessAPI().startProcess(processDefinition.getId());
    final ProcessInstance processInstance2 = getProcessAPI().startProcess(processDefinition.getId());
    final ProcessInstance processInstance3 = getProcessAPI().startProcess(processDefinition.getId());
    final UserTaskInstance todayTask = (UserTaskInstance) waitForUserTaskAndAssignIt(processInstance1, "step1",
            user);
    final UserTaskInstance nextWeekTask = (UserTaskInstance) waitForUserTaskAndAssignIt(processInstance2,
            "step1", user);
    final UserTaskInstance nullDueDate = (UserTaskInstance) waitForUserTaskAndAssignIt(processInstance3,
            "step1", user);

    //when
    getProcessAPI().updateDueDateOfTask(nullDueDate.getId(), null);
    final Date nextWeekDueDate = DateUtils.addDays(nextWeekTask.getExpectedEndDate(), 7);
    getProcessAPI().updateDueDateOfTask(nextWeekTask.getId(), nextWeekDueDate);

    //new business logic for sort to be used in portal
    final SearchResult<HumanTaskInstance> ascNullsLast = getHumanTaskInstanceSearchResult(Order.ASC_NULLS_LAST);
    final SearchResult<HumanTaskInstance> descNullsFirst = getHumanTaskInstanceSearchResult(
            Order.DESC_NULLS_FIRST);

    //not required by business logic but tested to verify orderBy sql keyword are valid SQL
    final SearchResult<HumanTaskInstance> ascNullsFirst = getHumanTaskInstanceSearchResult(
            Order.ASC_NULLS_FIRST);
    final SearchResult<HumanTaskInstance> descNullsLast = getHumanTaskInstanceSearchResult(
            Order.DESC_NULLS_LAST);

    //then
    assertThat(ascNullsLast.getResult()).extracting("id").as("should have null as last value")
            .containsExactly(todayTask.getId(), nextWeekTask.getId(), nullDueDate.getId());
    assertThat(ascNullsFirst.getResult()).extracting("id").as("should have null as first value")
            .containsExactly(nullDueDate.getId(), todayTask.getId(), nextWeekTask.getId());
    assertThat(descNullsFirst.getResult()).extracting("id").as("should have null as first value")
            .containsExactly(nullDueDate.getId(), nextWeekTask.getId(), todayTask.getId());
    assertThat(descNullsLast.getResult()).extracting("id").as("should have null as first value")
            .containsExactly(nextWeekTask.getId(), todayTask.getId(), nullDueDate.getId());

    assertThat(getProcessAPI().getHumanTaskInstance(nullDueDate.getId()).getExpectedEndDate())
            .as("should have updated expected date to null").isNull();
    assertThat(getProcessAPI().getHumanTaskInstance(nextWeekTask.getId()).getExpectedEndDate())
            .as("should have updated expected date to next week").isEqualTo(nextWeekDueDate);

    disableAndDeleteProcess(processDefinition);
}