christiangruber
05/20/2017, 12:49 AMchangd
09/03/2019, 5:15 PMassertFailsWith
val exception = assertFailsWith<DroidLoggerConfigurationException> {
createDroidLoggerConfiguration(ip, port)
}
assertThat("IPV4 address $ip is not valid").isEqualTo(exception.message)
I've seen this snippet being included in many GH repos https://github.com/JakeWharton/SdkSearch/blob/17c25e0b297ec2f7047803fd92888fa8b92ba7b5/backend/dac-proxy/src/test/java/com/jakewharton/sdksearch/proxy/truth.kt#L6
Can that be added to Truth itself?christiangruber
09/03/2019, 6:55 PMchristiangruber
09/03/2019, 6:59 PMchangd
09/03/2019, 11:15 PMkotlin.test.asssertFailsWith<>
. We have a custom linter that dissuades developers from using non-Truth assertions, but we'll whitelist assertFailsWith
specifically.
There's no terribly important reason it needs to be in truth.I agree, but it's important for consistency and reduce confusion for devs on which APIs to use. I filed: https://github.com/google/truth/issues/621
christiangruber
09/03/2019, 11:38 PMchristiangruber
09/03/2019, 11:42 PM