@Test(expected = UnsupportedOperationException.class)
  public void createsProxyWithCustomBaseClass() throws Exception {

    GenericDaoFactory factory = CustomGenericDaoFactory.create(entityManager);
    UserCustomExtendedDao dao = factory.getDao(UserCustomExtendedDao.class);

    dao.customMethod(1);
  }
  /**
   * Asserts that the factory recognized configured DAO classes that contain custom method but no
   * custom implementation could be found. Furthremore the exception has to contain the name of the
   * DAO interface as for a large DAO configuration it's hard to find out where this error occured.
   *
   * @throws Exception
   */
  @Test
  public void capturesMissingCustomImplementationAndProvidesInterfacename() throws Exception {

    try {
      factory.getDao(SampleDao.class);
    } catch (IllegalArgumentException e) {
      assertTrue(e.getMessage().contains(SampleDao.class.getName()));
    }
  }
  @Test
  public void allowsCallingOfObjectMethods() {

    SimpleSampleDao userDao = factory.getDao(SimpleSampleDao.class);

    userDao.hashCode();
    userDao.toString();
    userDao.equals(userDao);
  }
  @Test(expected = IllegalArgumentException.class)
  public void handlesRuntimeExceptionsCorrectly() {

    SampleDao dao = factory.getDao(SampleDao.class, new SampleCustomDaoImpl());
    dao.throwingRuntimeException();
  }
  /**
   * Assert that the instance created for the standard configuration is a valid {@code UserDao}.
   *
   * @throws Exception
   */
  @Test
  public void setsUpBasicInstanceCorrectly() throws Exception {

    assertNotNull(factory.getDao(SimpleSampleDao.class));
  }
  @Before
  public void setUp() {

    // Setup standard factory configuration
    factory = GenericDaoFactory.create(entityManager);
  }
  @Test(expected = IOException.class)
  public void handlesCheckedExceptionsCorrectly() throws Exception {

    SampleDao dao = factory.getDao(SampleDao.class, new SampleCustomDaoImpl());
    dao.throwingCheckedException();
  }