Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tests for void exception bug

  • Loading branch information...
commit 4855f16730f87e6c947f3f638add8fc1570d2f8b 1 parent c39d338
@bancek bancek authored
View
23 scrooge-generator/src/test/scala/com/twitter/scrooge/backend/ServiceGeneratorSpec.scala
@@ -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 {
View
6 scrooge-generator/src/test/thrift/test.thrift
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.