Reputation: 915
I wish to unit test a camel route that looks as follows:
from("file://config")
.process(configProcessor)
I've replaced the from with a direct endpoint using adviceWith and have a producer template to send a test exchange, however the body of the In exchange in the configProcessor
is of the type File and questions like Mocking Files in Java - Mock Contents - Mockito recommend against trying to mock File objects.
Is it possible to pass another object that extends File but doesn't write to disk, or should I create a temporary file, or even refactor the configProcessor
to split out the I/O from the processing?
Upvotes: 2
Views: 1253
Reputation: 915
In the end I chose to split out the processing by making it a separate function from process()
. It's not quite what I'd hoped for, but it works.
Upvotes: 1