Treat warnings as errors in moshi-kotlin tests (#730)

* Fix/supress warnings in tests

* Treat kotlinc warnings as errors in tests
This commit is contained in:
Artem Daugel-Dauge
2018-11-24 06:24:19 +03:00
committed by Jesse Wilson
parent 2265f5e9b8
commit 9aaef1f6f8
3 changed files with 9 additions and 2 deletions

View File

@@ -113,6 +113,11 @@
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
<configuration>
<args>
<arg>-Werror</arg>
</args>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>

View File

@@ -35,6 +35,7 @@ import org.junit.Test
import java.util.Locale import java.util.Locale
import kotlin.reflect.full.memberProperties import kotlin.reflect.full.memberProperties
@Suppress("UNUSED", "UNUSED_PARAMETER")
class GeneratedAdaptersTest { class GeneratedAdaptersTest {
private val moshi = Moshi.Builder().build() private val moshi = Moshi.Builder().build()
@@ -1037,7 +1038,7 @@ class GeneratedAdaptersTest {
@Test fun nullablePrimitivesUseBoxedPrimitiveAdapters() { @Test fun nullablePrimitivesUseBoxedPrimitiveAdapters() {
val moshi = Moshi.Builder() val moshi = Moshi.Builder()
.add(JsonAdapter.Factory { type, annotations, moshi -> .add(JsonAdapter.Factory { type, _, _ ->
if (Boolean::class.javaObjectType == type) { if (Boolean::class.javaObjectType == type) {
return@Factory object:JsonAdapter<Boolean?>() { return@Factory object:JsonAdapter<Boolean?>() {
override fun fromJson(reader: JsonReader): Boolean? { override fun fromJson(reader: JsonReader): Boolean? {

View File

@@ -34,6 +34,7 @@ import java.util.Locale
import java.util.SimpleTimeZone import java.util.SimpleTimeZone
import kotlin.annotation.AnnotationRetention.RUNTIME import kotlin.annotation.AnnotationRetention.RUNTIME
@Suppress("UNUSED", "UNUSED_PARAMETER")
class KotlinJsonAdapterTest { class KotlinJsonAdapterTest {
@Test fun constructorParameters() { @Test fun constructorParameters() {
val moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build() val moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build()
@@ -918,7 +919,7 @@ class KotlinJsonAdapterTest {
@Test fun nullablePrimitivesUseBoxedPrimitiveAdapters() { @Test fun nullablePrimitivesUseBoxedPrimitiveAdapters() {
val moshi = Moshi.Builder() val moshi = Moshi.Builder()
.add(JsonAdapter.Factory { type, annotations, moshi -> .add(JsonAdapter.Factory { type, _, _ ->
if (Boolean::class.javaObjectType == type) { if (Boolean::class.javaObjectType == type) {
return@Factory object: JsonAdapter<Boolean?>() { return@Factory object: JsonAdapter<Boolean?>() {
override fun fromJson(reader: JsonReader): Boolean? { override fun fromJson(reader: JsonReader): Boolean? {