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.object;
017
018import static java.lang.annotation.ElementType.TYPE;
019import static java.lang.annotation.RetentionPolicy.RUNTIME;
020
021import java.lang.annotation.Retention;
022import java.lang.annotation.Target;
023
024/**
025 * Simple annotation for extended configuration of {@link ObjectTestContract}.
026 * Usually not needed. Used for corner cases.
027 *
028 * @author Oliver Wolff
029 */
030@Retention(RUNTIME)
031@Target(TYPE)
032public @interface ObjectTestConfig {
033
034    /**
035     * @return an array of properties, identified by their names that are not to be
036     *         considered for equalsAndHashcode-tests: Blacklist
037     */
038    String[] equalsAndHashCodeExclude() default {};
039
040    /**
041     * @return an array of properties, identified by their names that are to be
042     *         considered for equalsAndHashcode-tests: Whitelist: takes precedence
043     *         over {@link #equalsAndHashCodeExclude()}
044     */
045    String[] equalsAndHashCodeOf() default {};
046
047    /**
048     * @return boolean indicating whether to only use the default checks ignoring
049     *         any properties, defaults to {@code false}
050     */
051    boolean equalsAndHashCodeBasicOnly() default false;
052
053    /**
054     * @return an array of properties, identified by their names that are not to be
055     *         considered for serializable-tests: Blacklist
056     */
057    String[] serializableExclude() default {};
058
059    /**
060     * @return an array of properties, identified by their names that are to be
061     *         considered for equalsAndHashcode-tests: Whitelist: takes precedence
062     *         over {@link #serializableExclude()}
063     */
064    String[] serializableOf() default {};
065
066    /**
067     * @return boolean indicating whether to only use the default checks ignoring
068     *         any properties, defaults to {@code false}
069     */
070    boolean serializableBasicOnly() default false;
071
072    /**
073     * @return boolean indicating whether the serialized and de-serialized object
074     *         should be compared using {@link Object#equals(Object)} with the
075     *         original object defaults to {@code true}
076     */
077    boolean serializableCompareUsingEquals() default true;
078
079    /**
080     * @return boolean indicating whether during the
081     *         {@link ObjectTestContracts#TO_STRING} minimal objects should be used
082     *         regarding the properties defaults to {@code false}
083     */
084    boolean toStringUseMinimalInstance() default false;
085}