문제

I have used easymock for creating a java.sql.Connection mock object(con). My doubt is

  • Should i use con=null for cleanup or
  • con.close() for cleanup ?

In my opinion it should be the first one but still wanted to clear my doubts.

도움이 되었습니까?

해결책

It is a mock object so it will not be creating actual connection to the database. So, the first one should suffice in my opinion. If you call conn.close(), you will have to mock it anyways.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top