For unit testing, one problem I've run into is overriding the returns from
static class methods.
For instance, PutJMS contains this code:
try {
> wrappedProducer = JmsFactory.createMessageProducer(context, true);
> logger.info("Connected to JMS server {}",
> new Object[]{context.getProperty(URL).getValue()});
> } catch (final JMSException e) {
> logger.error("Failed to connect to JMS Server due to {}", new
> Object[]{e});
> session.transfer(flowFiles, REL_FAILURE);
> context.yield();
> return;
> }
>
where JmsFactory.createmessageProducer call being defined as
public static WrappedMessageProducer createMessageProducer(...
>
which presents a problem since it can't be easily overridden for a unit
test. Exercising the
How you handle this problem?
Regards,
Joe