StringAbbrev { public void add(String prefix, String string) { if ( prefix.contains(":") ) throw new IllegalArgumentException("Prefix contains ':' -- "+prefix) ; if ( prefix.equals("") ) throw new IllegalArgumentException("Prefix is the empty string") ; prefix2string.put(prefix, string) ; } StringAbbrev(); void add(String prefix, String string); String abbreviate(String s); String expand(String s);  }
@Test public void abbrev_04() { StringAbbrev abbrev = new StringAbbrev() ; abbrev.add("x", "He") ; test("Hello", ":x:llo", abbrev) ; test("hello", "hello", abbrev) ; test(":hello", ":_:hello", abbrev) ; }