Permalink
Browse files

Avoid deprecated method.

  • Loading branch information...
1 parent 7e27631 commit ea1c5a7b5792cdbb4f28c6cb444fdbb391879896 @dwdyer committed Sep 1, 2011
View
@@ -5,3 +5,4 @@ dist
docs
website
release
+temp
@@ -24,7 +24,7 @@
<orderEntry type="module-library">
<library name="TestNG">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../lib/compiletime/testng/testng-5.13.1.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../lib/compiletime/testng/testng-6.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -31,6 +31,7 @@
import java.util.TreeSet;
import org.apache.velocity.VelocityContext;
import org.testng.IClass;
+import org.testng.IInvokedMethod;
import org.testng.IResultMap;
import org.testng.ISuite;
import org.testng.ISuiteResult;
@@ -196,7 +197,7 @@ private void createChronology(List<ISuite> suites, File outputDirectory) throws
int index = 1;
for (ISuite suite : suites)
{
- List<ITestNGMethod> methods = new ArrayList<ITestNGMethod>(suite.getInvokedMethods());
+ List<IInvokedMethod> methods = suite.getAllInvokedMethods();
if (!methods.isEmpty())
{
VelocityContext context = createContext();
@@ -25,6 +25,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.testng.IInvokedMethod;
import org.testng.ISuite;
import org.testng.ISuiteResult;
import org.testng.ITestContext;
@@ -227,15 +228,7 @@ public boolean hasSkipException(ITestResult result)
public String getSkipExceptionMessage(ITestResult result)
{
- if (hasSkipException(result))
- {
- SkipException se = (SkipException) result.getThrowable();
- return se.getMessage();
- }
- else
- {
- return "";
- }
+ return hasSkipException(result) ? result.getThrowable().getMessage() : "";
}
@@ -376,28 +369,28 @@ public String stripThreadName(String threadId)
* @param methods A list of test methods.
* @return The earliest start time.
*/
- public long getStartTime(List<ITestNGMethod> methods)
+ public long getStartTime(List<IInvokedMethod> methods)
{
long startTime = System.currentTimeMillis();
- for (ITestNGMethod method : methods)
+ for (IInvokedMethod method : methods)
{
startTime = Math.min(startTime, method.getDate());
}
return startTime;
}
- public long getEndTime(ISuite suite, ITestNGMethod method, List<ITestNGMethod> methods)
+ public long getEndTime(ISuite suite, IInvokedMethod method, List<IInvokedMethod> methods)
{
boolean found = false;
- for (ITestNGMethod m : methods)
+ for (IInvokedMethod m : methods)
{
if (m == method)
{
found = true;
}
// Once a method is found, find subsequent method on same thread.
- else if (found && m.getId().equals(method.getId()))
+ else if (found && m.getTestMethod().getId().equals(method.getTestMethod().getId()))
{
return m.getDate();
}
@@ -413,7 +406,7 @@ else if (found && m.getId().equals(method.getId()))
* @param suite The suite to find the end time of.
* @return The end time (as a number of milliseconds since 00:00 1st January 1970 UTC).
*/
- private long getEndTime(ISuite suite, ITestNGMethod method)
+ private long getEndTime(ISuite suite, IInvokedMethod method)
{
// Find the latest end time for all tests in the suite.
for (Map.Entry<String, ISuiteResult> entry : suite.getResults().entrySet())
@@ -27,9 +27,9 @@
<tr>
<td class="number">$velocityCount.</td>
<td class="duration">$utils.formatDuration($utils.getStartTime($methods), $method.date)s</td>
- <td>$method.realClass.name.<b>$method.methodName</b></td>
+ <td>$method.testMethod.realClass.name.<b>$method.testMethod.methodName</b></td>
<td class="duration">$utils.formatDuration($method.date, $utils.getEndTime($suite, $method, $methods))s</td>
- <td class="thread">$utils.stripThreadName($method.id)</td>
+ <td class="thread">$utils.stripThreadName($method.testMethod.id)</td>
</tr>
#end
</table>

0 comments on commit ea1c5a7

Please sign in to comment.