@Test public void testGetPreparedStatementReturnsNullAlsoReturnsNull() { String query = "select id from ks.ts where id = ?"; MD5Digest statementId = MD5Digest.compute(query); when(mockHandler.getPrepared(statementId)).thenReturn(null); ParsedStatement.Prepared prepared = queryHandler.getPrepared(statementId); assertThat(prepared).isNull(); verify(mockHandler, times(1)).getPrepared(statementId); }
@Override public ParsedStatement.Prepared getPrepared(MD5Digest id) { ParsedStatement.Prepared prepared = wrappedQueryHandler.getPrepared(id); if (prepared == null) { return null; } preparedId.set(id); return prepared; }
AuditQueryHandler implements QueryHandler { @Override public ParsedStatement.Prepared getPrepared(MD5Digest id) { ParsedStatement.Prepared prepared = wrappedQueryHandler.getPrepared(id); if (prepared == null) { return null; } preparedId.set(id); return prepared; } }
AuditQueryHandler implements QueryHandler { @Override public ParsedStatement.Prepared getPrepared(MD5Digest id) { ParsedStatement.Prepared prepared = wrappedQueryHandler.getPrepared(id); if (prepared == null) { return null; } preparedId.set(id); return prepared; } AuditQueryHandler();  AuditQueryHandler(QueryHandler queryHandler); @VisibleForTesting  AuditQueryHandler(QueryHandler queryHandler, AuditAdapter auditAdapter); }
AuditQueryHandler implements QueryHandler { @Override public ParsedStatement.Prepared getPrepared(MD5Digest id) { ParsedStatement.Prepared prepared = wrappedQueryHandler.getPrepared(id); if (prepared == null) { return null; } preparedId.set(id); return prepared; } AuditQueryHandler();  AuditQueryHandler(QueryHandler queryHandler); @VisibleForTesting  AuditQueryHandler(QueryHandler queryHandler, AuditAdapter auditAdapter); @Override ResultMessage process(String query, QueryState state, QueryOptions options,
                                 Map<String, ByteBuffer> customPayload); @Override ResultMessage processPrepared(CQLStatement statement, QueryState state, QueryOptions options,
                                         Map<String, ByteBuffer> customPayload); @Override ResultMessage processBatch(BatchStatement statement, QueryState state, BatchQueryOptions options,
                                      Map<String, ByteBuffer> customPayload); @Override Prepared prepare(String query, QueryState state, Map<String, ByteBuffer> customPayload); @Override ParsedStatement.Prepared getPrepared(MD5Digest id); @Override ParsedStatement.Prepared getPreparedForThrift(Integer id); }
AuditQueryHandler implements QueryHandler { @Override public ParsedStatement.Prepared getPrepared(MD5Digest id) { ParsedStatement.Prepared prepared = wrappedQueryHandler.getPrepared(id); if (prepared == null) { return null; } preparedId.set(id); return prepared; } AuditQueryHandler();  AuditQueryHandler(QueryHandler queryHandler); @VisibleForTesting  AuditQueryHandler(QueryHandler queryHandler, AuditAdapter auditAdapter); @Override ResultMessage process(String query, QueryState state, QueryOptions options,
                                 Map<String, ByteBuffer> customPayload); @Override ResultMessage processPrepared(CQLStatement statement, QueryState state, QueryOptions options,
                                         Map<String, ByteBuffer> customPayload); @Override ResultMessage processBatch(BatchStatement statement, QueryState state, BatchQueryOptions options,
                                      Map<String, ByteBuffer> customPayload); @Override Prepared prepare(String query, QueryState state, Map<String, ByteBuffer> customPayload); @Override ParsedStatement.Prepared getPrepared(MD5Digest id); @Override ParsedStatement.Prepared getPreparedForThrift(Integer id);  }