### Question:
DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private  DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime convert2LocalDateTime(Date date); static LocalDate convert2LocalDate(Date date); static long convert2Timestamp(LocalDateTime localDateTime);  }### Answer:
@Test public void shouldBeNull_whenInputLocalDateIsNull_ofConvert2Date() { LocalDate input = null; Date output = DateConverterUtils.convert2Date(input); Date expected = null; assertThat(output).isEqualTo(expected); }
@Test public void shouldBeOk_whenInputLocalDateIs20170101T010101_ofConvert2Date() { LocalDate input = createLocalDate("2017-01-01T01:01:01"); Date output = DateConverterUtils.convert2Date(input); Date expected = createDate("2017-01-01T00:00:00"); assertThat(output).isEqualTo(expected); }
@Test public void shouldBeNull_whenInputLocalDateTimeIsNull_ofConvert2Date() { LocalDateTime input = null; Date output = DateConverterUtils.convert2Date(input); Date expected = null; assertThat(output).isEqualTo(expected); }
@Test public void shouldBeOk_whenInputLocalDateTimeIs20170101T010101_ofConvert2Date() { LocalDateTime input = createLocalDateTime("2017-01-01T01:01:01"); Date output = DateConverterUtils.convert2Date(input); Date expected = createDate("2017-01-01T01:01:01"); assertThat(output).isEqualTo(expected); }