Added class Segment.

Added test class for segment.