@Test public void testParseNoValue() { Map<String, Long> data = sut2.parse("p"); assertNull(data); }
public Map<String, Long> parse(final String tokenContent) { Map<String, Long> data = new HashMap<String, Long>(); String toParse = new String(tokenContent); int len = toParse.length(); int pos = 0; while (pos < len) { int startTag = pos; while (pos < len && Character.isLetter(toParse.charAt(pos))) { pos++; } int startValue = pos; while (pos < len && Character.isDigit(toParse.charAt(pos))) { pos++; } if (startTag == startValue || startValue == pos) { log.error("Error parsing token content - key or value empty."); return null; } String tag = toParse.substring(startTag, startValue); long value = Long.parseLong(toParse.substring(startValue, pos)); data.put(tag, value); } return data; }
TokenContentFormatter { public Map<String, Long> parse(final String tokenContent) { Map<String, Long> data = new HashMap<String, Long>(); String toParse = new String(tokenContent); int len = toParse.length(); int pos = 0; while (pos < len) { int startTag = pos; while (pos < len && Character.isLetter(toParse.charAt(pos))) { pos++; } int startValue = pos; while (pos < len && Character.isDigit(toParse.charAt(pos))) { pos++; } if (startTag == startValue || startValue == pos) { log.error("Error parsing token content - key or value empty."); return null; } String tag = toParse.substring(startTag, startValue); long value = Long.parseLong(toParse.substring(startValue, pos)); data.put(tag, value); } return data; } }
TokenContentFormatter { public Map<String, Long> parse(final String tokenContent) { Map<String, Long> data = new HashMap<String, Long>(); String toParse = new String(tokenContent); int len = toParse.length(); int pos = 0; while (pos < len) { int startTag = pos; while (pos < len && Character.isLetter(toParse.charAt(pos))) { pos++; } int startValue = pos; while (pos < len && Character.isDigit(toParse.charAt(pos))) { pos++; } if (startTag == startValue || startValue == pos) { log.error("Error parsing token content - key or value empty."); return null; } String tag = toParse.substring(startTag, startValue); long value = Long.parseLong(toParse.substring(startValue, pos)); data.put(tag, value); } return data; }  }
TokenContentFormatter { public Map<String, Long> parse(final String tokenContent) { Map<String, Long> data = new HashMap<String, Long>(); String toParse = new String(tokenContent); int len = toParse.length(); int pos = 0; while (pos < len) { int startTag = pos; while (pos < len && Character.isLetter(toParse.charAt(pos))) { pos++; } int startValue = pos; while (pos < len && Character.isDigit(toParse.charAt(pos))) { pos++; } if (startTag == startValue || startValue == pos) { log.error("Error parsing token content - key or value empty."); return null; } String tag = toParse.substring(startTag, startValue); long value = Long.parseLong(toParse.substring(startValue, pos)); data.put(tag, value); } return data; }  String buildForStream(final EntityType streamEntityType, final long streamEntityId); String buildForActivity(final long activityId); String build(final Map<String, Long> data); Map<String, Long> parse(final String tokenContent); }
TokenContentFormatter { public Map<String, Long> parse(final String tokenContent) { Map<String, Long> data = new HashMap<String, Long>(); String toParse = new String(tokenContent); int len = toParse.length(); int pos = 0; while (pos < len) { int startTag = pos; while (pos < len && Character.isLetter(toParse.charAt(pos))) { pos++; } int startValue = pos; while (pos < len && Character.isDigit(toParse.charAt(pos))) { pos++; } if (startTag == startValue || startValue == pos) { log.error("Error parsing token content - key or value empty."); return null; } String tag = toParse.substring(startTag, startValue); long value = Long.parseLong(toParse.substring(startValue, pos)); data.put(tag, value); } return data; }  String buildForStream(final EntityType streamEntityType, final long streamEntityId); String buildForActivity(final long activityId); String build(final Map<String, Long> data); Map<String, Long> parse(final String tokenContent); static final String META_KEY_ACTOR; static final String META_KEY_PERSON_STREAM; static final String META_KEY_GROUP_STREAM; static final String META_KEY_ACTIVITY; }