@Before
  public final void before() {
    final int minimalNumberOfEntities = 25;
    if (fooService.findAll().size() <= minimalNumberOfEntities) {
      for (int i = 0; i < minimalNumberOfEntities; i++) {
        fooService.create(new Foo(randomAlphabetic(6)));
      }
    }

    session = sessionFactory.openSession();
  }
 @Test(expected = InvalidDataAccessApiUsageException.class)
 @Ignore("Right now, persist has saveOrUpdate semantics, so this will no longer fail")
 public final void whenSameEntityIsCreatedTwice_thenDataException() {
   final Foo entity = new Foo(randomAlphabetic(8));
   service.create(entity);
   service.create(entity);
 }
 @Test(expected = DataAccessException.class)
 public final void temp_whenInvalidEntityIsCreated_thenDataException() {
   service.create(new Foo(randomAlphabetic(2048)));
 }
 @Test(expected = DataIntegrityViolationException.class)
 public final void whenEntityWithLongNameIsCreated_thenDataException() {
   service.create(new Foo(randomAlphabetic(2048)));
 }
 @Test(expected = DataIntegrityViolationException.class)
 public final void whenInvalidEntityIsCreated_thenDataException() {
   service.create(new Foo());
 }
 @Test
 public final void whenEntityIsCreated_thenNoExceptions() {
   service.create(new Foo(randomAlphabetic(6)));
 }