Skip to main content

Posts

Showing posts with the label Mockito

๐Ÿš€ Demystifying JUnit Testing with Mockito & Spring Extensions

๐Ÿ‘‹ Before diving deep into testing, I always assumed: "JUnit is just something you use with @Test… it just works!"   But once I actually started exploring test frameworks in real-world projects, I realized there's so much more behind the scenes. So here’s a blog to clarify the confusion , make it visually digestible , and hopefully save you some debugging hours . Let’s roll! ๐Ÿง ✨ ๐Ÿ” Step 1: What dependencies should I include for JUnit? You may have seen these terms in your build.gradle : testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0' implementation 'com.example:some-library:1.2.3' But wait... what’s the difference? ๐Ÿค” ✅ implementation This means: Include the library for both compile time AND runtime . It will be packaged inside the final JAR/WAR. Use it for things your production code needs. ๐Ÿงช testImplementation This means: Use it only during test execution . It will NOT be added to the production JAR/WAR. Perfect for JU...