{
//Verify that all branches have tests
if (controller.isAllBranchesTested())
{
//Print all tests without asking if complete
new TestViewer(controller, controller.generateJUnitTest(true));
}
else
{
//Ask user if they want to print stubs
String message = "Not all tests are complete!\n"
+ "Do you want to generate stubs for incomplete test branches?";
int response = JOptionPane.showConfirmDialog(
mainFrame,
message,
"Test Generation Warning",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE);
if (response != JOptionPane.CANCEL_OPTION)
{
boolean printStubs = (response == JOptionPane.YES_OPTION);
new TestViewer(controller, controller.generateJUnitTest(printStubs));
}
}
}