Android security implementation Phase 0-3 finalization part 1
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package studio.daybreak.mail
|
||||
|
||||
import java.io.ByteArrayInputStream
|
||||
import org.junit.Assert.assertArrayEquals
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class BoundedInputReaderTest {
|
||||
@Test
|
||||
fun readsOnlyUpToTheRequestedLimit() {
|
||||
val input = ByteArrayInputStream(byteArrayOf(1, 2, 3, 4, 5))
|
||||
assertArrayEquals(byteArrayOf(1, 2, 3), BoundedInputReader.read(input, 3))
|
||||
assertEquals(2, input.available())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun readsShortStreamsToEnd() {
|
||||
assertArrayEquals(
|
||||
byteArrayOf(1, 2),
|
||||
BoundedInputReader.read(ByteArrayInputStream(byteArrayOf(1, 2)), 5)
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user