private void encode( UIInput year, UIInput month, UIInput day, UIInput hour, UIInput min, LocalDateTime localDateTime) { if (localDateTime == null) { return; } year.setValue(normalize(localDateTime.getYear())); month.setValue(normalize(localDateTime.getMonthOfYear())); day.setValue(normalize(localDateTime.getDayOfMonth())); hour.setValue(normalize(localDateTime.getHourOfDay())); min.setValue(normalize(localDateTime.getMinuteOfHour())); }
@Test public void testMaskHour() { LocalDateTimeMasker masker = LocalDateTimeMasker.newMasker( new LocalDateTime(1970, 1, 1, 0, 0, 0), false, false, false, true, false, false); LocalDateTime v = LocalDateTime.now(); assertThat(masker.mask(null), is(nullValue())); assertThat( masker.mask(v), is( new LocalDateTime( v.getYear(), v.getMonthOfYear(), v.getDayOfMonth(), 0, v.getMinuteOfHour(), v.getSecondOfMinute()))); }