I like the idea of long term learning. Keeping myself learning day by day and sharing knowledge with the community help to grow as a professional and also as a person.
Hey Milan, I think I would create another service which will use Curl to get climate data (let's name it ClimateCurlHandler). Then I would inject ClimateCurlHandler into ClimateHandler (instead of HttpClient). Then, into the test, I would create an stub for ClimateCurlHandler mocking the method which executes the curl so that it would return the response to test. Finally, I would create the stub for ClimateHandler but setting as constructor argument the ClimateCurlHandler stub.
I am sure there are other and better ways to drive your case but I think this would be valid.
I like the idea of long term learning. Keeping myself learning day by day and sharing knowledge with the community help to grow as a professional and also as a person.
Hey Milan, I think I would create another service which will use Curl to get climate data (let's name it ClimateCurlHandler). Then I would inject ClimateCurlHandler into ClimateHandler (instead of HttpClient). Then, into the test, I would create an stub for ClimateCurlHandler mocking the method which executes the curl so that it would return the response to test. Finally, I would create the stub for ClimateHandler but setting as constructor argument the ClimateCurlHandler stub.
I am sure there are other and better ways to drive your case but I think this would be valid.
You maybe missed my sarcasm there. When i used sentence "is so bright", i meant there is hard dependency, which i am unable to refactor :-(
Ah ok, I am sorry. I did missed your sarcasm