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

com.ecfeed.junit.main.processor.TupleProcessorDynamic Maven / Gradle / Ivy

Go to download

An open library used to connect to the ecFeed service. It can be also used as a standalone testing tool. It is integrated with Junit5 and generates a stream of test cases using a selected algorithm (e.g. Cartesian, N-Wise). There are no limitations associated with the off-line version but the user cannot access the on-line computation servers and the model database.

The newest version!
package com.ecfeed.junit.main.processor;

import com.ecfeed.core.generators.algorithms.AbstractAlgorithm;
import com.ecfeed.core.generators.api.GeneratorException;
import com.ecfeed.core.model.ChoiceNode;

import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;


public class TupleProcessorDynamic {

    private final Optional> fGenerator;
    private final Consumer> fConsumer;

    public TupleProcessorDynamic(Optional> generator, Consumer> consumer) {
        fGenerator = generator;
        fConsumer = consumer;
    }

    public void process() {
        if (!fGenerator.isPresent()) {
            return;
        }

        List tuple = null;

        try {
            tuple = fGenerator.get().getNext();
        } catch (GeneratorException e) {
            e.printStackTrace();
        }

        do {

            fConsumer.accept(tuple);

            try {
                tuple = fGenerator.get().getNext();
            } catch (GeneratorException e) {
                e.printStackTrace();
            }

        } while (tuple != null);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy