TypeCodes { public static int split(String jsonString) { if (jsonString.startsWith(":blobId:")) { return 7; } else if (jsonString.length() >= 4 && jsonString.charAt(3) == ':') { return 3; } else { return -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 testSplit() { assertEquals(3, TypeCodes.split("str:foo")); assertEquals(3, TypeCodes.split("str:")); assertEquals(-1, TypeCodes.split("foo")); assertEquals(-1, TypeCodes.split("")); }