Skip to content

Commit

Permalink
Mock the PreparedStatements too.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse White committed Jun 2, 2016
1 parent b6eebfd commit 0040130
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import org.opennms.newts.cassandra.ContextConfigurations;

import com.codahale.metrics.MetricRegistry;
import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.RegularStatement;
import com.datastax.driver.core.ResultSetFuture;
import com.datastax.driver.core.Statement;
import com.google.common.collect.Lists;
Expand All @@ -47,6 +50,12 @@ public void canIndexManyResources() {
CassandraSession session = mock(CassandraSession.class);
when(session.executeAsync(any(Statement.class))).thenReturn(future);

PreparedStatement preparedStatement = mock(PreparedStatement.class);
BoundStatement boundStatement = mock(BoundStatement.class);
when(session.prepare(any(RegularStatement.class))).thenReturn(preparedStatement);
when(preparedStatement.bind()).thenReturn(boundStatement);
when(boundStatement.setString(any(String.class), any(String.class))).thenReturn(boundStatement);

ContextConfigurations contexts = new ContextConfigurations();
MetricRegistry metrics = new MetricRegistry();

Expand Down

0 comments on commit 0040130

Please sign in to comment.