From 54aa9b738c09f286a024218c440a268de5975907 Mon Sep 17 00:00:00 2001 From: Graham Date: Mon, 13 Apr 2020 20:57:22 +0100 Subject: [PATCH] Add testFlush() to SkipOutputStreamTest Signed-off-by: Graham --- .../openrs2/util/io/SkipOutputStreamTest.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/util/src/test/java/dev/openrs2/util/io/SkipOutputStreamTest.kt b/util/src/test/java/dev/openrs2/util/io/SkipOutputStreamTest.kt index 5ee2f07a09..7e359ba6bf 100644 --- a/util/src/test/java/dev/openrs2/util/io/SkipOutputStreamTest.kt +++ b/util/src/test/java/dev/openrs2/util/io/SkipOutputStreamTest.kt @@ -2,7 +2,10 @@ package dev.openrs2.util.io import org.junit.jupiter.api.Assertions.assertArrayEquals import java.io.ByteArrayOutputStream +import java.io.FilterOutputStream +import java.io.OutputStream import kotlin.test.Test +import kotlin.test.assertTrue object SkipOutputStreamTest { @Test @@ -48,4 +51,21 @@ object SkipOutputStreamTest { } } } + + @Test + fun testFlush() { + val out = object : FilterOutputStream(OutputStream.nullOutputStream()) { + var flushed = false + + override fun flush() { + flushed = true + } + } + + SkipOutputStream(out, 0).use { skip -> + skip.flush() + } + + assertTrue(out.flushed) + } }