### Question:
QueryElementNode implements Codable { @VisibleForTesting String extractDefaultValue(String tok) { if (regex()) { return tok; } int startDefault = -1; if (tok.startsWith(DEFAULT_NODE)) { startDefault = DEFAULT_NODE.length(); } else if (tok.startsWith(DEFAULT_ATTACHMENT)) { startDefault = DEFAULT_ATTACHMENT.length(); } int endDefault = tok.indexOf(']'); if ((startDefault != -1) && (endDefault != -1)) { int hitsLocation = tok.indexOf('|'); if ((hitsLocation >= 0) && (hitsLocation < endDefault)) { defaultHits = Integer.parseInt(tok.substring(hitsLocation + 1, endDefault)); defaultValue = tok.substring(startDefault, hitsLocation); } else { defaultValue = tok.substring(startDefault, endDefault); } if (tok.startsWith(DEFAULT_NODE)) { tok = "+" + tok.substring(endDefault + 1); } else if (tok.startsWith(DEFAULT_ATTACHMENT)) { tok = "+%" + tok.substring(endDefault + 1); } else { throw new IllegalStateException("Unexpected state in default value extraction"); } } return tok; }  QueryElementNode parse(String tok, MutableInt nextColumn); boolean up(); boolean flat(); String column(); boolean show(); BundleField field(BundleFormat format); boolean regex(); boolean range(); boolean rangeStrict(); boolean not(); Iterator<DataTreeNode> getNodes(LinkedList<DataTreeNode> stack); @FieldConfig(codable = true)
    public String[] match; @FieldConfig(codable = true)
    public String data; @FieldConfig(codable = true)
    public String dataKey; @FieldConfig(codable = true)
    public String defaultValue; @FieldConfig(codable = true)
    public int defaultHits; @FieldConfig(codable = true)
    public Boolean flat; @FieldConfig(codable = true)
    public Boolean regex; @FieldConfig(codable = true)
    public Boolean range; @FieldConfig(codable = true)
    public Boolean rangeStrict; @FieldConfig(codable = true)
    public Boolean not; @FieldConfig(codable = true)
    public String[] path; @FieldConfig(codable = true)
    public Boolean up; }### Answer:
@Test public void extractDefaultValue() { QueryElementNode node = new QueryElementNode(); String output = node.extractDefaultValue("+"); assertEquals("+", output); assertEquals(null, node.defaultValue); assertEquals(0, node.defaultHits); node = new QueryElementNode(); output = node.extractDefaultValue("+[abc]"); assertEquals("+", output); assertEquals("abc", node.defaultValue); assertEquals(0, node.defaultHits); node = new QueryElementNode(); output = node.extractDefaultValue("+%[abc]foo=bar"); assertEquals("+%foo=bar", output); assertEquals("abc", node.defaultValue); assertEquals(0, node.defaultHits); node = new QueryElementNode(); output = node.extractDefaultValue("+[abc]d,e,f"); assertEquals("+d,e,f", output); assertEquals("abc", node.defaultValue); assertEquals(0, node.defaultHits); node = new QueryElementNode(); output = node.extractDefaultValue("+[abc|15]d,e,f"); assertEquals("+d,e,f", output); assertEquals("abc", node.defaultValue); assertEquals(15, node.defaultHits); }