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

com.testvagrant.optimus.utils.DataStore Maven / Gradle / Ivy

There is a newer version: 3.1.6
Show newest version
package com.testvagrant.optimus.utils;


import com.testvagrant.commons.entities.reportParser.ExecutedScenario;
import com.testvagrant.optimus.entity.ExceptionEntity;

import java.util.*;

public class DataStore {
    private List failedScenarios;
    private Map> failedScenarioMap;

    public DataStore() {
        failedScenarioMap = new HashMap<>();
        failedScenarios = new ArrayList<>();
    }

    public void store(ExceptionEntity exceptionEntity, ExecutedScenario scenario) {
        failedScenarioMap.put(exceptionEntity.getName(), getUpdatedRecords(failedScenarioMap,exceptionEntity.getName(),scenario));
    }


    private List getUpdatedRecords(Map> key, String exceptionKey, ExecutedScenario scenario) {
        ArrayList list = new ArrayList<>();
        if(key.containsKey(exceptionKey)) {
            list.addAll(key.get(exceptionKey));
        }
        list.add(scenario);
        return list;
    }

    public Map> getFailedScenarioMap() {
        return failedScenarioMap;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy