org.testng.reporters.jq.ResultsByClass Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testng Show documentation
Show all versions of testng Show documentation
Testing framework for Java
package org.testng.reporters.jq;
import org.testng.ITestResult;
import org.testng.collections.ListMultiMap;
import org.testng.collections.Maps;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
public class ResultsByClass {
public static final Comparator METHOD_NAME_COMPARATOR =
new Comparator() {
@Override
public int compare(ITestResult arg0, ITestResult arg1) {
return arg0.getMethod().getMethodName().compareTo(arg1.getMethod().getMethodName());
}
};
private ListMultiMap, ITestResult> m_results = Maps.newListMultiMap();
public void addResult(Class c, ITestResult tr) {
m_results.put(c, tr);
}
public List getResults(Class c) {
List result = m_results.get(c);
Collections.sort(result, METHOD_NAME_COMPARATOR);
return result;
}
public Set> getClasses() {
return m_results.keySet();
}
}