+ @Test
+ fun `onTrue returns true on true`() {
+ assertThat(true.onTrue {}, equalTo(true))
+ }
+
+ @Test
+ fun `onTrue returns false on false`() {
+ assertThat(false.onTrue {}, equalTo(false))
+ }
+
+ @Test
+ fun `onTrue is not executed on false`() {
+ assertThat(false.onTrue { throw RuntimeException() }, equalTo(false))
+ }
+
+ @Test(expected = RuntimeException::class)
+ fun `onTrue is executed on true`() {
+ true.onTrue { throw RuntimeException() }
+ }
+
+ @Test
+ fun `onFalse returns true on true`() {
+ assertThat(true.onFalse {}, equalTo(true))
+ }
+
+ @Test
+ fun `onFalse returns false on false`() {
+ assertThat(false.onFalse {}, equalTo(false))
+ }
+
+ @Test
+ fun `onFalse is not executed on true`() {
+ assertThat(true.onFalse { throw RuntimeException() }, equalTo(true))
+ }
+
+ @Test(expected = RuntimeException::class)
+ fun `onFalse is executed on false`() {
+ false.onFalse { throw RuntimeException() }
+ }
+