TypeCodes { public static String decodeName(int split, String jsonString) { if (split == -1 || split >= jsonString.length()) { return jsonString; } else { return jsonString.substring(split + 1); } } private  TypeCodes(); static String encode(int propertyType, String propertyName); static int split(String jsonString); static int decodeType(int split, String jsonString); static String decodeName(int split, String jsonString); static final String EMPTY_ARRAY; }
@Test public void testDecodeName() { String strFoo = "str:foo"; assertEquals("foo", TypeCodes.decodeName(TypeCodes.split(strFoo), strFoo)); String str = "str:"; assertEquals("", TypeCodes.decodeName(TypeCodes.split(str), str)); String any = "any"; assertEquals("any", TypeCodes.decodeName(TypeCodes.split(any), any)); String empty = ""; assertEquals("", TypeCodes.decodeName(TypeCodes.split(empty), empty)); }