@Test
public void shouldRespondWithStubActionsWhenMatched() {

  String query = "select * from foo where bar = ?";
  RowsMetadata rowsMetadata = new RowsMetadata(Collections.emptyList(), null, new int[0], null);
  Prepared response = new Prepared(new byte[] {1, 7, 9}, null, rowsMetadata, rowsMetadata);
  node.getStubStore()
      .register(
          new StubMapping() {
            @Override
            public boolean matches(Frame frame) {
              Message msg = frame.message;
              if (msg instanceof Prepare) {
                Prepare p = (Prepare) msg;
                return p.cqlQuery.equals(query);
              }
              return false;
            }
            @Override
            public List<Action> getActions(AbstractNode node, Frame frame) {
              return Collections.singletonList(new MessageResponseAction(response));
            }
          });
  channel.writeInbound(FrameUtils.wrapRequest(new Prepare(query)));
  Frame frame = channel.readOutbound();
  assertThat(frame.message).isSameAs(response);
}