All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.testng.reporters.jq.ResultsByClass Maven / Gradle / Ivy

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();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy