@SuppressWarnings("unchecked") @Test public void testGetDefinition() { DefinitionDAO<Locale> dao = createMock(DefinitionDAO.class); LocaleResolver localeResolver = createMock(LocaleResolver.class); UnresolvingLocaleDefinitionsFactory factory = new UnresolvingLocaleDefinitionsFactory(); Request request = createMock(Request.class); Definition definition = createMock(Definition.class); Locale locale = Locale.ITALY; expect(localeResolver.resolveLocale(request)).andReturn(locale); expect(dao.getDefinition("myDefinition", locale)).andReturn(definition); replay(dao, localeResolver, request, definition); factory.setDefinitionDAO(dao); factory.setLocaleResolver(localeResolver); assertEquals(definition, factory.getDefinition("myDefinition", request)); verify(dao, localeResolver, request, definition); }
public Definition getDefinition(String name, Request tilesContext) { Locale locale = null; if (tilesContext != null) { locale = localeResolver.resolveLocale(tilesContext); } return definitionDao.getDefinition(name, locale); }
UnresolvingLocaleDefinitionsFactory implements DefinitionsFactory { public Definition getDefinition(String name, Request tilesContext) { Locale locale = null; if (tilesContext != null) { locale = localeResolver.resolveLocale(tilesContext); } return definitionDao.getDefinition(name, locale); } }
UnresolvingLocaleDefinitionsFactory implements DefinitionsFactory { public Definition getDefinition(String name, Request tilesContext) { Locale locale = null; if (tilesContext != null) { locale = localeResolver.resolveLocale(tilesContext); } return definitionDao.getDefinition(name, locale); }  }
UnresolvingLocaleDefinitionsFactory implements DefinitionsFactory { public Definition getDefinition(String name, Request tilesContext) { Locale locale = null; if (tilesContext != null) { locale = localeResolver.resolveLocale(tilesContext); } return definitionDao.getDefinition(name, locale); }  void setLocaleResolver(LocaleResolver localeResolver); void setDefinitionDAO(DefinitionDAO<Locale> definitionDao); Definition getDefinition(String name,
            Request tilesContext); }
UnresolvingLocaleDefinitionsFactory implements DefinitionsFactory { public Definition getDefinition(String name, Request tilesContext) { Locale locale = null; if (tilesContext != null) { locale = localeResolver.resolveLocale(tilesContext); } return definitionDao.getDefinition(name, locale); }  void setLocaleResolver(LocaleResolver localeResolver); void setDefinitionDAO(DefinitionDAO<Locale> definitionDao); Definition getDefinition(String name,
            Request tilesContext);  }