Merge branch 'release-0.9.7'
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / utils / BooleansTest.kt
1 package net.pterodactylus.sone.utils
2
3 import org.hamcrest.MatcherAssert.assertThat
4 import org.hamcrest.Matchers.equalTo
5 import org.hamcrest.Matchers.nullValue
6 import org.junit.Test
7
8 /**
9  * Unit test for [Booleans].
10  */
11 class BooleansTest {
12
13         @Test
14         fun `ifTrue is executed if boolean is true`() {
15                 assertThat(true.ifTrue { true }, equalTo(true))
16         }
17
18         @Test
19         fun `ifTrue is not executed if boolean is false`() {
20                 assertThat(false.ifTrue { true }, nullValue())
21         }
22
23         @Test
24         fun `ifFalse is executed if boolean is false`() {
25                 assertThat(false.ifFalse { true }, equalTo(true))
26         }
27
28         @Test
29         fun `ifFalse is not executed if boolean is true`() {
30                 assertThat(true.ifFalse { true }, nullValue())
31         }
32
33 }