SimpleTableSegment implements TableSegment, OwnerAvailable { @Override public int getStartIndex() { return null == owner ? tableName.getStartIndex() : owner.getStartIndex(); } SimpleTableSegment(final int startIndex, final int stopIndex, final IdentifierValue identifierValue); @Override int getStartIndex(); @Override int getStopIndex(); @Override Optional<OwnerSegment> getOwner(); @Override Optional<String> getAlias();  }
@Test public void getStartIndexWithoutOwner() { SimpleTableSegment tableSegment = new SimpleTableSegment(10, 13, new IdentifierValue("tbl")); assertThat(tableSegment.getStartIndex(), is(10)); }
@Test public void getStartIndexWithOwner() { SimpleTableSegment tableSegment = new SimpleTableSegment(10, 13, new IdentifierValue("tbl")); tableSegment.setOwner(new OwnerSegment(7, 8, new IdentifierValue("o"))); assertThat(tableSegment.getStartIndex(), is(7)); }