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; 021 022import java.lang.annotation.Documented; 023import java.lang.annotation.ElementType; 024import java.lang.annotation.Retention; 025import java.lang.annotation.RetentionPolicy; 026import java.lang.annotation.Target; 027 028/** 029 * Field marker (public non static field), for parameterized test. 030 * <p> 031 * The field must be numbered (using {@link #value()}) from 0 to n, in a 032 * continuous way. 033 * <p> 034 * For example, a parameter field can be defined in the following way: 035 * 036 * <pre> 037 * @Parameter(0) 038 * public String fieldName; 039 * </pre> 040 * 041 * @author borettim 042 * @see Parameters 043 */ 044@Documented 045@Retention(RetentionPolicy.RUNTIME) 046@Target(ElementType.FIELD) 047public @interface Parameter { 048 /** 049 * Define the parameter position. 050 * 051 * @return the parameter position (0-based). 052 */ 053 int value(); 054 055 /** 056 * This attribute can be used to indicate that this parameter is to be used 057 * as a predicate to accept (or not) a test for execution with this 058 * parameter set. 059 * <p> 060 * This is false by default and when set to true, only one field can it. 061 * This can only be used on field of type : 062 * 063 * <pre> 064 * BiFunction<String,Object[],Boolean> 065 * </pre> 066 * 067 * This predicate will receive as parameter the test method name and the 068 * parameter array and should return true if and only if the test method 069 * should be run. 070 * 071 * @return the filtering status. 072 * @since 0.1.0 073 * @see java.util.function.BiFunction 074 */ 075 boolean filter() default false; 076}