@Test(expected = IllegalStateException.class) public void testCreateNode_EmptyEdgeNonRoot() throws Exception { new DefaultCharArrayNodeFactory().createNode("", 1, Collections.<Node>emptyList(), false); }
@Override public Node createNode(CharSequence edgeCharacters, Object value, List<Node> childNodes, boolean isRoot) { if (edgeCharacters == null) { throw new IllegalStateException("The edgeCharacters argument was null"); } if (!isRoot && edgeCharacters.length() == 0) { throw new IllegalStateException("Invalid edge characters for non-root node: " + CharSequences.toString(edgeCharacters)); } if (childNodes == null) { throw new IllegalStateException("The childNodes argument was null"); } NodeUtil.ensureNoDuplicateEdges(childNodes); if (childNodes.isEmpty()) { if (value instanceof VoidValue) { return new CharArrayNodeLeafVoidValue(edgeCharacters); } else if (value != null) { return new CharArrayNodeLeafWithValue(edgeCharacters, value); } else { return new CharArrayNodeLeafNullValue(edgeCharacters); } } else { if (value instanceof VoidValue) { return new CharArrayNodeNonLeafVoidValue(edgeCharacters, childNodes); } else if (value == null) { return new CharArrayNodeNonLeafNullValue(edgeCharacters, childNodes); } else { return new CharArrayNodeDefault(edgeCharacters, value, childNodes); } } }
DefaultCharArrayNodeFactory implements NodeFactory { @Override public Node createNode(CharSequence edgeCharacters, Object value, List<Node> childNodes, boolean isRoot) { if (edgeCharacters == null) { throw new IllegalStateException("The edgeCharacters argument was null"); } if (!isRoot && edgeCharacters.length() == 0) { throw new IllegalStateException("Invalid edge characters for non-root node: " + CharSequences.toString(edgeCharacters)); } if (childNodes == null) { throw new IllegalStateException("The childNodes argument was null"); } NodeUtil.ensureNoDuplicateEdges(childNodes); if (childNodes.isEmpty()) { if (value instanceof VoidValue) { return new CharArrayNodeLeafVoidValue(edgeCharacters); } else if (value != null) { return new CharArrayNodeLeafWithValue(edgeCharacters, value); } else { return new CharArrayNodeLeafNullValue(edgeCharacters); } } else { if (value instanceof VoidValue) { return new CharArrayNodeNonLeafVoidValue(edgeCharacters, childNodes); } else if (value == null) { return new CharArrayNodeNonLeafNullValue(edgeCharacters, childNodes); } else { return new CharArrayNodeDefault(edgeCharacters, value, childNodes); } } } }
DefaultCharArrayNodeFactory implements NodeFactory { @Override public Node createNode(CharSequence edgeCharacters, Object value, List<Node> childNodes, boolean isRoot) { if (edgeCharacters == null) { throw new IllegalStateException("The edgeCharacters argument was null"); } if (!isRoot && edgeCharacters.length() == 0) { throw new IllegalStateException("Invalid edge characters for non-root node: " + CharSequences.toString(edgeCharacters)); } if (childNodes == null) { throw new IllegalStateException("The childNodes argument was null"); } NodeUtil.ensureNoDuplicateEdges(childNodes); if (childNodes.isEmpty()) { if (value instanceof VoidValue) { return new CharArrayNodeLeafVoidValue(edgeCharacters); } else if (value != null) { return new CharArrayNodeLeafWithValue(edgeCharacters, value); } else { return new CharArrayNodeLeafNullValue(edgeCharacters); } } else { if (value instanceof VoidValue) { return new CharArrayNodeNonLeafVoidValue(edgeCharacters, childNodes); } else if (value == null) { return new CharArrayNodeNonLeafNullValue(edgeCharacters, childNodes); } else { return new CharArrayNodeDefault(edgeCharacters, value, childNodes); } } }  }
DefaultCharArrayNodeFactory implements NodeFactory { @Override public Node createNode(CharSequence edgeCharacters, Object value, List<Node> childNodes, boolean isRoot) { if (edgeCharacters == null) { throw new IllegalStateException("The edgeCharacters argument was null"); } if (!isRoot && edgeCharacters.length() == 0) { throw new IllegalStateException("Invalid edge characters for non-root node: " + CharSequences.toString(edgeCharacters)); } if (childNodes == null) { throw new IllegalStateException("The childNodes argument was null"); } NodeUtil.ensureNoDuplicateEdges(childNodes); if (childNodes.isEmpty()) { if (value instanceof VoidValue) { return new CharArrayNodeLeafVoidValue(edgeCharacters); } else if (value != null) { return new CharArrayNodeLeafWithValue(edgeCharacters, value); } else { return new CharArrayNodeLeafNullValue(edgeCharacters); } } else { if (value instanceof VoidValue) { return new CharArrayNodeNonLeafVoidValue(edgeCharacters, childNodes); } else if (value == null) { return new CharArrayNodeNonLeafNullValue(edgeCharacters, childNodes); } else { return new CharArrayNodeDefault(edgeCharacters, value, childNodes); } } }  @Override Node createNode(CharSequence edgeCharacters, Object value, List<Node> childNodes, boolean isRoot); }
DefaultCharArrayNodeFactory implements NodeFactory { @Override public Node createNode(CharSequence edgeCharacters, Object value, List<Node> childNodes, boolean isRoot) { if (edgeCharacters == null) { throw new IllegalStateException("The edgeCharacters argument was null"); } if (!isRoot && edgeCharacters.length() == 0) { throw new IllegalStateException("Invalid edge characters for non-root node: " + CharSequences.toString(edgeCharacters)); } if (childNodes == null) { throw new IllegalStateException("The childNodes argument was null"); } NodeUtil.ensureNoDuplicateEdges(childNodes); if (childNodes.isEmpty()) { if (value instanceof VoidValue) { return new CharArrayNodeLeafVoidValue(edgeCharacters); } else if (value != null) { return new CharArrayNodeLeafWithValue(edgeCharacters, value); } else { return new CharArrayNodeLeafNullValue(edgeCharacters); } } else { if (value instanceof VoidValue) { return new CharArrayNodeNonLeafVoidValue(edgeCharacters, childNodes); } else if (value == null) { return new CharArrayNodeNonLeafNullValue(edgeCharacters, childNodes); } else { return new CharArrayNodeDefault(edgeCharacters, value, childNodes); } } }  @Override Node createNode(CharSequence edgeCharacters, Object value, List<Node> childNodes, boolean isRoot);  }