Adds more comprehensive implementation for writing concrete JUnit tests

variable initializations should be separated from the normal
statements; the required mappings for each mapping need to be checked;
if more than one mapping has the same required mapping, this required
mapping should just appear once