AlterIndexStatementHandler implements SQLStatementHandler { public static Optional<SimpleTableSegment> getSimpleTableSegment(final AlterIndexStatement alterIndexStatement) { if (alterIndexStatement instanceof SQLServerStatement) { return ((SQLServerAlterIndexStatement) alterIndexStatement).getTable(); } return Optional.empty(); }  static Optional<SimpleTableSegment> getSimpleTableSegment(final AlterIndexStatement alterIndexStatement);  }
@Test public void assertGetSimpleTableSegmentWithSimpleTableSegmentForSQLServer() { SQLServerAlterIndexStatement alterIndexStatement = new SQLServerAlterIndexStatement(); alterIndexStatement.setTable(new SimpleTableSegment(0, 0, new IdentifierValue(""))); Optional<SimpleTableSegment> simpleTableSegment = AlterIndexStatementHandler.getSimpleTableSegment(alterIndexStatement); assertTrue(simpleTableSegment.isPresent()); }
@Test public void assertGetSimpleTableSegmentWithoutSimpleTableSegmentForSQLServer() { SQLServerAlterIndexStatement alterIndexStatement = new SQLServerAlterIndexStatement(); Optional<SimpleTableSegment> simpleTableSegment = AlterIndexStatementHandler.getSimpleTableSegment(alterIndexStatement); assertFalse(simpleTableSegment.isPresent()); }