001/* 002 * Licensed to the author under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package de.cuioss.test.generator.internal.net.java.quickcheck; 018 019/** 020 * <p> 021 * A characteristic specifies an aspect of a system under test. 022 * </p> 023 * <p> 024 * The characteristic stated is tested with a number of test data instances 025 * generated by a generator. All runs of a characteristic's 026 * {@link Characteristic#specify(Object)} method have to be valid. Invalid runs 027 * have to throw an exception. 028 * </p> 029 * 030 * @param <T> 031 * type of generated random test instances 032 * 033 */ 034@SuppressWarnings("ProhibitedExceptionDeclared") 035public interface Characteristic<T> { 036 037 /** 038 * Checks the characteristic's specification for a test case instance. 039 * 040 * @param instance 041 * for which to check the characteristic 042 * @throws Throwable 043 * if the instance does not confirm to the characteristic's 044 * specification 045 */ 046 void specify(T instance) throws Throwable; 047 048 /** 049 * Set up operation before {@link Characteristic#specify(Object)} is 050 * executed. 051 */ 052 void setUp() throws Exception; 053 054 /** 055 * Clean up operation after {@link Characteristic#specify(Object)} was 056 * executed. 057 */ 058 void tearDown() throws Exception; 059 060 /** 061 * Unique name for this characteristic instance. 062 * 063 * @return name of the characteristic. 064 */ 065 String name(); 066}