Description { public String addTitle(Locale locale,String text){ String ret; if(text == null || text.isEmpty()){ ret = titles.remove(locale); } else { ret = titles.put(locale, text); } return ret; } Description();  Description(DescriptionType dt); @Override boolean equals(Object obj); @Override int hashCode(); String getDefaultTitle(); String getDefaultAbstract(); HashMap<Locale, String> getAbstractTexts(); HashMap<URI,Keywords> getKeywords(); Keywords getKeywords(URI uri); void putKeywords(URI uri, Keywords keys); Keywords removeKeywords(URI uri); HashMap<Locale, String> getTitles(); void setTitles(HashMap<Locale,String> titles); String addTitle(Locale locale,String text); String getTitle(Locale locale); String addAbstract(Locale locale,String text); String getAbstract(Locale locale); void initJAXBType(DescriptionType dt); DescriptionType getJAXBType();  }
@Test public void testAddTitle() throws Exception { Description descr = getDescription(); assertTrue(descr.getTitle(new Locale("en")).equals("Hello")); descr.addTitle(new Locale("en","en"), "Good morning"); assertTrue(descr.getTitle(new Locale("en","en")).equals("Good morning")); assertTrue(descr.getTitle(new Locale("en")).equals("Hello")); }