FunctionImpl extends AbstractProcedureImpl implements Function { @Override public StatementOption[] getCustomOptions( final UnitOfWork transaction ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); final StatementOption[] superOptions = super.getCustomOptions( transaction ); StatementOption[] result = StatementOption.NO_OPTIONS; if ( superOptions.length != 0 ) { final List< StatementOption > temp = new ArrayList<>( superOptions.length ); for ( final StatementOption option : superOptions ) { if ( !isStandardOption( option.getName( transaction ) ) ) { temp.add( option ); } } if ( !temp.isEmpty() ) { result = temp.toArray( new StatementOption[ temp.size() ] ); } } return result; } protected  FunctionImpl( final UnitOfWork uow,
                            final Repository repository,
                            final String workspacePath ); @Override StatementOption[] getCustomOptions( final UnitOfWork transaction ); @Override Determinism getDeterminism( final UnitOfWork transaction ); @Override Map< String, String > getStandardOptions(); @Override boolean isAggregate( final UnitOfWork transaction ); @Override boolean isAllowsDistinct( final UnitOfWork transaction ); @Override boolean isAllowsOrderBy( final UnitOfWork transaction ); @Override boolean isAnalytic( final UnitOfWork transaction ); @Override boolean isDecomposable( final UnitOfWork transaction ); @Override boolean isNullOnNull( final UnitOfWork transaction ); @Override boolean isStandardOption( final String name ); @Override boolean isUsesDistinctRows( final UnitOfWork transaction ); @Override boolean isVarArgs( final UnitOfWork transaction ); @Override void setAggregate( final UnitOfWork transaction,
                              final boolean newAggregate ); @Override void setAllowsDistinct( final UnitOfWork transaction,
                                   final boolean newAllowsDistinct ); @Override void setAllowsOrderBy( final UnitOfWork transaction,
                                  final boolean newAllowsOrderBy ); @Override void setAnalytic( final UnitOfWork transaction,
                             final boolean newIsAnalytic ); @Override void setDecomposable( final UnitOfWork transaction,
                                 final boolean newDecomposable ); @Override void setDeterminism( final UnitOfWork transaction,
                                final Determinism newDeterminism ); @Override void setNullOnNull( final UnitOfWork transaction,
                               final boolean newNullOnNull ); @Override void setUsesDistinctRows( final UnitOfWork transaction,
                                     final boolean newUsesDistinctRows ); @Override void setVarArgs( final UnitOfWork transaction,
                            final boolean newVarArgs );  }
@Test public void shouldObtainCustomOptions() throws Exception { final String sledge = "sledge"; this.function.setStatementOption( getTransaction(), sledge, "hammer" ); final String elvis = "elvis"; this.function.setStatementOption( getTransaction(), elvis, "presley" ); assertThat( this.function.getCustomOptions( getTransaction() ).length, is( 2 ) ); assertThat( Arrays.asList( this.function.getStatementOptionNames( getTransaction() ) ), hasItems( sledge, elvis ) ); }