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

ru.yandex.qatools.allure.io.TestCaseResultIterator2 Maven / Gradle / Ivy

package ru.yandex.qatools.allure.io;

import com.google.common.collect.ImmutableSet;
import ru.yandex.qatools.allure.model.TestCaseResult;
import ru.yandex.qatools.allure.model.TestSuiteResult;

import java.util.Iterator;
import java.util.NoSuchElementException;

/**
 * @author Dmitry Baev [email protected]
 *         Date: 08.10.15
 */
public class TestCaseResultIterator2 implements Iterator {

    private final Iterator testSuites;

    private Iterator current = ImmutableSet.of().iterator();

    public TestCaseResultIterator2(Reader testSuites) {
        this.testSuites = testSuites.iterator();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean hasNext() {
        if (current.hasNext()) {
            return true;
        }

        if (!testSuites.hasNext()) {
            return false;
        }

        current = new TestCaseResultIterator(testSuites.next());
        return hasNext();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public TestCaseResult next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }

        return current.next();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void remove() {
        throw new UnsupportedOperationException();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy