|
| 1 | +/* |
| 2 | + * Copyright 2024 Diffblue Limited. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | + * You may not use this file except in compliance with the License. |
| 6 | + * A copy of the License is located at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * or in the "license" file accompanying this file. This file is distributed |
| 11 | + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | + * express or implied. See the License for the specific language governing |
| 13 | + * permissions and limitations under the License. |
| 14 | + */ |
| 15 | +package com.diffblue.cover.annotations; |
| 16 | + |
| 17 | +import static java.lang.annotation.ElementType.METHOD; |
| 18 | +import static java.lang.annotation.ElementType.PACKAGE; |
| 19 | +import static java.lang.annotation.ElementType.PARAMETER; |
| 20 | +import static java.lang.annotation.ElementType.TYPE; |
| 21 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; |
| 22 | + |
| 23 | +import java.lang.annotation.Repeatable; |
| 24 | +import java.lang.annotation.Retention; |
| 25 | +import java.lang.annotation.Target; |
| 26 | + |
| 27 | +/** |
| 28 | + * Identifies values that should be considered when writing tests that require inputs of type {@link |
| 29 | + * Enum}. |
| 30 | + */ |
| 31 | +@Retention(RUNTIME) |
| 32 | +@Repeatable(InTestsUseEnums.Repeatable.class) |
| 33 | +public @interface InTestsUseEnums { |
| 34 | + |
| 35 | + /** Collects multiple {@link InTestsUseEnums} annotations. */ |
| 36 | + @Retention(RUNTIME) |
| 37 | + @Target({PACKAGE, TYPE, METHOD, PARAMETER}) |
| 38 | + @interface Repeatable { |
| 39 | + |
| 40 | + /** |
| 41 | + * @return the repeated {@link InTestsUseEnums} annotations. |
| 42 | + */ |
| 43 | + InTestsUseEnums[] value(); |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * @return {@link String} values that should be tried as names of the annotated enum. |
| 48 | + */ |
| 49 | + String[] value() default {}; |
| 50 | +} |
0 commit comments