public static Collection<SubquerySegment> getSubquerySegments(final SelectStatement selectStatement) {
        List<SubquerySegment> result = new LinkedList<>();
        extractSubquerySegments(result, selectStatement);
        return result;
    }
@Test
    void assertGetSubquerySegmentsInFrom2() {
        SelectStatement subqueryLeftSelectStatement = mock(SelectStatement.class);
        when(subqueryLeftSelectStatement.getFrom()).thenReturn(Optional.of(new SimpleTableSegment(new TableNameSegment(65, 71, new IdentifierValue("t_order")))));
        ColumnSegment leftColumnSegment = new ColumnSegment(79, 84, new IdentifierValue("status"));
        LiteralExpressionSegment leftLiteralExpressionSegment = new LiteralExpressionSegment(88, 91, "OK");
        BinaryOperationExpression leftStatusCondition = new BinaryOperationExpression(79, 91, leftColumnSegment, leftLiteralExpressionSegment, "=", "status = OK");
        when(subqueryLeftSelectStatement.getWhere()).thenReturn(Optional.of(new WhereSegment(73, 91, leftStatusCondition)));
        ProjectionsSegment subqueryLeftProjections = new ProjectionsSegment(34, 58);
        when(subqueryLeftSelectStatement.getProjections()).thenReturn(subqueryLeftProjections);
        subqueryLeftProjections.getProjections().add(new ColumnProjectionSegment(new ColumnSegment(34, 41, new IdentifierValue("order_id"))));
        subqueryLeftProjections.getProjections().add(new AggregationProjectionSegment(44, 51, AggregationType.COUNT, "COUNT(*)"));
        SelectStatement subqueryRightSelectStatement = mock(SelectStatement.class);
        when(subqueryRightSelectStatement.getFrom()).thenReturn(Optional.of(new SimpleTableSegment(new TableNameSegment(143, 154, new IdentifierValue("t_order_item")))));
        ColumnSegment rightColumnSegment = new ColumnSegment(162, 167, new IdentifierValue("status"));
        LiteralExpressionSegment rightLiteralExpressionSegment = new LiteralExpressionSegment(171, 174, "OK");
        BinaryOperationExpression rightStatusCondition = new BinaryOperationExpression(162, 174, rightColumnSegment, rightLiteralExpressionSegment, "=", "status = OK");
        when(subqueryRightSelectStatement.getWhere()).thenReturn(Optional.of(new WhereSegment(156, 174, rightStatusCondition)));
        ProjectionsSegment subqueryRightProjections = new ProjectionsSegment(112, 136);
        when(subqueryRightSelectStatement.getProjections()).thenReturn(subqueryRightProjections);
        subqueryRightProjections.getProjections().add(new ColumnProjectionSegment(new ColumnSegment(112, 119, new IdentifierValue("order_id"))));
        subqueryRightProjections.getProjections().add(new AggregationProjectionSegment(122, 129, AggregationType.COUNT, "COUNT(*)"));
        SelectStatement selectStatement = mock(SelectStatement.class);
        ProjectionsSegment projections = new ProjectionsSegment(7, 19);
        when(selectStatement.getProjections()).thenReturn(projections);
        projections.getProjections().add(new ColumnProjectionSegment(new ColumnSegment(7, 11, new IdentifierValue("cnt"))));
        projections.getProjections().add(new ColumnProjectionSegment(new ColumnSegment(14, 19, new IdentifierValue("cnt"))));
        JoinTableSegment from = new JoinTableSegment();
        from.setStartIndex(26);
        from.setStopIndex(213);
        ColumnSegment columnSegment1 = new ColumnSegment(190, 199, new IdentifierValue("order_id"));
        ColumnSegment columnSegment2 = new ColumnSegment(203, 213, new IdentifierValue("order_id"));
        BinaryOperationExpression orderIdCondition = new BinaryOperationExpression(190, 213, columnSegment1, columnSegment2, "=", "o.order_id = oi.order_id");
        from.setCondition(orderIdCondition);
        SubqueryTableSegment leftSubquerySegment = new SubqueryTableSegment(0, 0, new SubquerySegment(26, 92, subqueryLeftSelectStatement, ""));
        SubqueryTableSegment rightSubquerySegment = new SubqueryTableSegment(0, 0, new SubquerySegment(104, 175, subqueryRightSelectStatement, ""));
        from.setLeft(leftSubquerySegment);
        from.setRight(rightSubquerySegment);
        when(selectStatement.getFrom()).thenReturn(Optional.of(from));
        Collection<SubquerySegment> actual = SubqueryExtractUtils.getSubquerySegments(selectStatement);
        assertThat(actual.size(), is(2));
        Iterator<SubquerySegment> iterator = actual.iterator();
        assertThat(iterator.next(), is(leftSubquerySegment.getSubquery()));
        assertThat(iterator.next(), is(rightSubquerySegment.getSubquery()));
    }