1 package net.pterodactylus.sone.utils
3 import net.pterodactylus.sone.test.mock
4 import net.pterodactylus.sone.test.whenever
5 import net.pterodactylus.util.web.Method.GET
6 import net.pterodactylus.util.web.Method.POST
7 import net.pterodactylus.util.web.Request
8 import org.hamcrest.MatcherAssert.assertThat
9 import org.hamcrest.Matchers.equalTo
13 * Unit test for the [Request] utilities.
18 fun `GET request is recognized correctly`() {
19 val request = mock<Request>().apply { whenever(method).thenReturn(GET) }
20 assertThat(request.isGET, equalTo(true))
21 assertThat(request.isPOST, equalTo(false))
25 fun `POST request is recognized correctly`() {
26 val request = mock<Request>().apply { whenever(method).thenReturn(POST) }
27 assertThat(request.isGET, equalTo(false))
28 assertThat(request.isPOST, equalTo(true))