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

com.bigdata.rdf.sparql.ast.TestSolutionSetStatserator Maven / Gradle / Ivy

There is a newer version: 2.1.4
Show newest version
package com.bigdata.rdf.sparql.ast;

import com.bigdata.bop.IBindingSet;
import com.bigdata.striterator.CloseableIteratorWrapper;

import cutthecrap.utils.striterators.SingleValueIterator;

/**
 * Test suite for {@link SolutionSetStatserator}
 * 
 * @author bryan
 */
public class TestSolutionSetStatserator extends
		AbstractSolutionSetStatsTestCase {

	public TestSolutionSetStatserator() {
	}

	public TestSolutionSetStatserator(String name) {
		super(name);
	}

	@Override
	protected ISolutionSetStats newFixture(final IBindingSet[] bindingSets) {

		final SolutionSetStatserator itr = new SolutionSetStatserator(
				new CloseableIteratorWrapper(
						new SingleValueIterator(bindingSets)));
		try {
			while (itr.hasNext()) {
				// statistics filter will observed each solution set[].
				itr.next();
			}
			// Return the compiled statistics.
			return itr.getStats();
		} finally {
			itr.close();
		}
	}

    /**
     * Correct rejection test for the constructor.
     */
    public void test_001() {
        
        try {
            new SolutionSetStatserator(null);
            fail("Expecting: " + IllegalArgumentException.class);
        } catch (IllegalArgumentException ex) {
            if (log.isInfoEnabled())
                log.info("Ignoring expected exception: " + ex);
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy