src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsBoolean(Integer index,
        Matcher<? super Boolean> matcher) {
    return ParameterHolderAssertions.paramAsBoolean(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramNames(
        Matcher<? super Collection<String>> collectionMatcher) {
    return ParameterHolderAssertions.paramNames(collectionMatcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryHolder> queryType(QueryType expectedType) {
    return QueryHolderAssertions.queryType(expectedType);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> batchPreparedCount(int count) {
    return ProxyTestDataSourceAssertions.batchPreparedCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> selectCount(int count) {
    return ProxyTestDataSourceAssertions.selectCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> param(String name, Matcher<Object> matcher) {
    return ParameterHolderAssertions.param(name, matcher);

}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsByte(Integer index,
        Matcher<? super Byte> matcher) {
    return ParameterHolderAssertions.paramAsByte(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> deleteCount(int count) {
    return ProxyTestDataSourceAssertions.deleteCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryHolder> query(Matcher<String> stringMatcher) {
    return QueryHolderAssertions.query(stringMatcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super BatchParameterHolder> batchSize(int batchSize) {
    return BatchParameterHolderAssertions.batchSize(batchSize);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> isPrepared() {
    return prepared();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> isBatchPrepared() {
    return batchPrepared();
}
src/main/java/net/ttddyy/dsproxy/asserts/QueryExecution.java
public interface QueryExecution {

    boolean isSuccess();

    boolean isBatch();

}
src/main/java/net/ttddyy/dsproxy/asserts/ProxyTestDataSource.java
public class ProxyTestDataSource extends ProxyDataSource {

    private QueryExecutionFactoryListener queryExecutionFactoryListener = new QueryExecutionFactoryListener();


    public ProxyTestDataSource() {
        initialize();
    }

    public ProxyTestDataSource(DataSource dataSource) {
        super(dataSource);
        initialize();
    }

    private void initialize() {
        this.getProxyConfig().getQueryListener().addListener(this.queryExecutionFactoryListener);
    }

    public void reset() {
        this.queryExecutionFactoryListener.reset();
    }

    public List<StatementExecution> getStatements() {
        return getQueryExecutionsFilteredBy(StatementExecution.class);
    }

    public StatementExecution getFirstStatement() {
        return getFirstQueryExecution(StatementExecution.class);
    }

    public StatementExecution getLastStatement() {
        return getLastQueryExecution(StatementExecution.class);
    }

    public List<StatementBatchExecution> getBatchStatements() {
        return getQueryExecutionsFilteredBy(StatementBatchExecution.class);
    }

    public StatementBatchExecution getFirstBatchStatement() {
        return getFirstQueryExecution(StatementBatchExecution.class);
    }

    public StatementBatchExecution getLastBatchStatement() {
        return getLastQueryExecution(StatementBatchExecution.class);
    }

    public List<PreparedExecution> getPrepareds() {
        return getQueryExecutionsFilteredBy(PreparedExecution.class);
    }

    public PreparedExecution getFirstPrepared() {
        return getFirstQueryExecution(PreparedExecution.class);
    }

    public PreparedExecution getLastPrepared() {
        return getLastQueryExecution(PreparedExecution.class);
    }

    public List<PreparedBatchExecution> getBatchPrepareds() {
        return getQueryExecutionsFilteredBy(PreparedBatchExecution.class);
    }

    public PreparedBatchExecution getFirstBatchPrepared() {
        return getFirstQueryExecution(PreparedBatchExecution.class);
    }

    public PreparedBatchExecution getLastBatchPrepared() {
        return getLastQueryExecution(PreparedBatchExecution.class);
    }

    public List<CallableExecution> getCallables() {
        return getQueryExecutionsFilteredBy(CallableExecution.class);
    }

    public CallableExecution getFirstCallable() {
        return getFirstQueryExecution(CallableExecution.class);
    }

    public CallableExecution getLastCallable() {
        return getLastQueryExecution(CallableExecution.class);
    }

    public List<CallableBatchExecution> getBatchCallables() {
        return getQueryExecutionsFilteredBy(CallableBatchExecution.class);
    }

    public CallableBatchExecution getFirstBatchCallable() {
        return getFirstQueryExecution(CallableBatchExecution.class);
    }

    public CallableBatchExecution getLastBatchCallable() {
        return getLastQueryExecution(CallableBatchExecution.class);
    }


    @SuppressWarnings("unchecked")
    private <T extends QueryExecution> List<T> getQueryExecutionsFilteredBy(Class<T> classToFilter) {
        List<T> result = new ArrayList<>();
        for (QueryExecution queryExecution : getQueryExecutions()) {
            if (classToFilter.isAssignableFrom(queryExecution.getClass())) {
                result.add((T) queryExecution);
            }
        }
        return result;
    }

    private <T extends QueryExecution> T getFirstQueryExecution(Class<T> classToFilter) {
        List<T> filtered = getQueryExecutionsFilteredBy(classToFilter);
        if (filtered.isEmpty()) {
            return null;
        }
        return filtered.get(0);
    }

    private <T extends QueryExecution> T getLastQueryExecution(Class<T> classToFilter) {
        List<T> filtered = getQueryExecutionsFilteredBy(classToFilter);
        if (filtered.isEmpty()) {
            return null;
        }
        return filtered.get(filtered.size() - 1);
    }

    public List<QueryExecution> getQueryExecutions() {
        return this.queryExecutionFactoryListener.getQueryExecutions();
    }

    public QueryExecutionFactoryListener getQueryExecutionFactoryListener() {
        return this.queryExecutionFactoryListener;
    }
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryHolder> select() {
    return QueryHolderAssertions.select();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsShort(Integer index,
        Matcher<? super Short> matcher) {
    return ParameterHolderAssertions.paramAsShort(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> isBatchStatement() {
    return batchStatement();
}
src/main/java/net/ttddyy/dsproxy/asserts/PreparedBatchExecution.java
public class PreparedBatchExecution extends BaseQueryExecution implements QueryHolder, BatchParameterHolder, BatchExecution {

    private String query;
    private List<BatchExecutionEntry> batchExecutionEntries = new ArrayList<>();

    @Override
    public boolean isBatch() {
        return true;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    @Override
    public String getQuery() {
        return this.query;
    }

    @Override
    public List<BatchExecutionEntry> getBatchExecutionEntries() {
        return this.batchExecutionEntries;
    }

    public boolean addBatchExecutionEntry(PreparedBatchExecutionEntry entry) {
        return this.batchExecutionEntries.add(entry);
    }

    @SuppressWarnings("unchecked")
    public List<PreparedBatchExecutionEntry> getPrepareds() {

        return (List<PreparedBatchExecutionEntry>) (List<?>) this.batchExecutionEntries;
    }

}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramsByName(
        Matcher<Map<? extends String, ?>> mapMatcher) {
    return ParameterHolderAssertions.paramsByName(mapMatcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsArray(Integer index,
        Matcher<? super Array> matcher) {
    return ParameterHolderAssertions.paramAsArray(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> batchPrepared() {
    return QueryExecutionAssertions.batchPrepared();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> nullParam(int index, int sqlType) {
    return ParameterHolderAssertions.nullParam(index, sqlType);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> statementOrBatchStatementCount(int count) {
    return ProxyTestDataSourceAssertions.statementOrBatchStatementCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> batchStatementCount(int count) {
    return ProxyTestDataSourceAssertions.batchStatementCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> outParam(String paramName, int sqlType) {
    return OutParameterHolderAssertions.outParam(paramName, sqlType);
}
src/main/java/net/ttddyy/dsproxy/asserts/PreparedExecution.java
public class PreparedExecution extends BaseQueryExecution implements QueryHolder, ParameterByIndexHolder {

    private String query;
    private SortedSet<ParameterKeyValue> parameters = new TreeSet<>();

    @Override
    public boolean isBatch() {
        return false;
    }

    @Override
    public String getQuery() {
        return this.query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    @Override
    public SortedSet<ParameterKeyValue> getAllParameters() {
        return this.parameters;
    }

    @Override
    public SortedSet<ParameterKeyValue> getSetParams() {
        return filterBy(this.parameters, ParameterKeyValue.OperationType.SET_PARAM);
    }

    @Override
    public SortedSet<ParameterKeyValue> getSetNullParams() {
        return filterBy(this.parameters, ParameterKeyValue.OperationType.SET_NULL);
    }

    @Override
    public Map<Integer, Object> getSetParamsByIndex() {
        return toKeyIndexMap(filterByKeyType(getSetParams(), ParameterKey.ParameterKeyType.BY_INDEX));
    }

    @Override
    public Map<Integer, Integer> getSetNullParamsByIndex() {
        return toKeyIndexMap(filterByKeyType(getSetNullParams(), ParameterKey.ParameterKeyType.BY_INDEX));
    }

    @Override
    public List<Integer> getParamIndexes() {
        List<Integer> indexes = new ArrayList<>();
        indexes.addAll(getSetParamsByIndex().keySet());
        indexes.addAll(getSetNullParamsByIndex().keySet());
        return indexes;
    }

}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> callableCount(int count) {
    return ProxyTestDataSourceAssertions.callableCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/StatementExecution.java
public class StatementExecution extends BaseQueryExecution implements QueryHolder {

    private String query;

    @Override
    public boolean isBatch() {
        return false;
    }

    @Override
    public String getQuery() {
        return this.query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramIndexes(
        Matcher<? super Collection<Integer>> collectionMatcher) {
    return ParameterHolderAssertions.paramIndexes(collectionMatcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> preparedOrBatchPrepared() {
    return QueryExecutionAssertions.preparedOrBatchPrepared();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> batchCallableCount(int count) {
    return ProxyTestDataSourceAssertions.batchCallableCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> outParamNames(
        Matcher<? super Collection<String>> collectionMatcher) {
    return OutParameterHolderAssertions.outParamNames(collectionMatcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> callableOrBatchCallable() {
    return QueryExecutionAssertions.callableOrBatchCallable();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsLong(Integer index,
        Matcher<? super Long> matcher) {
    return ParameterHolderAssertions.paramAsLong(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<QueryExecution> success() {
    return QueryExecutionAssertions.success();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsTime(Integer index,
        Matcher<? super Time> matcher) {
    return ParameterHolderAssertions.paramAsTime(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> outParamIndexes(
        Matcher<? super Collection<Integer>> collectionMatcher) {
    return OutParameterHolderAssertions.outParamIndexes(collectionMatcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsBytes(Integer index,
        Matcher<? super byte[]> matcher) {
    return ParameterHolderAssertions.paramAsBytes(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> isPreparedOrBatchPrepared() {
    return preparedOrBatchPrepared();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsTimestamp(Integer index,
        Matcher<? super Timestamp> matcher) {
    return ParameterHolderAssertions.paramAsTimestamp(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueriesHolder> queryTypes(int index,
        Matcher<? super QueryHolder> queryHolderMatcher) {
    return QueriesHolderAssertions.queryTypes(index, queryHolderMatcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> executionCount(int count) {
    return ProxyTestDataSourceAssertions.executionCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<QueryExecution> failure() {
    return QueryExecutionAssertions.failure();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> isStatementOrBatchStatement() {
    return statementOrBatchStatement();
}
src/main/java/net/ttddyy/dsproxy/asserts/StatementBatchExecution.java
public class StatementBatchExecution extends BaseQueryExecution implements QueriesHolder, BatchExecution {

    private List<String> queries = new ArrayList<>();

    @Override
    public boolean isBatch() {
        return true;
    }

    @Override
    public List<String> getQueries() {
        return this.queries;
    }

    public void setQueries(List<String> queries) {
        this.queries = queries;
    }

}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> preparedCount(int count) {
    return ProxyTestDataSourceAssertions.preparedCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> isCallable() {
    return callable();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> isBatch() {
    return batch();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> statementOrBatchStatement() {
    return QueryExecutionAssertions.statementOrBatchStatement();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> preparedOrBatchPreparedCount(int count) {
    return ProxyTestDataSourceAssertions.preparedOrBatchPreparedCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> prepared() {
    return QueryExecutionAssertions.prepared();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> isStatement() {
    return statement();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> otherCount(int count) {
    return ProxyTestDataSourceAssertions.otherCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> batchCallable() {
    return QueryExecutionAssertions.batchCallable();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsFloat(Integer index,
        Matcher<? super Float> matcher) {
    return ParameterHolderAssertions.paramAsFloat(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> callableOrBatchCallableCount(int count) {
    return ProxyTestDataSourceAssertions.callableOrBatchCallableCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryHolder> update() {
    return QueryHolderAssertions.update();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryHolder> insert() {
    return QueryHolderAssertions.insert();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsBigDecimal(Integer index,
        Matcher<? super BigDecimal> matcher) {
    return ParameterHolderAssertions.paramAsBigDecimal(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/CallableExecution.java
public class CallableExecution extends BaseQueryExecution implements QueryHolder, ParameterByIndexHolder, ParameterByNameHolder, OutParameterHolder {

    private String query;
    private SortedSet<ParameterKeyValue> parameters = new TreeSet<>();


    @Override
    public boolean isBatch() {
        return false;
    }

    @Override
    public String getQuery() {
        return this.query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    @Override
    public SortedSet<ParameterKeyValue> getAllParameters() {
        return this.parameters;
    }

    @Override
    public SortedSet<ParameterKeyValue> getSetParams() {
        return filterBy(this.parameters, ParameterKeyValue.OperationType.SET_PARAM);
    }

    @Override
    public SortedSet<ParameterKeyValue> getSetNullParams() {
        return filterBy(this.parameters, ParameterKeyValue.OperationType.SET_NULL);
    }

    @Override
    public SortedSet<ParameterKeyValue> getOutParams() {
        return filterBy(this.parameters, ParameterKeyValue.OperationType.REGISTER_OUT);
    }

    @Override
    public Map<String, Object> getSetParamsByName() {
        return toKeyNameMap(filterByKeyType(getSetParams(), ParameterKey.ParameterKeyType.BY_NAME));
    }

    @Override
    public Map<Integer, Object> getSetParamsByIndex() {
        return toKeyIndexMap(filterByKeyType(getSetParams(), ParameterKey.ParameterKeyType.BY_INDEX));
    }

    @Override
    public Map<String, Integer> getSetNullParamsByName() {
        return toKeyNameMap(filterByKeyType(getSetNullParams(), ParameterKey.ParameterKeyType.BY_NAME));
    }

    @Override
    public Map<Integer, Integer> getSetNullParamsByIndex() {
        return toKeyIndexMap(filterByKeyType(getSetNullParams(), ParameterKey.ParameterKeyType.BY_INDEX));
    }

    @Override
    public Map<String, Object> getOutParamsByName() {
        return toKeyNameMap(filterByKeyType(getOutParams(), ParameterKey.ParameterKeyType.BY_NAME));
    }

    @Override
    public Map<Integer, Object> getOutParamsByIndex() {
        return toKeyIndexMap(filterByKeyType(getOutParams(), ParameterKey.ParameterKeyType.BY_INDEX));
    }

    @Override
    public List<String> getParamNames() {
        List<String> names = new ArrayList<>();
        names.addAll(getSetParamsByName().keySet());
        names.addAll(getSetNullParamsByName().keySet());
        return names;
    }

    @Override
    public List<Integer> getParamIndexes() {
        List<Integer> indexes = new ArrayList<>();
        indexes.addAll(getSetParamsByIndex().keySet());
        indexes.addAll(getSetNullParamsByIndex().keySet());
        return indexes;
    }

    @Override
    public List<String> getOutParamNames() {
        return new ArrayList<>(getOutParamsByName().keySet());
    }

    @Override
    public List<Integer> getOutParamIndexes() {
        return new ArrayList<>(getOutParamsByIndex().keySet());
    }

}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> isCallableOrBatchCallable() {
    return callableOrBatchCallable();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsDouble(Integer index,
        Matcher<? super Double> matcher) {
    return ParameterHolderAssertions.paramAsDouble(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/CallableBatchExecution.java
public class CallableBatchExecution extends BaseQueryExecution implements BatchParameterHolder, QueryHolder, BatchExecution {

    private String query;

    private List<BatchExecutionEntry> batchExecutionEntries = new ArrayList<>();

    @Override
    public boolean isBatch() {
        return true;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    @Override
    public String getQuery() {
        return this.query;
    }

    @Override
    public List<BatchExecutionEntry> getBatchExecutionEntries() {
        return this.batchExecutionEntries;
    }

    public boolean addBatchExecutionEntry(CallableBatchExecutionEntry entry) {
        return this.batchExecutionEntries.add(entry);
    }

}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueriesHolder> queries(int index, Matcher<String> stringMatcher) {
    return QueriesHolderAssertions.queries(index, stringMatcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> executions(int index,
        Matcher<? super QueryExecution> queryExecutionMatcher) {
    return ProxyTestDataSourceAssertions.executions(index, queryExecutionMatcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsDate(Integer index,
        Matcher<? super Date> matcher) {
    return ParameterHolderAssertions.paramAsDate(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramAsInteger(Integer index,
        Matcher<? super Integer> matcher) {
    return ParameterHolderAssertions.paramAsInteger(index, matcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> callable() {
    return QueryExecutionAssertions.callable();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> insertCount(int count) {
    return ProxyTestDataSourceAssertions.insertCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> isBatchCallable() {
    return batchCallable();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> updateCount(int count) {
    return ProxyTestDataSourceAssertions.updateCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> statementCount(int count) {
    return ProxyTestDataSourceAssertions.statementCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> batch() {
    return QueryExecutionAssertions.batch();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<ProxyTestDataSource> totalQueryCount(int count) {
    return ProxyTestDataSourceAssertions.totalQueryCount(count);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> batchStatement() {
    return QueryExecutionAssertions.batchStatement();
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super ParameterHolder> paramsByIndex(
        Matcher<Map<? extends Integer, ?>> mapMatcher) {
    return ParameterHolderAssertions.paramsByIndex(mapMatcher);
}
src/main/java/net/ttddyy/dsproxy/asserts/hamcrest/DataSourceAssertMatchers.java
public static Matcher<? super QueryExecution> statement() {
    return QueryExecutionAssertions.statement();
}


Question: package net.ttddyy.dsproxy.asserts.api;
import net.ttddyy.dsproxy.QueryType;
import net.ttddyy.dsproxy.asserts.CallableBatchExecution;
import net.ttddyy.dsproxy.asserts.CallableExecution;
import net.ttddyy.dsproxy.asserts.PreparedBatchExecution;
import net.ttddyy.dsproxy.asserts.PreparedExecution;
import net.ttddyy.dsproxy.asserts.ProxyTestDataSource;
import net.ttddyy.dsproxy.asserts.QueryExecution;
import net.ttddyy.dsproxy.asserts.StatementBatchExecution;
import net.ttddyy.dsproxy.asserts.StatementExecution;
import javax.sql.DataSource;
import java.math.BigDecimal;
import java.sql.Array;
import java.sql.Date;
import java.sql.JDBCType;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.batch;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.batchCallable;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.batchCallableCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.batchPrepared;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.batchPreparedCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.batchSize;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.batchStatement;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.batchStatementCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.callable;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.callableCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.callableOrBatchCallable;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.callableOrBatchCallableCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.deleteCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.executionCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.executions;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.failure;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.insert;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.insertCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.isBatch;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.isBatchCallable;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.isBatchPrepared;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.isBatchStatement;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.isCallable;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.isCallableOrBatchCallable;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.isPrepared;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.isPreparedOrBatchPrepared;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.isStatement;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.isStatementOrBatchStatement;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.nullParam;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.otherCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.outParam;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.outParamIndexes;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.outParamNames;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.param;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsArray;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsBigDecimal;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsBoolean;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsByte;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsBytes;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsDate;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsDouble;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsFloat;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsInteger;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsLong;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsShort;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsTime;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramAsTimestamp;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramIndexes;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramNames;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramsByIndex;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.paramsByName;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.prepared;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.preparedCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.preparedOrBatchPrepared;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.preparedOrBatchPreparedCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.queries;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.query;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.queryType;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.queryTypes;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.select;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.selectCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.statement;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.statementCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.statementOrBatchStatement;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.statementOrBatchStatementCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.success;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.totalQueryCount;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.update;
import static net.ttddyy.dsproxy.asserts.hamcrest.DataSourceAssertMatchers.updateCount;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.either;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertThat;




/**
 * API compilation check with hamcrest.
 *
 * @author Tadaya Tsuyukubo
 */
public class HamcrestAssertionApiCheck {

    private DataSource actualDataSource;

    private void dataSource() {
        // tag::datasource[]
        ProxyTestDataSource ds = new ProxyTestDataSource(actualDataSource);

        // ... perform application logic with database ...

        // execution count
        assertThat(ds, executionCount(3));
        assertThat(ds, statementCount(3));
        assertThat(ds, batchStatementCount(3));
        assertThat(ds, statementOrBatchStatementCount(3));
        assertThat(ds, preparedCount(3));
        assertThat(ds, batchPreparedCount(3));
        assertThat(ds, preparedOrBatchPreparedCount(3));
        assertThat(ds, callableCount(3));
        assertThat(ds, batchCallableCount(3));
        assertThat(ds, callableOrBatchCallableCount(3));

        // each execution
        assertThat(ds, executions(0, isBatch()));
        assertThat(ds, executions(0, batch()));
        assertThat(ds, executions(0, is(batch())));

        assertThat(ds, executions(0, isStatement()));
        assertThat(ds, executions(0, statement()));
        assertThat(ds, executions(0, is(isStatement())));

        assertThat(ds, executions(0, isBatchStatement()));
        assertThat(ds, executions(0, batchStatement()));
        assertThat(ds, executions(0, is(batchStatement())));

        assertThat(ds, executions(0, isStatementOrBatchStatement()));
        assertThat(ds, executions(0, isPrepared()));
        assertThat(ds, executions(0, isBatchPrepared()));
        assertThat(ds, executions(0, isPreparedOrBatchPrepared()));
        assertThat(ds, executions(0, isCallable()));
        assertThat(ds, executions(0, isBatchCallable()));
        assertThat(ds, executions(0, isCallableOrBatchCallable()));

        assertThat(ds, executions(0, is(success())));

        // query count
        assertThat(ds, totalQueryCount(5));
        assertThat(ds, selectCount(3));
        assertThat(ds, insertCount(3));
        assertThat(ds, otherCount(3));
        assertThat(ds, allOf(updateCount(3), deleteCount(1)));

        ds.reset();

        assertThat(ds.getFirstStatement(), query(is("abc")));
        assertThat(ds.getFirstBatchStatement(), queries(0, is("abc")));
        assertThat(ds.getFirstBatchCallable(), query(is("abc")));
        // end::datasource[]
    }

    private void queryExecution() {
        // tag::query[]
        ProxyTestDataSource ds = new ProxyTestDataSource(actualDataSource);

        // ... perform application logic with database ...

        QueryExecution qe = ds.getFirstStatement();

        assertThat(qe, success());
        assertThat(qe, failure());

        // type of execution
        assertThat(qe, isBatch());
        assertThat(qe, statement());
        assertThat(qe, batchStatement());
        assertThat(qe, statementOrBatchStatement());
        assertThat(qe, prepared());
        assertThat(qe, batchPrepared());
        assertThat(qe, preparedOrBatchPrepared());
        assertThat(qe, callable());
        assertThat(qe, batchCallable());
        assertThat(qe, callableOrBatchCallable());
        // end::query[]
    }

    private void statementExecution() {
        // tag::statement[]
        ProxyTestDataSource ds = new ProxyTestDataSource(actualDataSource);

        // ... perform application logic with database ...

        StatementExecution se = ds.getFirstStatement();

        assertThat(se, success());
        assertThat(se, failure());

        // query with StringMatcher
        assertThat(se, query(is("...")));
        assertThat(se, query(startsWith("...")));

        assertThat(se, queryType(QueryType.SELECT));
        // end::statement[]
    }

    private void batchStatementExecution() {
        // tag::batch-statement[]
        ProxyTestDataSource ds = new ProxyTestDataSource(actualDataSource);

        // ... perform application logic with database ...

        StatementBatchExecution sbe = ds.getFirstBatchStatement();

        assertThat(sbe, success());
        assertThat(sbe, failure());

        assertThat(sbe, queries(0, is("...")));   // string matcher
        assertThat(sbe, queries(hasItems("...", "...")));  // collection matcher
        assertThat(sbe, queryTypes(0, is(select())));
        assertThat(sbe, queryTypes(0, either(insert()).or(update())));
        // end::batch-statement[]
    }

    private void preparedExecution() {
        // tag::prepared[]
        ProxyTestDataSource ds = new ProxyTestDataSource(actualDataSource);

        // ... perform application logic with database ...

Answer:         PreparedExecution pe = ds.getFirstPrepared();