Composite objects – (how) do you assert them?
Let me start with a code sample (in java) that will demonstrate what I am going to talk about: … private IMAPService _mapService; public RealEstateField createField(List<Coordinate> coordinates) { RealEstateField field = new RealEstateField(); field.setCoordinates(coordinates)); field.setAddress(_mapService.findAddress(coordinates)); double surface = _mapService.calcSurface(coordinates)); field.setSurface(surface); field.setCenter(_mapService.findCenter(coordinates)); field.setPrice(surface * _pricePerMeter); //… […]
Unit tests, do they worth it?
Often I hear people doubting the effectiveness of unit tests, they usually say “most bugs we encounter with are ‘integration bugs’”, “they usually happen due to integration flaws with the DB, with some external API, with some configuration, etc.” Do they right? Well, it depends. Consider the following scenario in which I am sure you’ve been […]