【发布时间】:2021-11-25 15:11:04
【问题描述】:
我正在为在 Apache 光束管道中运行的类构建单元测试。
在尝试对PCollection 进行某些操作后,我正在测试的一种方法应该引发异常。 PAssert 有没有办法期待这个异常?
例如
//Expect SomeClass to throw an exception when instantiated with this argument
val invalidParDo = ParDo.of(new SomeClass("This is an invalid parameter"))
val actualOutput = inputPCollection.apply("",invalidParDo)
//Here I'd like a way to assert that I expected a particular exception
PAssert.that(someWayToExpectExceptionHere)
testPipeline.run()
或任何类似的替代品
【问题讨论】:
标签: scala unit-testing apache-beam