December 16, 2018
April 9, 2020
Now that we’ve covered some of Spring capabilities, we can explore possibilities beyond simple mocking. Instead of “regular” mocks (that we can set up in the integration tests), we can inject actual simulators. For our purpose, let’s define a simulator… Continue Reading…
November 22, 2017
Here’s the situation: We have a couple of configuration files we use for integration tests. Each of them is a different set of real and mock objects. Some of the objects have behaviors set on them (using Mockito.when) in the… Continue Reading…
November 15, 2017
Last time, in the first post in my new clean code series, we discussed how I torment my students with the ol’ Square and Rectangle trick in my Clean Code course, talking about Liskov Substitution Principle (LSP). At the end… Continue Reading…
November 8, 2017
In my Clean Code class, I go through this example about the Liskov Substitution Principle (LSP), part of the SOLID material. This example, the rectangle and the square, never fails to stump people, both experienced and less so. It starts out… Continue Reading…
October 24, 2017
After we understand how to use mocks in Spring in integration tests, let’s take a look at a setup for testing a REST service that uses a dependency we want to mock. API testing is a usual integration test scenario,… Continue Reading…
October 17, 2017
Let’s continue where we’ve left off – multiple configurations for integration tests. We use different configurations when we need to inject two different sets of objects. For example a real one and mocked one of the same type for different… Continue Reading…
October 10, 2017
First, a couple of words about Spring in general as a dependency injection framework. One of the best things in Spring is its simplicity of injection. Regardless of where you are, you pop an @Autowired annotation on a class variable (which… Continue Reading…
September 23, 2017
He said: “I asked all my friends, and none of them likes TDD”. This one I haven’t heard before, although I suspect I should have at some point. Like any practice, TDD has a social side. I told him to… Continue Reading…
October 3, 2023