Merge branch '5.2.x'

This commit is contained in:
Sam Brannen
2020-08-08 12:23:45 +02:00
2 changed files with 28 additions and 3 deletions

View File

@@ -53,6 +53,7 @@ import org.springframework.util.ReflectionUtils;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.assertj.core.api.Assertions.entry;
@@ -73,6 +74,26 @@ import static org.assertj.core.api.Assertions.entry;
*/
class MergedAnnotationsTests {
@Test
void fromPreconditions() {
SearchStrategy strategy = SearchStrategy.DIRECT;
RepeatableContainers containers = RepeatableContainers.standardRepeatables();
assertThatIllegalArgumentException()
.isThrownBy(() -> MergedAnnotations.from(getClass(), strategy, null, AnnotationFilter.PLAIN))
.withMessage("RepeatableContainers must not be null");
assertThatIllegalArgumentException()
.isThrownBy(() -> MergedAnnotations.from(getClass(), strategy, containers, null))
.withMessage("AnnotationFilter must not be null");
assertThatIllegalArgumentException()
.isThrownBy(() -> MergedAnnotations.from(getClass(), new Annotation[0], null, AnnotationFilter.PLAIN))
.withMessage("RepeatableContainers must not be null");
assertThatIllegalArgumentException()
.isThrownBy(() -> MergedAnnotations.from(getClass(), new Annotation[0], containers, null))
.withMessage("AnnotationFilter must not be null");
}
@Test
void streamWhenFromNonAnnotatedClass() {
assertThat(MergedAnnotations.from(NonAnnotatedClass.class).