T
- the input type of the Collector
.A
- the accumulator type of the Collector
.R
- the return type of the Collector
.@TestInterface(value=ch.powerunit.collector.impl.CollectorTesterImpl.class) public final class CollectorTester<T,A,R> extends Object
Collector
.
The goal of this tester is to validate a Collector
. The following
tests are done :
accumulator()
must return a
not null result.combiner()
must return a not
null result.finisher()
must return a not
null result.supplier()
must return a not
null result.characteristics()
must
return a not null result and be the same list that is specified in this
tester.withInput
- or create a stream -
withStreamFromList
or
withParallelStreamFromList
- and then execute the method
collect
with the
Collector
under test and validate the returned result.Modifier and Type | Method and Description |
---|---|
Collector<T,A,R> |
getCollectorToTest()
Used by the framework.
|
Matcher<Iterable<? extends Collector.Characteristics>> |
getExpectedCharacteristics()
Used by the framework.
|
List<Stream<T>> |
getInputs()
Used by the framework.
|
List<Matcher<? super R>> |
getResults()
Used by the framework.
|
static <T,R> CollectorTesterDSL0<T,?,R> |
of(Class<T> inputClass,
Class<T> outputClass,
Collector<T,?,R> collectorToTest)
Return a builder to create a tester of
Collector . |
static <T,R> CollectorTesterDSL0<T,?,R> |
of(Collector<T,?,R> collectorToTest)
Return a builder to create a tester of
Collector . |
public static <T,R> CollectorTesterDSL0<T,?,R> of(Collector<T,?,R> collectorToTest)
Collector
.T
- the input type of the Collector
.R
- the return type of the Collector
.collectorToTest
- the Collector
to be tested.the DSL to build the tester
public static <T,R> CollectorTesterDSL0<T,?,R> of(Class<T> inputClass, Class<T> outputClass, Collector<T,?,R> collectorToTest)
Collector
.public Collector<T,A,R> getCollectorToTest()
public List<Matcher<? super R>> getResults()
public Matcher<Iterable<? extends Collector.Characteristics>> getExpectedCharacteristics()
Copyright © 2015 Powerunit. All rights reserved.