Make "no adapter" error message friendlier.

In the very common case, there are no JsonQualifier annotations for the type.
This commit is contained in:
Eric Cochran
2018-04-08 00:48:38 -07:00
parent 2cc878da81
commit ba1318cc45
8 changed files with 28 additions and 20 deletions

View File

@@ -438,7 +438,7 @@ class KotlinJsonAdapterTest {
moshi.adapter(Triple::class.java)
fail()
} catch (e: IllegalArgumentException) {
assertThat(e).hasMessage("Platform class kotlin.Triple annotated [] "
assertThat(e).hasMessage("Platform class kotlin.Triple (with no annotations) "
+ "requires explicit JsonAdapter to be registered")
}
}
@@ -609,7 +609,7 @@ class KotlinJsonAdapterTest {
fail()
} catch (e: IllegalArgumentException) {
assertThat(e).hasMessage("No JsonAdapter for interface " +
"com.squareup.moshi.kotlin.KotlinJsonAdapterTest\$Interface annotated []")
"com.squareup.moshi.kotlin.KotlinJsonAdapterTest\$Interface (with no annotations)")
}
}