### Question:
ChildPath extends AbstractPath { public boolean isNormalized() { if (child.isSelfReference()) return false; if (!parent.isNormalized()) return false; if (!child.isParentReference()) return true; for (Path.Segment segment : parent) { if (!segment.isParentReference()) return false; } return true; } ChildPath( Path parent,
                      Path.Segment child ); Path getAncestor( int degree ); @Override Segment getLastSegment(); @Override Path getParent(); @Override Segment getSegment( int index ); List<Segment> getSegmentsList(); @Override boolean hasSameAncestor( Path that ); boolean isAbsolute(); @Override boolean isAtOrBelow( Path other ); @Override boolean isDecendantOf( Path ancestor ); boolean isNormalized(); boolean isRoot(); @Override @SuppressWarnings( "synthetic-access" ) Iterator<Segment> iterator(); int size(); @Override Path subpath( int beginIndex,
                         int endIndex );  }### Answer:
@Test public void shouldConsiderAsNormalizedARelativePathWithParentSegmentAtFront() { parent = path("../../a/b/c/d"); path = new ChildPath(parent, segment("e")); assertThat(path.isNormalized(), is(true)); }
@Test public void shouldConsiderAsNormalizedAnAbsolutePathWithParentSegmentAtFront() { parent = path("/../a/b"); path = new ChildPath(parent, segment("c")); assertThat(path.isNormalized(), is(false)); }
@Test public void shouldConsiderAsNormalizedPathWithAllParentReferences() { parent = path("../../../../.."); path = new ChildPath(parent, Path.PARENT_SEGMENT); assertThat(path.isNormalized(), is(true)); }
@Test public void shouldConsiderAsNotNormalizedPathWithMostParentReferencesAndOneNonParentReferenceInMiddle() { parent = path("../../a/b/../.."); path = new ChildPath(parent, Path.PARENT_SEGMENT); assertThat(path.isNormalized(), is(false)); }