@Override public final boolean equals(Object other) { if (other == null) { return false; } if (this.getClass() != other.getClass()) { return false; } TestDescriptor otherDescriptor = (TestDescriptor) other; return this.getUniqueId().equals(otherDescriptor.getUniqueId()); }
@Override public Optional<? extends TestDescriptor> findByUniqueId(String uniqueId) { if (getUniqueId().equals(uniqueId)) { return Optional.of(this); } for (TestDescriptor child : this.children) { Optional<? extends TestDescriptor> result = child.findByUniqueId(uniqueId); if (result.isPresent()) { return result; } } return Optional.empty(); }
@Override public void addChild(TestDescriptor child) { Preconditions.notNull(child, "child must not be null"); child.setParent(this); this.children.add(child); }
@Override public void removeChild(TestDescriptor child) { this.children.remove(child); child.setParent(null); }
private TestIdentifier getTestIdentifier(TestDescriptor testDescriptor) { return testPlan.getTestIdentifier(new TestId(testDescriptor.getUniqueId())); }