001/** 002 * Powerunit - A JDK1.8 test framework 003 * Copyright (C) 2014 Mathieu Boretti. 004 * 005 * This file is part of Powerunit 006 * 007 * Powerunit is free software: you can redistribute it and/or modify 008 * it under the terms of the GNU General Public License as published by 009 * the Free Software Foundation, either version 3 of the License, or 010 * (at your option) any later version. 011 * 012 * Powerunit is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 015 * GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU General Public License 018 * along with Powerunit. If not, see <http://www.gnu.org/licenses/>. 019 */ 020package ch.powerunit.collector.lang; 021 022import org.hamcrest.Matcher; 023 024/** 025 * DSL step of the builder of {@link java.util.stream.Collector Collector 026 * tester}. 027 * 028 * @author borettim 029 * @param <T> 030 * the input type of the {@link java.util.stream.Collector Collector} 031 * . 032 * @param <A> 033 * the accumulator type of the {@link java.util.stream.Collector 034 * Collector}. 035 * @param <R> 036 * the return type of the {@link java.util.stream.Collector 037 * Collector}. 038 * @since 0.4.0 039 */ 040public interface CollectorTesterDSL2<T, A, R> { 041 /** 042 * Validate that the result of the 043 * {@link java.util.stream.Stream#collect(java.util.stream.Collector)} with 044 * the {@link java.util.stream.Collector Collector} under test and the 045 * current sample return a value matching this matcher. 046 * 047 * @param matching 048 * the matcher. 049 * @return {@link CollectorTesterDSL1 the next step of the DSL} 050 */ 051 CollectorTesterDSL1<T, A, R> expecting(Matcher<? super R> matching); 052 053 /** 054 * Validate that the result of the 055 * {@link java.util.stream.Stream#collect(java.util.stream.Collector)} with 056 * the {@link java.util.stream.Collector Collector} under test and the 057 * current sample return a value that is the received one. 058 * 059 * @param value 060 * the exepcted value. 061 * @return {@link CollectorTesterDSL1 the next step of the DSL} 062 */ 063 CollectorTesterDSL1<T, A, R> expecting(R value); 064 065 /** 066 * Validate that the result of the 067 * {@link java.util.stream.Stream#collect(java.util.stream.Collector)} with 068 * the {@link java.util.stream.Collector Collector} under test and the 069 * current sample return a value that is null. 070 * 071 * 072 * @return {@link CollectorTesterDSL1 the next step of the DSL} 073 */ 074 CollectorTesterDSL1<T, A, R> expectingNull(); 075}