001/* 002 * Copyright 2023 the original author or authors. 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package de.cuioss.test.valueobjects.api.property; 017 018import static java.lang.annotation.ElementType.METHOD; 019import static java.lang.annotation.ElementType.TYPE; 020import static java.lang.annotation.RetentionPolicy.RUNTIME; 021 022import java.lang.annotation.Retention; 023import java.lang.annotation.Target; 024import java.util.Collection; 025 026import de.cuioss.test.valueobjects.property.PropertyMetadata; 027import de.cuioss.test.valueobjects.property.util.AssertionStrategy; 028import de.cuioss.tools.property.PropertyMemberInfo; 029import de.cuioss.tools.property.PropertyReadWrite; 030 031/** 032 * While the test classes are capable of auto-detecting JavaProperties you need 033 * to adjust them from time to time. With this annotation you can do this for 034 * all properties detected 035 * 036 * @author Oliver Wolff 037 */ 038@Retention(RUNTIME) 039@Target({ TYPE, METHOD }) 040public @interface PropertyReflectionConfig { 041 042 /** 043 * @return boolean indicating whether to scan the class at all. if it is set 044 * {@code true} there will be no scanning at all. 045 */ 046 boolean skip() default false; 047 048 /** 049 * @return an array of properties, identified by their names that are not to be 050 * considered for the tests: black-list. At this level of configuration 051 * this will skip the actual reflection-based scanning for that 052 * properties as well 053 */ 054 String[] exclude() default {}; 055 056 /** 057 * @return an array of properties, identified by their names that are to be 058 * considered for the tests: white-list 059 */ 060 String[] of() default {}; 061 062 /** 063 * @return an array of properties, identified by their names that are to be 064 * treated as required properties, see 065 * {@link PropertyMetadata#isRequired()} 066 */ 067 String[] required() default {}; 068 069 /** 070 * @return an array of properties, identified by their names that are to be 071 * treated as transient properties, see 072 * {@link PropertyMemberInfo#TRANSIENT} 073 */ 074 String[] transientProperties() default {}; 075 076 /** 077 * @return an array of properties, identified by their names that are to be 078 * treated as having a default values, see 079 * {@link PropertyMetadata#isDefaultValue()} 080 */ 081 String[] defaultValued() default {}; 082 083 /** 084 * @return an array of properties, identified by their names that are to be 085 * treated as being read-only, see {@link PropertyReadWrite#READ_ONLY}, 086 * usually used in conjunction with {@link #defaultValued()} 087 */ 088 String[] readOnly() default {}; 089 090 /** 091 * @return an array of properties, identified by their names that are to be 092 * treated as being write-only, see 093 * {@link PropertyReadWrite#WRITE_ONLY}, usually used in cases where a 094 * property to be written will result in other properties but itself can 095 * not be accessed directly 096 */ 097 String[] writeOnly() default {}; 098 099 /** 100 * @return an array of properties, identified by their names representing at 101 * least a {@link Collection} that are to be asserted ignoring the 102 * concrete order, see {@link PropertyConfig#assertionStrategy()} and 103 * {@link AssertionStrategy#COLLECTION_IGNORE_ORDER}. The default 104 * implementation will always respect / assert the same order of 105 * elements. 106 */ 107 String[] assertUnorderedCollection() default {}; 108}