@Test public void shouldBeAbleToConvert() { when(request.getAttribute("javax.servlet.jsp.jstl.fmt.locale.request")) .thenReturn("pt_br"); assertThat(converter.convert("05/06/2010 3:38", LocalDateTime.class, bundle), is(equalTo(new LocalDateTime(2010, 6, 5, 3, 38)))); }
public LocalDateTime convert(String value, Class<? extends LocalDateTime> type, ResourceBundle bundle) { try { DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortDateTime()); if (out == null) { return null; } return out.toLocalDateTime(); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_datetime"), value)); } }
LocalDateTimeConverter implements Converter<LocalDateTime> { public LocalDateTime convert(String value, Class<? extends LocalDateTime> type, ResourceBundle bundle) { try { DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortDateTime()); if (out == null) { return null; } return out.toLocalDateTime(); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_datetime"), value)); } } }
LocalDateTimeConverter implements Converter<LocalDateTime> { public LocalDateTime convert(String value, Class<? extends LocalDateTime> type, ResourceBundle bundle) { try { DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortDateTime()); if (out == null) { return null; } return out.toLocalDateTime(); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_datetime"), value)); } } LocalDateTimeConverter(Localization localization); }
LocalDateTimeConverter implements Converter<LocalDateTime> { public LocalDateTime convert(String value, Class<? extends LocalDateTime> type, ResourceBundle bundle) { try { DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortDateTime()); if (out == null) { return null; } return out.toLocalDateTime(); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_datetime"), value)); } } LocalDateTimeConverter(Localization localization); LocalDateTime convert(String value, Class<? extends LocalDateTime> type, ResourceBundle bundle); }
LocalDateTimeConverter implements Converter<LocalDateTime> { public LocalDateTime convert(String value, Class<? extends LocalDateTime> type, ResourceBundle bundle) { try { DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortDateTime()); if (out == null) { return null; } return out.toLocalDateTime(); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_datetime"), value)); } } LocalDateTimeConverter(Localization localization); LocalDateTime convert(String value, Class<? extends LocalDateTime> type, ResourceBundle bundle);  }