blob: 59af305cb37916ca6f8a41d74d8778be07d34d65 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package ch.jodersky.flow
import akka.actor.ActorSystem
import akka.io.IO
import akka.testkit.{ImplicitSender, TestKit}
import org.scalatest._
class SerialManagerSpec
extends TestKit(ActorSystem("serial-manager"))
with ImplicitSender
with WordSpecLike
with Matchers
with BeforeAndAfterAll
with PseudoTerminal {
override def afterAll {
TestKit.shutdownActorSystem(system)
}
"Serial manager" should {
val manager = IO(Serial)
"open an existing port" in {
withEcho{ case (port, settings) =>
manager ! Serial.Open(port, settings)
expectMsgType[Serial.Opened]
}
}
"fail opening a non-existing port" in {
val cmd = Serial.Open("nonexistent", SerialSettings(115200))
manager ! cmd
assert(expectMsgType[Serial.CommandFailed].command == cmd)
}
}
}
|