Simplify expression
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 6 Oct 2017 05:13:52 +0000 (07:13 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 6 Oct 2017 05:13:52 +0000 (07:13 +0200)
src/test/kotlin/net/pterodactylus/sone/web/ajax/JsonPageTest.kt

index 84fca49..ea882d3 100644 (file)
@@ -20,7 +20,7 @@ abstract class JsonPageTest(
                page.createJsonObject(freenetRequest)
        }
 
-       private val JsonReturnObject.error get() = if (this is JsonErrorReturnObject) this.error else null
+       private val JsonReturnObject.error get() = (this as? JsonErrorReturnObject)?.error
 
        protected fun assertThatJsonIsSuccessful() {
                assertThat(json.isSuccess, equalTo(true))