@Test public void testGetByLocaleCodeEmpty() { Locale locale = dao.getByLocaleCode(LocaleCode.FR); assertThat(locale).isNull(); }
public @Nullable Locale getByLocaleCode(LocaleCode localeCode) { @SuppressWarnings("unchecked") List<Locale> locales = getEntityManager() .createQuery("from Locale where lower(localeCode) = :localeCode") .setParameter("localeCode", localeCode) .getResultList(); return locales.isEmpty() ? null : locales.get(0); }
LocaleDAO extends AbstractDAO<Locale> { public @Nullable Locale getByLocaleCode(LocaleCode localeCode) { @SuppressWarnings("unchecked") List<Locale> locales = getEntityManager() .createQuery("from Locale where lower(localeCode) = :localeCode") .setParameter("localeCode", localeCode) .getResultList(); return locales.isEmpty() ? null : locales.get(0); } }
LocaleDAO extends AbstractDAO<Locale> { public @Nullable Locale getByLocaleCode(LocaleCode localeCode) { @SuppressWarnings("unchecked") List<Locale> locales = getEntityManager() .createQuery("from Locale where lower(localeCode) = :localeCode") .setParameter("localeCode", localeCode) .getResultList(); return locales.isEmpty() ? null : locales.get(0); } @SuppressWarnings("unused")  LocaleDAO(); @VisibleForTesting  LocaleDAO(EntityManager entityManager); }
LocaleDAO extends AbstractDAO<Locale> { public @Nullable Locale getByLocaleCode(LocaleCode localeCode) { @SuppressWarnings("unchecked") List<Locale> locales = getEntityManager() .createQuery("from Locale where lower(localeCode) = :localeCode") .setParameter("localeCode", localeCode) .getResultList(); return locales.isEmpty() ? null : locales.get(0); } @SuppressWarnings("unused")  LocaleDAO(); @VisibleForTesting  LocaleDAO(EntityManager entityManager); @Nullable Locale getByLocaleCode(LocaleCode localeCode); Locale getOrCreateByLocaleCode(LocaleCode localeCode); List<Locale> getSupportedLocales(); }
LocaleDAO extends AbstractDAO<Locale> { public @Nullable Locale getByLocaleCode(LocaleCode localeCode) { @SuppressWarnings("unchecked") List<Locale> locales = getEntityManager() .createQuery("from Locale where lower(localeCode) = :localeCode") .setParameter("localeCode", localeCode) .getResultList(); return locales.isEmpty() ? null : locales.get(0); } @SuppressWarnings("unused")  LocaleDAO(); @VisibleForTesting  LocaleDAO(EntityManager entityManager); @Nullable Locale getByLocaleCode(LocaleCode localeCode); Locale getOrCreateByLocaleCode(LocaleCode localeCode); List<Locale> getSupportedLocales();  }