LanguageUtils { public static LocalizableContent<String> addDescriptions(Node configuration, String tagName, Language defaultLanguage, LocalizableContent<String> o, boolean escape) { XPath xpath = XPathFactory.newInstance().newXPath(); return addDescriptions(configuration, tagName, defaultLanguage, o, escape, xpath); } private  LanguageUtils(); static Language getLanguage(Locale locale); static Language getLanguage(String languageCode); static LocalizableContent<String> addDescriptions(Node configuration,
      String tagName, Language defaultLanguage, LocalizableContent<String> o,
      boolean escape); static LocalizableContent<String> addDescriptions(Node configuration,
      String tagName, Language defaultLanguage, LocalizableContent<String> o,
      boolean escape, XPath xpath); static String getLanguageVariant(String s, Language language); static String[] getLanguageVariants(String s, Language... languages); static String getBaseVersion(String s); static Language extractLanguage(String s); static Language getPreferredLanguage(Set<Language> choices,
      HttpServletRequest request); static Language getPreferredLanguage(Localizable localizable,
      HttpServletRequest request, Site site); static Language getPreferredContentLanguage(Resource<?> resource,
      HttpServletRequest request, Site site); static Language getPreferredLanguage(HttpServletRequest request,
      Site site); static Language getPreferredLanguage(Localizable localizable,
      Language... languages); static Language getPreferredContentLanguage(Resource<?> resource,
      Language... languages);  }
@Test public void testAddDescriptions() { LocalizableContent<String> names = null; Node xml = null; try { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); URL testContext = this.getClass().getResource("/localizable.xml"); Document doc = docBuilder.parse(testContext.openStream()); xml = doc.getFirstChild(); } catch (ParserConfigurationException e) { fail(e.getMessage()); } catch (SAXException e) { fail(e.getMessage()); } catch (IOException e) { fail(e.getMessage()); } names = LanguageUtils.addDescriptions(xml, "name", french, null, false); assertEquals(2, names.size()); assertTrue(names.supportsLanguage(english)); assertTrue(names.supportsLanguage(french)); assertEquals(french, names.getDefaultLanguage()); names = LanguageUtils.addDescriptions(xml, "name", italian, null, false); assertEquals(2, names.size()); assertNull(names.getDefaultLanguage()); }