I am using com.sun.codemodel.JCodeModel
to generate almost 1000 classes with associated JUnits for each one.
I also generate a JUnit Test Suite that executes the individual JUnit test cases.
To complete this code generation project i want to execute the JUnit test suite programmatically using final Result result = JUnitCore.runClasses(AllTests.class);
.
The difficulty i am having is that the execution of the JUnit Test Suite is not synchronised to the code generation. I need to be able to detect when com.sun.codemodel.JCodeModel.build()
method has completed my code generation and only then execute the JUnit Test Suite.
How can I know when com.sun.codemodel.JCodeModel.build()
method completes?
extend your class by JCodeModel and then override the build method:
@override
... build(){
super.build();
startTest();
}
then it should start after build function is finished.