There is another approach. Just silent the warning in the unit test and let it throw in production.