Add testFlush() to SkipOutputStreamTest

Signed-off-by: Graham <gpe@openrs2.dev>
bzip2
Graham 5 years ago
parent dd560c1801
commit 54aa9b738c
  1. 20
      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 org.junit.jupiter.api.Assertions.assertArrayEquals
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import java.io.FilterOutputStream
import java.io.OutputStream
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertTrue
object SkipOutputStreamTest { object SkipOutputStreamTest {
@Test @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)
}
} }

Loading…
Cancel
Save