### Question:
AnnotatedDaoInvoker implements DaoInvoker { public Object lookup(final String name, final Map<String, ?> parameters) { final LookupMethod method = daoRuntimeInfo.getLookupWithNamedParametersMethod(name); assertMethod(method, name, Lookup.class); return method.invoke(dao, 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_lookup() { DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo); Map<String, Object> params = new HashMap<String, Object>(); params.put("id", 1L); invoker.lookup("id", params); verify(fullDao).findById(1L); }
@Test public void test_lookup_with_method_name() { DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo); invoker.lookup("findBy", "param"); verify(fullDao).findBy(eq("param")); }
@Test public void test_lookup_with_name_param() { DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo); Map<String, Object> param = new HashMap<String, Object>(); param.put("first", "henk"); param.put("last", "janssen"); invoker.lookup("name", param); verify(fullDao).findByName(eq("janssen"), eq("henk")); }
@Test public void test_lookup_with_positional_param() { DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo); invoker.lookup("positional", "param1", 2, true); verify(fullDao).findBySomething(eq("param1"), eq(2), eq(true)); }
@Test(expectedExceptions = NoMethodWithAnnotationFoundException.class) public void test_lookup_no_annotation() { DaoInvoker invoker = new AnnotatedDaoInvoker(minimumDao, minimumDaoRuntimeInfo); invoker.lookup("id", Collections.emptyMap()); }