AssetPathAndTextUnitNameKeys { public Key parse(String string) { String[] split = string.split(DELIMITER, 2); if (split.length != 2) { throw new IllegalArgumentException("must contain delimter #@#"); } return new Key(split[0], split[1]); }  String toKey(String assetPath, String textUnitName); Key parse(String string);  }
@Test public void parse() { AssetPathAndTextUnitNameKeys assetPathAndTextUnitNameKeys = new AssetPathAndTextUnitNameKeys(); AssetPathAndTextUnitNameKeys.Key parse = assetPathAndTextUnitNameKeys.parse("a2#@#t2"); assertEquals("a2", parse.getAssetPath()); assertEquals("t2", parse.getTextUnitName()); }
@Test(expected = IllegalArgumentException.class) public void parseInvalid() { AssetPathAndTextUnitNameKeys assetPathAndTextUnitNameKeys = new AssetPathAndTextUnitNameKeys(); AssetPathAndTextUnitNameKeys.Key parse = assetPathAndTextUnitNameKeys.parse("a2invalid"); }