@Test
  @UsingDataSet("users.xml")
  // This test will fail if column sensing for FlatXmlDataSet is not enabled
  // See http://www.dbunit.org/faq.html#differentcolumnnumber
  public void should_find_two_users_using_flat_xml_data_set() throws Exception {
    // given
    int expectedUserAmount = 2;
    String expectedNicknameOfSecondUser = "******";

    // when
    @SuppressWarnings("unchecked")
    List<UserAccount> userAccounts =
        em.createQuery(Query.selectAllInJPQL(UserAccount.class)).getResultList();

    // then
    assertThat(userAccounts).hasSize(expectedUserAmount);
    assertThat(userAccounts.get(1).getNickname()).isEqualTo(expectedNicknameOfSecondUser);
  }
  @Test
  @Transactional
  public void should_persist_users_within_transaction() throws Exception {
    // given
    UserAccount johnSmith = new UserAccount("John", "Smith", "doovde", "password");
    UserAccount clarkKent = new UserAccount("Clark", "Kent", "superman", "LexLuthor");

    // when
    em.persist(johnSmith);
    em.persist(clarkKent);
    em.flush();
    em.clear();

    // then
    @SuppressWarnings("unchecked")
    List<UserAccount> savedUserAccounts =
        em.createQuery(Query.selectAllInJPQL(UserAccount.class)).getResultList();
    assertThat(savedUserAccounts).hasSize(2);
  }