@Test @ApplyScriptBefore("clark-kent-with-nickname.sql") @ShouldMatchDataSet("clark-kent-without-nickname.json") public void should_compare_null_value_defined_in_json_data_set() throws Exception { // given UserAccount clarkKent = em.find(UserAccount.class, 2L); // when clarkKent.setNickname(null); clarkKent = em.merge(clarkKent); // then // verified by DataSet comparison }
@Test @CleanupUsingScript("delete-users.sql") @ApplyScriptBefore("clark-kent-with-nickname.sql") @ShouldMatchDataSet("clark-kent-without-nickname.yml") public void should_clean_database_before_test_using_custom_script() throws Exception { // given UserAccount clarkKent = em.find(UserAccount.class, 2L); // when clarkKent.setNickname(null); clarkKent = em.merge(clarkKent); // then // verified by DataSet comparison }
@Test @ApplyScriptBefore("clark-kent-with-nickname.sql") @ShouldMatchDataSet("clark-kent-without-nickname.xml") // This test will fail if replaceable set is not used // See http://www.dbunit.org/apidocs/org/dbunit/dataset/ReplacementDataSet.html public void should_compare_null_value_defined_in_flat_xml_data_set() throws Exception { // given UserAccount clarkKent = em.find(UserAccount.class, 2L); // when clarkKent.setNickname(null); clarkKent = em.merge(clarkKent); // then // verified by DataSet comparison }