The method query(String, ResultSetExtractor) in the type JdbcTemplate is not applicable for the arguments (String, BeanPropertyRowMapper)

前端 未结 2 618
终归单人心
终归单人心 2021-01-21 17:15

I have a compile problem which is strange. I am not able to fix this. The same peice of code works fine in another project

org.mockito.Mockito.when(jdbcTemplate.         


        
相关标签:
2条回答
  • 2021-01-21 17:51

    Check for the dependency (spring jars) for version mismatch between projects

    0 讨论(0)
  • 2021-01-21 17:58

    Since BeanPropertyRowMapper<T> is a generic interface, you should invoke any() like this:

    Mockito.when(jdbcTemplate.query(Matchers.anyString(), 
        Matchers.<BeanPropertyRowMapper<MyClass>>any())).thenReturn(SOMELIST);
    
    0 讨论(0)
提交回复
热议问题