From fbdfcedba2d34ee9a214dd6bb70cc10ed129cbfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 7 Apr 2020 10:14:17 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=94=A5=20Remove=20auto-closeable=20bucket?= =?utf8?q?=20wrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../sone/utils/AutoCloseableBucket.kt | 11 --------- .../sone/utils/AutoCloseableBucketTest.kt | 26 ---------------------- 2 files changed, 37 deletions(-) delete mode 100644 src/main/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucket.kt delete mode 100644 src/test/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucketTest.kt diff --git a/src/main/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucket.kt b/src/main/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucket.kt deleted file mode 100644 index 58c181f..0000000 --- a/src/main/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucket.kt +++ /dev/null @@ -1,11 +0,0 @@ -package net.pterodactylus.sone.utils - -import freenet.support.api.Bucket - -class AutoCloseableBucket(val bucket: Bucket) : AutoCloseable { - - override fun close() { - bucket.free() - } - -} diff --git a/src/test/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucketTest.kt b/src/test/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucketTest.kt deleted file mode 100644 index a705844..0000000 --- a/src/test/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucketTest.kt +++ /dev/null @@ -1,26 +0,0 @@ -package net.pterodactylus.sone.utils - -import freenet.support.api.Bucket -import net.pterodactylus.sone.test.mock -import org.hamcrest.MatcherAssert.assertThat -import org.hamcrest.Matchers.equalTo -import org.junit.Test -import org.mockito.Mockito.verify - -class AutoCloseableBucketTest { - - private val bucket = mock() - private val autoCloseableBucket = AutoCloseableBucket(bucket) - - @Test - fun `bucket can be retrieved`() { - assertThat(autoCloseableBucket.bucket, equalTo(bucket)) - } - - @Test - fun `bucket will be free’d when close is called`() { - autoCloseableBucket.close() - verify(bucket).free() - } - -} -- 2.7.4