storm-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Spico Florin <spicoflo...@gmail.com>
Subject Re: The best way to unit test a Bolt with dependency?
Date Tue, 09 Feb 2016 12:32:23 GMT
Hello!
  Set RabbitMQUtils as transient field in order to get rid of serialization
error. See if you can mock (Mockito using)  your RabbitMQ utils and inject
it via setMQ.
Hope that these help.
 Regards,
 Florin

On Tue, Jan 19, 2016 at 7:16 PM, Noppanit Charassinvichai <
noppanit.c@gmail.com> wrote:

> I'm trying to unit test my Bolt which has dependency to RabbitMQ.
>
> This is what I put in my prepare method.
>
>     @Override
>     public void prepare(Map map, TopologyContext topologyContext,
> OutputCollector outputCollector) {
>         this.outputCollector = outputCollector;
>         this.gson = new Gson();
>         this.rabbitMQUtils = new RabbitMQUtils(this.config);
>     }
>
> If I change that to inject RabbitMQUtils I get an Exception telling me
> that some classes in RabbitMQ API cannot be serialized.
>
> What do people do to unit test something like this?
>
> Thanks.
>

Mime
View raw message