@Test public void testFromDMNString() { final String input = "some dmn string"; final String value = "some value without prefix and suffix"; final String date = "date"; final String time = "time"; final String expectedTime = "expectedTime"; final String expectedDate = "expectedDate"; doReturn(value).when(converter).removePrefixAndSuffix(input); doReturn(date).when(converter).extractDate(value); doReturn(time).when(converter).extractTime(value); when(dateValueFormatter.addPrefixAndSuffix(date)).thenReturn(expectedDate); when(timeValueFormatter.appendPrefixAndSuffix(time)).thenReturn(expectedTime); final DateTimeValue actual = converter.fromDMNString(input); assertEquals(expectedDate, actual.getDate()); assertEquals(expectedTime, actual.getTime()); }
public DateTimeValue fromDMNString(final String dmnString) { final String value = removePrefixAndSuffix(dmnString); final String date = extractDate(value); final String time = extractTime(value); final DateTimeValue dateTimeValue = new DateTimeValue(); dateTimeValue.setDate(dateValueFormatter.addPrefixAndSuffix(date)); if (!StringUtils.isEmpty(time)) { dateTimeValue.setTime(timeValueFormatter.appendPrefixAndSuffix(time)); } return dateTimeValue; }
DateTimeValueConverter { public DateTimeValue fromDMNString(final String dmnString) { final String value = removePrefixAndSuffix(dmnString); final String date = extractDate(value); final String time = extractTime(value); final DateTimeValue dateTimeValue = new DateTimeValue(); dateTimeValue.setDate(dateValueFormatter.addPrefixAndSuffix(date)); if (!StringUtils.isEmpty(time)) { dateTimeValue.setTime(timeValueFormatter.appendPrefixAndSuffix(time)); } return dateTimeValue; } }
DateTimeValueConverter { public DateTimeValue fromDMNString(final String dmnString) { final String value = removePrefixAndSuffix(dmnString); final String date = extractDate(value); final String time = extractTime(value); final DateTimeValue dateTimeValue = new DateTimeValue(); dateTimeValue.setDate(dateValueFormatter.addPrefixAndSuffix(date)); if (!StringUtils.isEmpty(time)) { dateTimeValue.setTime(timeValueFormatter.appendPrefixAndSuffix(time)); } return dateTimeValue; } @Inject  DateTimeValueConverter(final DateValueFormatter dateValueFormatter,
                                  final TimeValueFormatter timeValueFormatter); }
DateTimeValueConverter { public DateTimeValue fromDMNString(final String dmnString) { final String value = removePrefixAndSuffix(dmnString); final String date = extractDate(value); final String time = extractTime(value); final DateTimeValue dateTimeValue = new DateTimeValue(); dateTimeValue.setDate(dateValueFormatter.addPrefixAndSuffix(date)); if (!StringUtils.isEmpty(time)) { dateTimeValue.setTime(timeValueFormatter.appendPrefixAndSuffix(time)); } return dateTimeValue; } @Inject  DateTimeValueConverter(final DateValueFormatter dateValueFormatter,
                                  final TimeValueFormatter timeValueFormatter); String toDMNString(final DateTimeValue value); DateTimeValue fromDMNString(final String dmnString); String toDisplay(final String rawValue); }
DateTimeValueConverter { public DateTimeValue fromDMNString(final String dmnString) { final String value = removePrefixAndSuffix(dmnString); final String date = extractDate(value); final String time = extractTime(value); final DateTimeValue dateTimeValue = new DateTimeValue(); dateTimeValue.setDate(dateValueFormatter.addPrefixAndSuffix(date)); if (!StringUtils.isEmpty(time)) { dateTimeValue.setTime(timeValueFormatter.appendPrefixAndSuffix(time)); } return dateTimeValue; } @Inject  DateTimeValueConverter(final DateValueFormatter dateValueFormatter,
                                  final TimeValueFormatter timeValueFormatter); String toDMNString(final DateTimeValue value); DateTimeValue fromDMNString(final String dmnString); String toDisplay(final String rawValue);  }