0

How to mock

SessionFactory sessionFactory = HibernateUtil.getSessionFactory()

using mockito?

maskacovnik
  • 3,029
  • 5
  • 19
  • 26
  • What @wjans said. Also you could have a look here: http://stackoverflow.com/questions/21105403/mocking-static-methods-with-mockito – Mindaugas Jul 14 '15 at 12:58

1 Answers1

2

You cannot mock a static method with Mockito. Have a look at PowerMock (PowerMockito). But note that it also has some drawbacks, like for instance performance.

wjans
  • 9,794
  • 5
  • 31
  • 39