Add test for error return object
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Sep 2017 17:28:45 +0000 (19:28 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Sep 2017 17:55:30 +0000 (19:55 +0200)
src/test/kotlin/net/pterodactylus/sone/web/ajax/JsonErrorReturnObjectTest.kt [new file with mode: 0644]

diff --git a/src/test/kotlin/net/pterodactylus/sone/web/ajax/JsonErrorReturnObjectTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/ajax/JsonErrorReturnObjectTest.kt
new file mode 100644 (file)
index 0000000..bf61e2e
--- /dev/null
@@ -0,0 +1,24 @@
+package net.pterodactylus.sone.web.ajax
+
+import org.hamcrest.MatcherAssert.assertThat
+import org.hamcrest.Matchers.equalTo
+import org.junit.Test
+
+/**
+ * Unit test for [JsonErrorReturnObject].
+ */
+class JsonErrorReturnObjectTest {
+
+       private val returnObject = JsonErrorReturnObject("nope")
+
+       @Test
+       fun `error return object is not successful`() {
+               assertThat(returnObject.isSuccess, equalTo(false))
+       }
+
+       @Test
+       fun `error return object exposes error`() {
+               assertThat(returnObject.error, equalTo("nope"))
+       }
+
+}