@Test @SuppressWarnings("unchecked") public void testGetResultList() { final List list = context.mock(List.class); context.checking(new Expectations() { { oneOf(ftqMock).setResultTransformer(resultTransformer); oneOf(ftqMock).getResultList(); will(returnValue(list)); oneOf(resultTransformer).transformList(list); allowing(list).size(); will(returnValue(1)); } }); sut.setResultTransformer(resultTransformer); sut.getResultList(); context.assertIsSatisfied(); }
@Override @SuppressWarnings("unchecked") public List getResultList() { log.info("Getting the result list from Lucene"); long start = System.currentTimeMillis(); List resultList = wrappedFullTextQuery.getResultList(); long duration = System.currentTimeMillis() - start; if (log.isInfoEnabled()) { log.info("Found " + resultList.size() + " results from Lucene in " + duration + " ms."); } log.info("Transforming the list with resultTransformer.transformList."); List transformedList = resultTransformer.transformList(resultList); return transformedList; }
ProjectionFullTextQuery implements FullTextQuery { @Override @SuppressWarnings("unchecked") public List getResultList() { log.info("Getting the result list from Lucene"); long start = System.currentTimeMillis(); List resultList = wrappedFullTextQuery.getResultList(); long duration = System.currentTimeMillis() - start; if (log.isInfoEnabled()) { log.info("Found " + resultList.size() + " results from Lucene in " + duration + " ms."); } log.info("Transforming the list with resultTransformer.transformList."); List transformedList = resultTransformer.transformList(resultList); return transformedList; } }
ProjectionFullTextQuery implements FullTextQuery { @Override @SuppressWarnings("unchecked") public List getResultList() { log.info("Getting the result list from Lucene"); long start = System.currentTimeMillis(); List resultList = wrappedFullTextQuery.getResultList(); long duration = System.currentTimeMillis() - start; if (log.isInfoEnabled()) { log.info("Found " + resultList.size() + " results from Lucene in " + duration + " ms."); } log.info("Transforming the list with resultTransformer.transformList."); List transformedList = resultTransformer.transformList(resultList); return transformedList; } ProjectionFullTextQuery(final FullTextQuery inWrappedFullTextQuery); }
ProjectionFullTextQuery implements FullTextQuery { @Override @SuppressWarnings("unchecked") public List getResultList() { log.info("Getting the result list from Lucene"); long start = System.currentTimeMillis(); List resultList = wrappedFullTextQuery.getResultList(); long duration = System.currentTimeMillis() - start; if (log.isInfoEnabled()) { log.info("Found " + resultList.size() + " results from Lucene in " + duration + " ms."); } log.info("Transforming the list with resultTransformer.transformList."); List transformedList = resultTransformer.transformList(resultList); return transformedList; } ProjectionFullTextQuery(final FullTextQuery inWrappedFullTextQuery); @Override FullTextQuery setResultTransformer(final ResultTransformer inTransformer); @Override @SuppressWarnings("unchecked") List getResultList(); @Override void disableFullTextFilter(final String name); @Override FullTextFilter enableFullTextFilter(final String name); @Override Explanation explain(final int documentId); @Override int getResultSize(); @Override FullTextQuery setCriteriaQuery(final Criteria criteria); @Override FullTextQuery setFilter(final Filter filter); @Override FullTextQuery setProjection(final String... fields); @Override FullTextQuery setSort(final Sort sort); @Override int executeUpdate(); @Override @SuppressWarnings("unchecked") Object getSingleResult(); @Override Query setFirstResult(final int arg0); @Override Query setFlushMode(final FlushModeType arg0); @Override Query setHint(final String arg0, final Object arg1); @Override Query setMaxResults(final int arg0); @Override Query setParameter(final String arg0, final Object arg1); @Override Query setParameter(final int arg0, final Object arg1); @Override Query setParameter(final String arg0, final Date arg1, final TemporalType arg2); @Override Query setParameter(final String arg0, final Calendar arg1, final TemporalType arg2); @Override Query setParameter(final int arg0, final Date arg1, final TemporalType arg2); @Override Query setParameter(final int arg0, final Calendar arg1, final TemporalType arg2); }
ProjectionFullTextQuery implements FullTextQuery { @Override @SuppressWarnings("unchecked") public List getResultList() { log.info("Getting the result list from Lucene"); long start = System.currentTimeMillis(); List resultList = wrappedFullTextQuery.getResultList(); long duration = System.currentTimeMillis() - start; if (log.isInfoEnabled()) { log.info("Found " + resultList.size() + " results from Lucene in " + duration + " ms."); } log.info("Transforming the list with resultTransformer.transformList."); List transformedList = resultTransformer.transformList(resultList); return transformedList; } ProjectionFullTextQuery(final FullTextQuery inWrappedFullTextQuery); @Override FullTextQuery setResultTransformer(final ResultTransformer inTransformer); @Override @SuppressWarnings("unchecked") List getResultList(); @Override void disableFullTextFilter(final String name); @Override FullTextFilter enableFullTextFilter(final String name); @Override Explanation explain(final int documentId); @Override int getResultSize(); @Override FullTextQuery setCriteriaQuery(final Criteria criteria); @Override FullTextQuery setFilter(final Filter filter); @Override FullTextQuery setProjection(final String... fields); @Override FullTextQuery setSort(final Sort sort); @Override int executeUpdate(); @Override @SuppressWarnings("unchecked") Object getSingleResult(); @Override Query setFirstResult(final int arg0); @Override Query setFlushMode(final FlushModeType arg0); @Override Query setHint(final String arg0, final Object arg1); @Override Query setMaxResults(final int arg0); @Override Query setParameter(final String arg0, final Object arg1); @Override Query setParameter(final int arg0, final Object arg1); @Override Query setParameter(final String arg0, final Date arg1, final TemporalType arg2); @Override Query setParameter(final String arg0, final Calendar arg1, final TemporalType arg2); @Override Query setParameter(final int arg0, final Date arg1, final TemporalType arg2); @Override Query setParameter(final int arg0, final Calendar arg1, final TemporalType arg2);  }