dimanche 7 février 2016

How to check TestNG Assert.assertEqual() conditional checking

Let me explain what I exactly expecting I have a method like the following

public void  removeByObject()
{
try {
            DsrCollection dsrCollection = new DsrCollection();
            dsrCollection. setNuId(180);
            dsrCollectionRepository.remove(dsrCollection);
}
catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }

Here I want to check that the particular method removeByObject() executed successfully or not(also want to involve Assert.assertEqual(dsrCollectionRepository.remove(dsrCollection),??)). So for checking the condition what should be the actual value.

Or in a more specific way what object should appear in actual value place. My requirement is like if application failed to execute dsrCollectionRepository.remove(dsrCollection) it should return the assertError message

Aucun commentaire:

Enregistrer un commentaire