How Do I Test Private Methods?
This article explains why private methods should be tested indirectly through public methods. It discusses how complex private logic can indicate design issues and how refactoring into smaller classes or using appropriate visibility can improve testability. Following this approach keeps tests maintainable and allows refactoring without breaking them.
Four No Bullshit Ways to Easily Increase Your Programming Productivity
This post explores practical ways to save time and reduce friction in programming. It covers mastering your IDE, automating repetitive tasks, optimizing feedback loops, and focusing on writing only necessary code. By applying these principles, you can streamline development, avoid unnecessary work, and make coding more efficient.
Seven Useful Time Management Tips For Developers to Boost Productivity
This post explores practical strategies to improve focus and get more done. It covers saying no to interruptions, managing distractions, planning and prioritizing work, using time-blocking and the Pomodoro technique, and incorporating daily and weekly self-reflection. Applying these tips helps you work proactively and make meaningful progress on your most important tasks.
Using Mockito With JUnit 5
This guide explains how to integrate Mockito with JUnit 5 for effective unit testing. It covers three approaches: manual mock creation, annotation-based initialization, and using the Mockito JUnit 5 extension for automatic mock injection. By following these methods, you can simplify test setup, improve readability, and validate mock usage efficiently.
JUnit 5 Test Lifecycle: Before and After Annotations
This tutorial explores how to run code before and after tests in JUnit 5, both for individual tests and across the entire test class. It explains the differences between per-test and per-class test instances, handling nested tests, and how extensions wrap test execution. Learning these patterns helps manage shared resources and maintain predictable test behavior.
JUnit 5 Expected Exception: How to assert an exception is thrown?
This tutorial explains how to confirm that a specific exception is thrown in JUnit 5 tests and how to inspect the exception message. It covers handling unexpected or missing exceptions and shows how capturing the exception allows for more detailed assertions. Following these practices ensures reliable and precise error-handling tests.
A More Practical Guide to JUnit 5 Parameterized Tests
This tutorial explains how to create parameterized tests in JUnit 5, allowing the same test to run with different inputs. It covers single and multiple arguments, using external data sources like CSV files, and custom conversions or aggregations for complex types. Parameterized tests help reduce duplication and make test code more maintainable and readable.
Getting Started with JUnit 5: Writing Your First Test
This guide walks you through writing a simple JUnit 5 test to ensure your code works as intended. You’ll learn how to set up tests, verify expected results, and run them using an IDE, Maven, or Gradle.
JUnit 5 Assertions: Verifying Test Results
This article covers how to use JUnit 5 assertions to validate test results, including values, booleans, nulls, arrays, objects, exceptions, and timeouts. It explains custom error messages and grouped assertions for clearer reporting. For advanced scenarios, it also introduces third-party libraries like Hamcrest, AssertJ, and Truth to make assertions more readable and expressive.
JUnit 5 With Kotlin for Java Developers
This article explores writing JUnit 5 tests in Kotlin and configuring them with Gradle Kotlin DSL. It covers Kotlin-specific syntax for assertions, parameterized tests, dynamic and nested tests, lifecycle methods, and handling static fields. Readers will learn how Kotlin’s features can make test code more readable while fully supporting JUnit 5 functionality.