/*
 * (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0 which accompany this distribution.
 *
 * The Apache License is available at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 */
package io.cloudslang.lang.tools.build.tester;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * Created by stoneo on 4/27/2015.
 **/

/**
 * Holds the results of running the content test cases
 */
public class RunTestsResults {

    private Map<String, TestRun> passedTests;

    private Map<String, TestRun> failedTests;

    private Map<String, TestRun> skippedTests;

    private Set<String> coveredExecutables;

    private Set<String> uncoveredExecutables;

    public RunTestsResults(){
        this.passedTests = new HashMap<>();
        this.failedTests = new HashMap<>();
        this.skippedTests = new HashMap<>();
        coveredExecutables = new HashSet<>();
        uncoveredExecutables = new HashSet<>();
    }

    public Map<String, TestRun> getPassedTests() {
        return passedTests;
    }

    public Map<String, TestRun> getFailedTests() {
        return failedTests;
    }

    public Map<String, TestRun> getSkippedTests() {
        return skippedTests;
    }

    public Set<String> getCoveredExecutables() {
        return coveredExecutables;
    }

    public Set<String> getUncoveredExecutables() {
        return uncoveredExecutables;
    }

    public void addPassedTest(String testCaseName, TestRun testRun){
        passedTests.put(testCaseName, testRun);
    }

    public void addFailedTest(String testCaseName, TestRun testRun){
        failedTests.put(testCaseName, testRun);
    }

    public void addSkippedTest(String testCaseName, TestRun testRun){
        skippedTests.put(testCaseName, testRun);
    }

    public void addCoveredExecutables(Set<String> coveredExecutables){
        this.coveredExecutables.addAll(coveredExecutables);
    }

    public void addUncoveredExecutables(Set<String> uncoveredExecutables){
        this.uncoveredExecutables.addAll(uncoveredExecutables);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        RunTestsResults that = (RunTestsResults) o;

        if (passedTests != null ? !passedTests.equals(that.passedTests) : that.passedTests != null)
            return false;
        if (failedTests != null ? !failedTests.equals(that.failedTests) : that.failedTests != null)
            return false;
        return !(skippedTests != null ? !skippedTests.equals(that.skippedTests) : that.skippedTests != null);

    }

    @Override
    public int hashCode() {
        int result = passedTests != null ? passedTests.hashCode() : 0;
        result = 31 * result + (failedTests != null ? failedTests.hashCode() : 0);
        result = 31 * result + (skippedTests != null ? skippedTests.hashCode() : 0);
        return result;
    }
}

@@ -413,23 +413,19 @@
 va.util.
-HashSet
+Map
 ;%0Aimport
@@ -427,35 +427,35 @@
 mport java.util.
-Map
+Set
 ;%0Aimport java.ut
@@ -453,24 +453,28 @@
 t java.util.
+Tree
 Set;%0A%0A/**%0A *
@@ -753,32 +753,36 @@
 s;%0A%0A    private 
+Tree
 Set%3CString%3E cove
@@ -810,16 +810,20 @@
 private 
+Tree
 Set%3CStri
@@ -1037,36 +1037,36 @@
 ecutables = new 
-Hash
+Tree
 Set%3C%3E();%0A       
@@ -1093,20 +1093,20 @@
 s = new 
-Hash
+Tree
 Set%3C%3E();

Make the lists of covered & uncovered flows sorted