@Test public void testEqualsOverridingNull(){ assertFalse(rootNode.equals(null)); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!this.getClass().isAssignableFrom(obj.getClass())) { return false; } final TreeNode other = (TreeNode) obj; if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) { return false; } if (this.getChildNodes().size() != other.getChildNodes().size()) { return false; } for (int i = 0; i < this.getChildNodes().size(); i++) { if (!this.getChildNode(i).equals(other.getChildNode(i))) { return false; } } return true; }
TreeNode implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!this.getClass().isAssignableFrom(obj.getClass())) { return false; } final TreeNode other = (TreeNode) obj; if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) { return false; } if (this.getChildNodes().size() != other.getChildNodes().size()) { return false; } for (int i = 0; i < this.getChildNodes().size(); i++) { if (!this.getChildNode(i).equals(other.getChildNode(i))) { return false; } } return true; } }
TreeNode implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!this.getClass().isAssignableFrom(obj.getClass())) { return false; } final TreeNode other = (TreeNode) obj; if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) { return false; } if (this.getChildNodes().size() != other.getChildNodes().size()) { return false; } for (int i = 0; i < this.getChildNodes().size(); i++) { if (!this.getChildNode(i).equals(other.getChildNode(i))) { return false; } } return true; } TreeNode(String description); }
TreeNode implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!this.getClass().isAssignableFrom(obj.getClass())) { return false; } final TreeNode other = (TreeNode) obj; if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) { return false; } if (this.getChildNodes().size() != other.getChildNodes().size()) { return false; } for (int i = 0; i < this.getChildNodes().size(); i++) { if (!this.getChildNode(i).equals(other.getChildNode(i))) { return false; } } return true; } TreeNode(String description); String getDescription(); void setDescription(String description); void addChildNode(TreeNode child); TreeNode setChildNode(TreeNode child, int i); TreeNode getChildNode(int i); List<TreeNode> getChildNodes(); void setChildNodes(List<TreeNode> childNodes); TreeNode getParent(); void setParent(TreeNode parent); boolean isRootNode(); void setRootNode(boolean isRootNode); void traverse(TreeNode node); void traverse(); String toString(); boolean hasChildType(Class<? extends TreeNode> clazz); List<T> getChildType(Class<T> clazz); T getChildType(Class<T> clazz, int index); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); }
TreeNode implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!this.getClass().isAssignableFrom(obj.getClass())) { return false; } final TreeNode other = (TreeNode) obj; if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) { return false; } if (this.getChildNodes().size() != other.getChildNodes().size()) { return false; } for (int i = 0; i < this.getChildNodes().size(); i++) { if (!this.getChildNode(i).equals(other.getChildNode(i))) { return false; } } return true; } TreeNode(String description); String getDescription(); void setDescription(String description); void addChildNode(TreeNode child); TreeNode setChildNode(TreeNode child, int i); TreeNode getChildNode(int i); List<TreeNode> getChildNodes(); void setChildNodes(List<TreeNode> childNodes); TreeNode getParent(); void setParent(TreeNode parent); boolean isRootNode(); void setRootNode(boolean isRootNode); void traverse(TreeNode node); void traverse(); String toString(); boolean hasChildType(Class<? extends TreeNode> clazz); List<T> getChildType(Class<T> clazz); T getChildType(Class<T> clazz, int index); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }