Add Unit Test to Processors
This Merge will fix #51 (closed) #53 (closed) #54 (closed)
To test a Processor a small environment mock around the simulation state is created. Each processor is called within the main loop to update its output based on the current simulation state. To test the processor in isolation a couple of simulationstate mocks (Mockito) are created. Within these mocked states only the needed data is provided to perform the tasks of the processor.
To ease the creation of tests some additional refactoring was introduced:
- Factory Pattern for OutputFile (OutputFileFactory)
- Factory Pattern for DataProcessor (DataProcessorFactory)
- OutputFileMap Annotation
- VadereWriter Interface with two implementations ( VadereStringWriter, VadereFileWriter)
Factory Pattern OutputFile/ DataProcessor
Both Classes are wrapper for the existing DynamicClassInstantiator. Additional functions within the OutputFileFactory are introduced to create OutputFiles based on the DataKey Class. 365ef142
OutputFileMap Annotation
Within the gui the creation of a list of all outputprocessors is created with reflection. This implementation created an exception (In ClassFinder.java) because the factory classes did not match the expected definition. As a hotfix this annotation was introduced to fix this issue. d7aaeb89
VadereWriter Interface
This interface allows to swap out how the collected data within a processor is persisted. The VadereFileWriter contains the standard implementation were data is written to an outputfile on the filesystem. VadereStringWriter will produce a String representation of the output which would be written to a file. The next possible implementation would be a database storage.