Code with Finding: |
class XMLReporter {
/**
* Add started-at, finished-at and duration-ms attributes to the <suite> tag
*/
public static void addDurationAttributes(XMLReporterConfig config, Properties attributes,
Date minStartDate, Date maxEndDate) {
SimpleDateFormat format = new SimpleDateFormat(config.getTimestampFormat());
TimeZone utc = TimeZone.getTimeZone("UTC");
format.setTimeZone(utc);
String startTime = format.format(minStartDate);
String endTime = format.format(maxEndDate);
long duration = maxEndDate.getTime() - minStartDate.getTime();
attributes.setProperty(XMLReporterConfig.ATTR_STARTED_AT, startTime);
attributes.setProperty(XMLReporterConfig.ATTR_FINISHED_AT, endTime);
attributes.setProperty(XMLReporterConfig.ATTR_DURATION_MS, Long.toString(duration));
}
}
|