@Override
public void sessionFinished(ITestRunSession session) {
String template = Preference.TEMPLATE.getValue();
parser.setTemplate(template);
RenderedImage icon;
Result testResult = session.getTestResult(true);
InputStream input;
String notification;
if(Result.ERROR.equals(testResult)){
notification = TEST_ERROR;
input = getClass().getResourceAsStream("/icons/tsuiteerror.gif");
}else if(Result.FAILURE.equals(testResult)){
notification = TEST_FAILURE;
input = getClass().getResourceAsStream("/icons/tsuitefail.gif");
}else{
notification = TEST_OK;
input = getClass().getResourceAsStream("/icons/tsuiteok.gif");
}
String parseTemplate = parser.parseTemplate(session);
try {
icon = ImageIO.read(input);
growl.sendNotification(notification, testResult.toString(), parseTemplate, icon);
} catch (IOException e) {
e.printStackTrace();
} catch (GrowlException e) {
e.printStackTrace();
}