The simplest form of override encapsulation allows you to inject simple data into the software under test. No matter how much you model actors in your system as objects, attributes are still the fundamental building blocks. Let’s start by using encapsulation and overriding with basic data types as shown in Listing 8-1.
Listing 8-1: Code under test for basic data type injection
public class TemperatureWatcher { public static final double REALLY_COLD_F = 0.0; public static final double REALLY_HOT_F = 100.0; public static final String REALLY_COLD_RESPONSE = "Really cold!"; public static final String REALLY_HOT_RESPONSE = "Really hot!"; public static final String NORMAL_RESPONSE = "Okay"; ...
No credit card required