@Test public void shouldBeAbleToConvert() { when(request.getAttribute("javax.servlet.jsp.jstl.fmt.locale.request")) .thenReturn("pt_br"); assertThat(converter.convert("15:38", LocalTime.class, bundle), is(equalTo(new LocalTime(15, 38)))); }
public LocalTime convert(String value, Class<? extends LocalTime> type, ResourceBundle bundle) { try { DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortTime()); if (out == null) { return null; } return out.toLocalTime(); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_time"), value)); } }
LocalTimeConverter implements Converter<LocalTime> { public LocalTime convert(String value, Class<? extends LocalTime> type, ResourceBundle bundle) { try { DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortTime()); if (out == null) { return null; } return out.toLocalTime(); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_time"), value)); } } }
LocalTimeConverter implements Converter<LocalTime> { public LocalTime convert(String value, Class<? extends LocalTime> type, ResourceBundle bundle) { try { DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortTime()); if (out == null) { return null; } return out.toLocalTime(); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_time"), value)); } } LocalTimeConverter(Localization localization); }
LocalTimeConverter implements Converter<LocalTime> { public LocalTime convert(String value, Class<? extends LocalTime> type, ResourceBundle bundle) { try { DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortTime()); if (out == null) { return null; } return out.toLocalTime(); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_time"), value)); } } LocalTimeConverter(Localization localization); LocalTime convert(String value, Class<? extends LocalTime> type, ResourceBundle bundle); }
LocalTimeConverter implements Converter<LocalTime> { public LocalTime convert(String value, Class<? extends LocalTime> type, ResourceBundle bundle) { try { DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortTime()); if (out == null) { return null; } return out.toLocalTime(); } catch (Exception e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_time"), value)); } } LocalTimeConverter(Localization localization); LocalTime convert(String value, Class<? extends LocalTime> type, ResourceBundle bundle);  }