I\'m trying to build an automatic testing framework (based on jUnit, but that\'s no important) for my students\' homework. They will have to create constructors for some cla
You could distribute the following source code with your assignment. Tell the students to include it in their source code. Their code won't compile unless they code an Assignment class with the proper signature. The compiler does the signaure checking for you.
Then your testing program does not need to use reflection. Just instantiate an AssignmentFactory and call the make method with the proper arguments.
If you use this idea, your new challenge will be some students modifying AssignmentFactory to fit their Assignment class (breaking your testing program).
package assignment ;
public class AssignmentFactory
{
public AssignmentFactory ( )
{
super ( ) ;
}
public AssignmentFactory make ( .... parameters )
{
return new Assignment ( .... arguments ) ;
}
}