/*
 * (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 org.openscore.lang.tools.build.tester.parse;

import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by stoneo on 3/15/2015.
 **/
public class SlangTestCase {

    private String name;

    private String testFlowPath;

    private String description;

    private List<String> testSuits;

    private String systemPropertiesFile;

    private List<Map> inputs;

    private Boolean throwsException;

    private String result;

    public static final String BASE_TEST_SUITE = "base";

    //for jackson
    private SlangTestCase() {}

    public SlangTestCase(String name, String testFlowPath, String description, List<String> testSuits,
                         String systemPropertiesFile, List<Map> inputs,
                         Boolean throwsException, String result){
        this.name = name;
        this.testFlowPath = testFlowPath;
        this.description = description;
        this.systemPropertiesFile = systemPropertiesFile;
        if(CollectionUtils.isEmpty(testSuits)){
            this.testSuits = new ArrayList<>();
            this.testSuits.add(BASE_TEST_SUITE);
        } else {
            this.testSuits = testSuits;
        }
        this.inputs = inputs;
        this.throwsException = throwsException;
        this.result = result;
    }

    public String getName() {
        return name;
    }

    public String getTestFlowPath() {
        return testFlowPath;
    }

    public String getDescription() {
        return description;
    }

    public List<String> getTestSuits() {
        return testSuits;
    }

    public String getSystemPropertiesFile() {
        return systemPropertiesFile;
    }

    public List<Map> getInputs() {
        return inputs;
    }

    public Boolean getThrowsException() {
        return throwsException;
    }

    public String getResult() {
        return result;
    }
}

@@ -457,24 +457,49 @@
 .ArrayList;%0A
+import java.util.Arrays;%0A
 import java.
@@ -505,24 +505,24 @@
 .util.List;%0A
-
 import java.
@@ -732,16 +732,17 @@
 testSuit
+e
 s;%0A%0A    
@@ -1084,16 +1084,17 @@
 testSuit
+e
 s,%0A     
@@ -1404,174 +1404,8 @@
     
-if(CollectionUtils.isEmpty(testSuits))%7B%0A            this.testSuits = new ArrayList%3C%3E();%0A            this.testSuits.add(BASE_TEST_SUITE);%0A        %7D else %7B%0A            
 this
@@ -1413,16 +1413,17 @@
 testSuit
+e
 s = test
@@ -1430,21 +1430,12 @@
 Suit
+e
 s;%0A
-        %7D%0A
     
@@ -1784,22 +1784,145 @@
 TestSuit
+e
 s() %7B%0A
+        if(CollectionUtils.isEmpty(testSuites)) %7B%0A            this.testSuites = Arrays.asList(BASE_TEST_SUITE);%0A        %7D%0A
         
@@ -1936,16 +1936,17 @@
 testSuit
+e
 s;%0A    %7D

remove logic from constructor