/** * This method is here to try and isolate the Azure related code as the PartitionReceiver cannot * be mocked with PowerMock due to it being final. Unfortunately it extends a base class and does * not implement an interface so even if we create a MockPartitionReciver, it will not work as the * two classes are orthogonal. * * @param context - The processcontext for this processor * @param partitionId - The partition ID to retrieve a receiver by. * @return - Returns the events received from the EventBus. * @throws ProcessException -- If any exception is encountered, receiving events it is wrapped in * a ProcessException and then that exception is thrown. */ protected Iterable<EventData> receiveEvents( final ProcessContext context, final String partitionId) throws ProcessException { final PartitionReceiver receiver; try { receiver = getReceiver(context, partitionId); return receiver.receive(100).get(); } catch (final IOException | ServiceBusException | ExecutionException | InterruptedException e) { throw new ProcessException(e); } }