### Question:
ExpressionFactory { public XQPreparedExpression getExpression(XQConnection connection) throws Exception { XQPreparedExpression preparedExpression = connection .prepareExpression(contentFactory.getXQueryContentAsStream()); contextItemBinder.bindContextItem(connection, preparedExpression); variablesBinder.bindVariables(connection, preparedExpression); return preparedExpression; } ExpressionFactory(XQueryRunConfig config, XQueryContentFactory contentFactory,
                             VariablesBinder variablesBinder, ContextItemBinder contextItemBinder); XQPreparedExpression getExpression(XQConnection connection);  }### Answer:
@Test public void shouldPrepareExpressionUsingConnection() throws Exception { InputStream inputStream = mock(InputStream.class); given(contentFactory.getXQueryContentAsStream()).willReturn(inputStream); factory.getExpression(connection); verify(contentFactory).getXQueryContentAsStream(); verify(connection).prepareExpression(inputStream); }
@Test public void shouldBindContextItem() throws Exception { factory.getExpression(connection); verify(contextItemBinder).bindContextItem(connection, expression); }
@Test public void shouldBindVariables() throws Exception { factory.getExpression(connection); verify(variablesBinder).bindVariables(connection, expression); }