Last year I saw a tweet that a failing unit test was "a message from the past from someone that cared".
I was reminded of this recently when picking up a project that hadn't been touched for over 2 years. One of the acceptance tests failed with the following error:
The error message was sufficiently detailed to lead me straight to the solution. Thankfully the test writer1 had cared enough to make sure that the failing test provided sufficient detail to be easily fixed.
The original tweeter was no doubt referring to failing unit tests helping to detect unwanted code regressions. When relying on external configuration or data, tests should also check any assumptions they are making about the data. In this case, the Given clause of the "Given-When-Then" statement is clear about its expectations, and the test fixture is checking that these preconditions are met.
This type of environment issue could even be treated as a different type of test failure, as discussed in Triaging Test Failures.
1 OK the test writer was me :-) But since I hadn't worked on the application for over 2 years, it may as well have been someone else!
Difference Between JDK Vs. JRE Vs. JVM
2 hours ago