How to use JUnit and Hamcrest together?

前端 未结 8 960
傲寒
傲寒 2020-12-07 13:03

I can\'t understand how JUnit 4.8 should work with Hamcrest matchers. There are some matchers defined inside junit-4.8.jar in org.hamcrest.CoreMatchers. At the

8条回答
  •  离开以前
    2020-12-07 13:56

    Also, if JUnit 4.1.1 + Hamcrest 1.3 + Mockito 1.9.5 are being used, make sure mockito-all is not used. It contains Hamcrest core classes. Use mockito-core instead. The below config works :

    
        org.hamcrest
        hamcrest-all
        1.3
        test
    
    
        org.mockito
        mockito-core
        1.9.5
        test
        
            
                hamcrest-core
                org.hamcrest
            
        
    
    
        junit
        junit
        4.1.1
        test
        
            
                hamcrest-core
                org.hamcrest
            
        
    
    

提交回复
热议问题