### Question:
AnnotatedDaoInvoker implements DaoInvoker { public Object lookupByQuery(final String query, final Object ... parameters) { final LookupWithPositionalQueryMethod method = daoRuntimeInfo.getLookupByPositionalQueryMethod(); if(method == null) { throw new NoMethodWithAnnotationFoundException("No method found in DAO class '" + dao.getClass().getName() + "' that is annotated " + "with '" + LookupByQuery.class.getSimpleName() + "' annotation and has an Array argument for the positional parameters."); } return method.invoke(dao, query, parameters); } AnnotatedDaoInvoker(final Object dao, final AnnotatedDaoRuntimeInfo daoRuntimeInfo); void flush(); Object update(final Object entity); Object update(String name, Object entity); Object insert(final Object entity); Object insert(String name, Object entity); Object delete(final Object entity); Object delete(String name, Object entity); Object lookupByQuery(final String query, final Object ... parameters); Object lookupByQuery(final String query, final Map<String, ?> parameters); Object lookup(final String name, final Map<String, ?> parameters); Object lookup(final String name, final Object ... parameters);  }### Answer:
@Test public void test_lookupByQuery_map_params() { DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo); Map<String, Object> params = new HashMap<String, Object>(); invoker.lookupByQuery("query", params); verify(fullDao).findByQuery(eq("query"), same(params)); }
@Test public void test_lookupByQuery_array_params() { DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo); Object[] params = new Object[0]; invoker.lookupByQuery("query", params); verify(fullDao).findByQuery(eq("query"), same(params)); }
@Test(expectedExceptions = NoMethodWithAnnotationFoundException.class) public void test_lookupByQuery_non_query_finder_dao_map_params() { DaoInvoker invoker = new AnnotatedDaoInvoker(minimumDao, minimumDaoRuntimeInfo); Map<String, Object> params = new HashMap<String, Object>(); invoker.lookupByQuery("id", params); }
@Test(expectedExceptions = NoMethodWithAnnotationFoundException.class) public void test_lookupByQuery_non_query_finder_dao_array_params() { DaoInvoker invoker = new AnnotatedDaoInvoker(minimumDao, minimumDaoRuntimeInfo); Object[] params = new Object[0]; invoker.lookupByQuery("id", params); }