Permalink
Browse files

Tests for void exception bug

  • Loading branch information...
bancek committed Nov 2, 2012
1 parent c39d338 commit 4855f16730f87e6c947f3f638add8fc1570d2f8b
@@ -239,6 +239,17 @@ class ServiceGeneratorSpec extends SpecificationWithJUnit with EvalHelper with J
client.deliver("Boston")() mustEqual 42
}
+ "success void" in {
+ val request = encodeRequest("remove", ExceptionalService.RemoveArgs(123))
+ val response = encodeResponse("remove", ExceptionalService.RemoveResult())
+
+ expect {
+ one(impl).remove(123) willReturn Future.Done
+ }
+
+ client.remove(123)() mustEqual ()
+ }
+
"exception" in {
val request = encodeRequest("deliver", ExceptionalService.DeliverArgs("Boston"))
val ex = Xception(1, "boom")
@@ -250,6 +261,18 @@ class ServiceGeneratorSpec extends SpecificationWithJUnit with EvalHelper with J
client.deliver("Boston")() must throwA[ThriftException](ex)
}
+
+ "void exception" in {
+ val request = encodeRequest("remove", ExceptionalService.RemoveArgs(123))
+ val ex = Xception(1, "boom")
+ val response = encodeResponse("remove", ExceptionalService.RemoveResult(ex = Some(ex)))
+
+ expect {
+ one(impl).remove(123) willReturn Future.exception(ex)
+ }
+
+ client.remove(123)() must throwA[ThriftException](ex)
+ }
}
"correctly inherit traits across services" in {
@@ -305,6 +305,12 @@ service ExceptionalService {
2: Xception2 ex2
3: EmptyXception ex3
)
+
+ void remove(1: i32 id) throws (
+ 1: Xception ex
+ 2: Xception2 ex2
+ 3: EmptyXception ex3
+ )
}
service ThriftTest

0 comments on commit 4855f16

Please sign in to comment.