> On April 25, 2014, 7:54 p.m., Jakob Homan wrote:
> > samza-core/src/test/scala/org/apache/samza/system/TestSystemConsumers.scala,
> > line 68
> > <https://reviews.apache.org/r/20697/diff/2/?file=568247#file568247line68>
> >
> > We need to catch _ here and fail as well. Otherwise some problem could
> > happen in register but this would silently swallow it. Alternatively, the
> >
> > var caughtRightException = false
> > try {
> > blah
> > } catch {
> > case e: caughtRightException = true
> > }
> > assertTrue(caughtRightException)
> >
> > pattern will catch this as well.
More idiomatically, you can also use ScalaTest's "intercept" feature (which
asserts that an exception of a particular type is thrown):
intercept[SystemConsumersException] {
consumers.register(systemStreamPartition_2, "0")
}
See TestStreamMetadataCache for an example of intercept in action.
- Martin
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20697/#review41514
-----------------------------------------------------------
On April 25, 2014, 9:27 p.m., Yan Fang wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20697/
> -----------------------------------------------------------
>
> (Updated April 25, 2014, 9:27 p.m.)
>
>
> Review request for samza.
>
>
> Repository: samza
>
>
> Description
> -------
>
> Fail early when a consumer is misconfigured.
>
> 1. wraped the consumer register with try and catch
> 2. added SystemConsumerException extends SamzaException
> 3. added test for checking throwing the correct exception
>
>
> Diffs
> -----
>
> samza-core/src/main/scala/org/apache/samza/system/SystemConsumers.scala
> 7624aef
> samza-core/src/test/scala/org/apache/samza/system/TestSystemConsumers.scala
> e1b211d
>
> Diff: https://reviews.apache.org/r/20697/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Yan Fang
>
>