Hi, good list of useful tools. One thing you seem to have missed is AssertJ as an alternative assertion library. It’s fluent API is much more readable and versatile than the standard JUnit assertions. I also think it ships as a transitive dependency with spring testing. So you just need to static import the right methods. I’ve never looked back. 😊
Hey, no, Hamcrest is a Matcher Library, AssertJ is an assertion Library, that actually supports Hamcrest matchers and I’m using them as well. It’s a bit complicated... 🤪
Ah I see, I am sure going to try that on my unit tests now. How about mocking, do you use Mockito or PowerMock? I am a big mockito fan but I always stuck with mocking static fields like Logger in some Java classes.
Hi, good list of useful tools. One thing you seem to have missed is AssertJ as an alternative assertion library. It’s fluent API is much more readable and versatile than the standard JUnit assertions. I also think it ships as a transitive dependency with spring testing. So you just need to static import the right methods. I’ve never looked back. 😊
Thanks for suggestion, is it better than Hamcrest? another similar library which provides fluent assertion methods to read your test like English.
Hey, no, Hamcrest is a Matcher Library, AssertJ is an assertion Library, that actually supports Hamcrest matchers and I’m using them as well. It’s a bit complicated... 🤪
Ah I see, I am sure going to try that on my unit tests now. How about mocking, do you use Mockito or PowerMock? I am a big mockito fan but I always stuck with mocking static fields like Logger in some Java classes.
Definitely Mockito. If you need to use PowerMock you’re probably doing something wrong. Why would you ever need to mock the logger?