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

com.capitalone.dashboard.api.domain.TestExecution Maven / Gradle / Ivy

package com.capitalone.dashboard.api.domain;

import com.google.common.collect.Iterables;

import java.net.URI;
import java.util.ArrayList;

/**
 * This class will get the details from Test Execution
 */
public class TestExecution extends VersionableIssue {
    private Iterable tests;

    public TestExecution(URI self, String key, Long id) {
        super(self, key, id);
    }

    @Override
    public TestExecution cloneTest() throws CloneNotSupportedException {
        TestExecution myTestExec=new TestExecution(getSelf(),getKey(),getId());
        if(tests!=null && !Iterables.isEmpty(tests)){
            ArrayList myTests=new ArrayList();
            for(Test t:tests){
                myTests.add(t.cloneTest());
            }
            myTestExec.tests=myTests;
        }
    return myTestExec;
    }

    public Iterable getTests()
    {
        return tests;
    }
    public void setTests(Iterable tests) {
        try {
            this.setOldVersion(this.cloneTest());
        } catch (CloneNotSupportedException e) {
            throw new IllegalArgumentException("CANNOT CLONE THIS OBJECT because of:"+e.getMessage());
        }
        this.tests = tests;
    }

    public static class Test extends VersionableIssue {
        private Integer rank;
        private TestRun.Status status;

        public Test(URI self, String key, Long id) {
            super(self, key, id);
        }

        public Test(URI self,String key,Long id,Integer rank,TestRun.Status status){
            super(self, key, id);
            this.status=status;
            this.rank=rank;
        }

        public Test cloneTest() throws CloneNotSupportedException {
            Test myTest=new Test(this.getSelf(),this.getKey(),this.getId());

            if(this.rank!=null){
                myTest.rank=rank;
            }
            //TODO: MANAGE ENUMS
            if(this.status!=null){
               myTest.status=this.status;
            }
        return myTest;}
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy