Jake Wharton

Results 1657 comments of Jake Wharton

The linked API is notably different (and more usable, not that I'm biased as its author) than JUnit and kotlin.test. In Kotlin, for JUnit, you have to use `assertThrows(IllegalStateException::class.java) {...

Yep, that'll work! I also flip the parameter to a receiver, but that requires one extension per subject type instead of the `invoke` trick.

No. The parameter becomes a receiver of the extension. ```kotlin fun String.assertThat(assertions: StringSubject.() -> Unit) = assertThat(this).assertions() ```

Well the input is rarely so trivial. ```kotlin getApi() .makeSomeCall() .performSomeAction() .assertThat { isNotEmpty() isEqualTo("hello") } ```

In general, extension methods are considered the most idiomatic in Kotlin due to their discoverability. You never need to know where a function lives, because the IDE will suggest all...

That would mean Truth would have to be on your non-test classpath which seems like a larger problem. In a test context, though, you can invoke assertions on any object...

I do/did separate production and internal already. You certainly can use a third stage for local builds by a developer but there's a few things at play: 1. the app...

InvocationTargetException always wraps another exception (potentially recursively, as evidenced by the included trace) as a result of reflective invocation, so not including it as a potential cause would be a...

How did you get the ByteString? If it's a segmented one (obtained from readByteString) it actually won't copy. In general, I've had this use case at least 10 times over...

It is On Thu, Sep 10, 2020, at 5:06 PM, Louis CAD wrote: > > Also, maybe there could be some emphasis about the fact that this library is for...