Tag: testing

  • Extract a logic from collections processing

    Once again, you as a developer, get a task to simplify the below code: You can simplify a little with streams: but this is not what we want to achieve, because the logic/condition is sunk in collection processing and testing is not easy and as you see, leads to testing many cases (good client, bad…

  • Pure function

    What is a pure function? What are its advantages? Why include logic in a pure function is awsome? The answers you will find in this post. The story. You, as a perfectionist developer, are wandering how to simplify the following class and testing, that is not very easy: You you feel that it could be…

  • Pass all parameters to function

    Your task is to simplify the testing of this function logic: How easy is it to test this function? Not complicated, but not trivial either. We can use mocking: As you can see, a certain amount of test code is needed. This example is simple, but imagine that you have more complex logic and classes…