I am in the progress of writing some code that prints on an org.eclipse.swt.printing.Printer
. So first step is to see how I can test this, but it seems the architecture doesn't allow me to define my own printer, since neither PrinterData
nor Printer
are interfaces as they should, or at least an abstract class.
I could probably just mock the GC
object that gets printed on, but this would be really hard since I use a third-party library to do the actual printing. (And to be honest, GC
objects are not the best for unit tests.)
Or I could just test the models before they get printed, however there is still a big step missing in the test.
Is there a way to mock a Printer
so I can test my code fully?