/** Tests whether an exception is reported to the observer. */
 @Test
 public void testOnException() throws ConcurrentException {
   EntityManager em = EasyMock.createMock(EntityManager.class);
   EntityTransaction tx = EasyMock.createNiceMock(EntityTransaction.class);
   EasyMock.expect(em.getTransaction()).andReturn(tx).anyTimes();
   EasyMock.expect(init.get().createEntityManager()).andReturn(em);
   final RuntimeException err = new RuntimeException("TestException");
   observer.commandExecutionFailed(err);
   EasyMock.replay(em, tx, observer, init.get());
   ObservableCommandTestImpl cmd =
       new ObservableCommandTestImpl(init, observer, em) {
         @Override
         protected String produceResults(EntityManager em) {
           super.produceResults(em);
           throw err;
         }
       };
   try {
     cmd.execute();
     fail("Exception not thrown!");
   } catch (Exception ex) {
     assertEquals("Wrong exception", err, ex);
   }
   cmd.onException(err);
   EasyMock.verify(em, tx, observer, init.get());
 }