How to use JUnit and Hamcrest together?

前端 未结 8 998
傲寒
傲寒 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:45

    Since versions are changing all the time, I'm posting to let people know that as of December 2, 2014, the instructions at http://www.javacodegeeks.com/2014/03/how-to-test-dependencies-in-a-maven-project-junit-mockito-hamcrest-assertj.html worked for me. I did not use AssertJ though, just these:

    
      junit
      junit
      4.11
      test
    
    
      org.mockito
      mockito-core
      1.9.5
      test
    
    
        org.hamcrest
        hamcrest-core
        1.3
        test
    
    
        org.hamcrest
        hamcrest-library
        1.3
        test
       
    
        org.objenesis
        objenesis
        1.3
        test
    
    

提交回复
热议问题