### Question:
InterfaceDaoInvoker implements DaoInvoker { public void flush() { if(flushableDAO == null) { throw new UnsupportedOperationException("The DAO '" + dao.getClass().getName() + "' doesn't implement the '" + Flushable.class.getName() + "' interface and there for can't flush the DAO."); } flushableDAO.flush(); } @SuppressWarnings("unchecked")  InterfaceDaoInvoker(final Object dao); Object insert(final Object obj); Object insert(String name, Object obj); Object update(final Object obj); Object update(String name, Object obj); Object delete(Object entity); Object delete(String name, Object entity); void flush(); Object lookupByQuery(final String query, final Object ... parameters); Object lookupByQuery(final String query, final Map<String, ?> parameters); Object lookup(final String name, final Object ... parameters); Object lookup(final String name, final Map<String, ?> parameters);  }### Answer:
@Test public void test_flush() { DaoInvoker invoker = new InterfaceDaoInvoker(fullDao); invoker.flush(); verify(fullDao).flush(); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test_flush_non_flushable_dao() { DaoInvoker invoker = new InterfaceDaoInvoker(minimumDao); invoker.flush(); }