mardi 26 juillet 2016

Mocking Db in Java Unit tests

I am trying to unit test this code block in a method in my service layer. Could anyone suggest what can (/should) I test here and how to test them (esp. the insert to db part). Any pointers (/example code/doc) will be very helpful.

                 if (element != null) {
                    id = iplDAO.loadGames(element,batchVO.getId());
                    iplPartyDetailsVO = element.getParty();
                    if iplPartyDetailsVO != null) {
                        try {
                            iplDAO.insertPartyDetails(iplPartyDetailsVO, id,batchVO.getId());
                        } catch (Exception e) {

                            logger.logp("className");
                            String err = "blah";
                            iplDAO.insertIntoError(err_t);
                        }
                    }

Aucun commentaire:

Enregistrer un commentaire