Mocking static methods with Mockito

后端 未结 15 1411
Happy的楠姐
Happy的楠姐 2020-11-21 06:51

I\'ve written a factory to produce java.sql.Connection objects:

public class MySQLDatabaseConnectionFactory implements DatabaseConnectionFactory         


        
15条回答
  •  深忆病人
    2020-11-21 07:33

    There is an easy solution by using java FunctionalInterface and then add that interface as dependency for the class you are trying to unit test.

提交回复
热议问题