Skip to content

Instantly share code, notes, and snippets.

@invkrh
Last active November 24, 2017 10:15
Show Gist options
  • Save invkrh/93c455a4f751d755a1a5 to your computer and use it in GitHub Desktop.
Save invkrh/93c455a4f751d755a1a5 to your computer and use it in GitHub Desktop.
input mocking for test need
object test extends App {
import scala.collection.JavaConversions.asJavaEnumeration
import java.io.{ByteArrayInputStream, SequenceInputStream}
val inputs = Iterator("asdf", "qewr", "wert")
.map(x => new ByteArrayInputStream((x + "\n").getBytes))
val in = new SequenceInputStream(asJavaEnumeration(inputs))
Console.setIn(in)
val a = readLine()
val b = readLine()
val c = readLine()
println(List(a, b, c))
}
@hamidr
Copy link

hamidr commented Nov 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment