LocationUtils { static public String getContinentCode(String countryCode) { if (null == countryCode) { logger.info("Null country code"); return I18nUtil .getMessage("org.dspace.statistics.util.LocationUtils.unknown-continent"); } if (countryToContinent.isEmpty()) { try { countryToContinent.load(LocationUtils.class .getResourceAsStream("country-continent-codes.properties")); } catch (IOException e) { logger.error("Could not load country/continent map file", e); } } String continent = countryToContinent.getProperty(countryCode); if (null == continent) { logger.info("Unknown country code " + countryCode); return I18nUtil .getMessage("org.dspace.statistics.util.LocationUtils.unknown-continent"); } else { return continent; } } private  LocationUtils(); static String getContinentCode(String countryCode); @Deprecated static String getContinentName(String continentCode); static String getContinentName(String continentCode, Locale locale); @Deprecated static String getCountryName(String countryCode); static String getCountryCode(String countryName); static String getCountryName(String countryCode, Locale locale);  }
@Test public void testGetContinentCode() { assertEquals("NA", LocationUtils.getContinentCode("US")); assertTrue(LocationUtils.getContinentCode(null).length() > 2); assertTrue(LocationUtils.getContinentCode("xyz").length() > 2); }