|
| 1 | +/* |
| 2 | + * Copyright 2024-2025 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.RetentionPolicy.RUNTIME; |
| 19 | + |
| 20 | +import java.lang.annotation.Repeatable; |
| 21 | +import java.lang.annotation.Retention; |
| 22 | +import java.lang.annotation.Target; |
| 23 | + |
| 24 | +/** |
| 25 | + * Identifies factories that should be considered when writing tests for the annotated method. |
| 26 | + * |
| 27 | + * @since Diffblue Cover 2024.10.01 |
| 28 | + */ |
| 29 | +@Retention(RUNTIME) |
| 30 | +@Target(METHOD) |
| 31 | +@Repeatable(InTestsUseFactory.Repeatable.class) |
| 32 | +public @interface InTestsUseFactory { |
| 33 | + |
| 34 | + /** Collects multiple {@link InTestsUseFactory} annotations. */ |
| 35 | + @Retention(RUNTIME) |
| 36 | + @Target(METHOD) |
| 37 | + @interface Repeatable { |
| 38 | + |
| 39 | + /** @return the repeated {@link InTestsUseFactory} annotations. */ |
| 40 | + InTestsUseFactory[] value(); |
| 41 | + } |
| 42 | + |
| 43 | + /** @return The name of the class containing the factory methods. */ |
| 44 | + String className(); |
| 45 | + |
| 46 | + /** @return The method names to use for factory methods. */ |
| 47 | + String[] methodNames(); |
| 48 | +} |
0 commit comments