001package org.conqat.lib.commons.test;
002
003import java.lang.annotation.ElementType;
004import java.lang.annotation.Retention;
005import java.lang.annotation.RetentionPolicy;
006import java.lang.annotation.Target;
007
008import org.conqat.lib.commons.string.StringUtils;
009import org.junit.jupiter.params.provider.ArgumentsSource;
010
011/**
012 * Argument provider annotation that provides either instances of
013 * {@link ExpectedDataContainer} or pairs of
014 * {@link org.conqat.lib.commons.resources.Resource} for the primary test
015 * resource and expected resource. Groups all resources placed recursively under
016 * the test class' package root by files that end with the given suffix. This
017 * should be used to build parameterized tests.
018 *
019 * @see ExpectedDataContainer on how resources are matched to the respective
020 *      expected files.
021 */
022@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
023@Retention(RetentionPolicy.RUNTIME)
024@ArgumentsSource(ExpectedResourceArgumentsProvider.class)
025public @interface ExpectedResourceSource {
026
027        /**
028         * Suffix by which the test resources are grouped into test cases.
029         */
030        String expectedSuffix() default ".expected";
031
032        /**
033         * Whether to recursively collect resources.
034         */
035        boolean recursive() default true;
036
037        /**
038         * Subpath under which resources should be collected.
039         */
040        String path() default StringUtils.EMPTY_STRING;
041
042}