Replace Sone provider interface with Kotlin version
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / utils / AutoCloseableBucketTest.kt
1 package net.pterodactylus.sone.utils
2
3 import freenet.support.api.Bucket
4 import net.pterodactylus.sone.test.mock
5 import org.hamcrest.MatcherAssert.assertThat
6 import org.hamcrest.Matchers.equalTo
7 import org.junit.Test
8 import org.mockito.Mockito.verify
9
10 class AutoCloseableBucketTest {
11
12         private val bucket = mock<Bucket>()
13         private val autoCloseableBucket = AutoCloseableBucket(bucket)
14
15         @Test
16         fun `bucket can be retrieved`() {
17                 assertThat(autoCloseableBucket.bucket, equalTo(bucket))
18         }
19
20         @Test
21         fun `bucket will be free’d when close is called`() {
22                 autoCloseableBucket.close()
23                 verify(bucket).free()
24         }
25
26 }