Browse Source
The tests were set up to expect an IllegalArgumentException when the Config.getInt method was called with a section.key that has not been set, or explicitly set to an empty string. However, the IllegalArgumentException never gets thrown because the getInt method returns the provided default ("1"), and because there was no call to "fail" after getInt, the incorrect behavior of the test was not noticed. Remove the try/catch around getInt, and instead assert that the expected default value is returned. Found by Error Prone, which reported: Not calling fail() when expecting an exception masks bugs See https://errorprone.info/bugpattern/MissingFail Change-Id: Ie8e692aba9fb8523241fb8f298d57493923d9f78 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>stable-5.2
David Pursehouse
6 years ago
1 changed files with 2 additions and 10 deletions
Loading…
Reference in new issue