Welcome to Spring Mastery Hub.

  • Specification-based Testing: Understand the requirements

    Understanding the requirements is an important part of testing your code. If you already know the business rules you can create tests to validate it. Also, you can create some that will prevent unwanted behavior too. When writing tests, consider the inputs, how they affect the code, and if the results meet your business rules. Do you have some doubts about it? What should be the result in some…

  • Specification-Based Testing: A Developer’s Secret Weapont

    One quick story: I was adding a new feature that needed an API client created by another developer. The API required three inputs: ID, country code, and phone number. I followed this specification, made a test, and all seemed good. But when I updated my code later before deploying. I found out the other developer…

  • Friction: How Human Behavior Influences Code Development

    Introduction Have you ever tried to start a gym routine, learn a new skill, or start a new side project, and found yourself failing? The reasons for failure can sound familiar: This problem, where obstacles prevent us from starting something new, is known as friction. Friction in Software Development What does friction have to do with…

  • From Bugs to Brilliance: Enhancing Code Reliability Through Mutation Testing

    Introduction Have you worked on a project with high test coverage? Ever wondered why, despite extensive coverage, bugs still manage to slip into production? Have you or your teammates begun questioning the effectiveness of unit testing? Have you questioned whether there’s a better way to check your test’s effectiveness? The solution to all the questions…

  • Less Code, More Tests: Exploring Parameterized Tests in JUnit

    Introduction Regarding writing tests, some developers are lazy writing fewer test scenarios as possible. And sometimes they can write no scenarios at all. Imagine being able to test many scenarios without writing much code. Isn’t that great? A parameterized test lets you test many scenarios. You just send a list of parameters. This way, you…

  • How to test complex conditions with the MC/DC criteria

    Introduction Have you needed help defining what to test when you encounter a complex condition in your code? Do you feel lazy when looking at a condition that has too many logical statements? It’s easy to look at that big if statement that you find in legacy code and think: “Man, what should I test…

  • How to write meaningful test assertions that help you not break your code base

    The article emphasizes the importance of writing meaningful assertions and verifications in software testing. It explains how specific and descriptive assertions help in detecting bugs early, improving code quality, and increasing confidence in the code. It provides examples of common mistakes and how to avoid them, highlighting the significance of writing specific assertions to ensure…

  • Simplify Your Tests and Save Time: A Guide to Test Data Builders

    Test data builders provide a solution to the time-consuming and complex task of setting up test scenarios. By pre-populating domain objects with valid data, developers can easily modify and reuse data for their tests. This technique not only simplifies the test setup process but also significantly improves the readability and maintainability of the test code,…

  • Optimizing Spring Integration Tests: 7 Annotations That May Be Slowing You Down

    Introduction: We all know that integration tests are not the fastest to run, they surely take longer than unit tests. The reason for that is that you have to start up Spring context to run the tests. The bigger your application gets the more time your application takes to start. That can make your team…

  • How to Create and Use a Custom ResultMatcher for Date Testing with MockMvc

    In this tutorial, you will learn how to create a custom ResultMatcher for MockMvc, to suit your project needs. Imagine you are testing an API and the response contains a date. And you want to check if the response date is valid. So you have a test assertion that checks for an exact date and…