Eugen Martynov
03/18/2026, 8:28 AMwith(assertIs<HomeFeedResult.Error>(repository.fetchHomePageFeedsMetaData(10))) {
with(assertIs<HomeFeedException.ServerError>(exception)) {
assertEquals(404, code)
assertTrue(message.orEmpty().contains("Server error 404"))
}
}
Looks a bit hard to read and assertK is doing it in a better way.Javier
03/18/2026, 9:06 AMval foo: Foo = …
with(foo) { … }CLOVIS
03/18/2026, 11:21 AMval metadata = repository.fetchHomePageFeedsMetaData(10)
assertIs<HomeFeedResult.Error>(metadata)
val exception = assertIs<HomeFeedException.ServerError>(metadata.exception)
assertEquals(404, exception.code)
assertTrue(exception.message.orEmpty().contains("Server error 404"))CLOVIS
03/18/2026, 11:22 AMEugen Martynov
03/18/2026, 11:22 AMEugen Martynov
03/18/2026, 11:22 AMCLOVIS
03/18/2026, 11:24 AM@IgnorableReturnValueCLOVIS
03/18/2026, 11:27 AMCLOVIS
03/18/2026, 11:27 AMassertIs smart-casts the value so you shouldn't have to create a variable, you can use your existing oneEugen Martynov
03/18/2026, 11:28 AM