|
| 1 | +/* |
| 2 | + * Copyright 2002-2023 the original author or authors. |
| 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 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package org.springframework.aot.hint.support; |
| 18 | + |
| 19 | +import org.junit.jupiter.api.BeforeEach; |
| 20 | +import org.junit.jupiter.api.Test; |
| 21 | + |
| 22 | +import org.springframework.aot.hint.RuntimeHints; |
| 23 | +import org.springframework.aot.hint.RuntimeHintsRegistrar; |
| 24 | +import org.springframework.aot.hint.TypeReference; |
| 25 | +import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; |
| 26 | +import org.springframework.core.io.support.SpringFactoriesLoader; |
| 27 | +import org.springframework.util.ClassUtils; |
| 28 | + |
| 29 | +import static org.assertj.core.api.Assertions.assertThat; |
| 30 | + |
| 31 | +/** |
| 32 | + * Tests for {@link PathMatchingResourcePatternResolverRuntimeHints}. |
| 33 | + * |
| 34 | + * @author Brian Clozel |
| 35 | + */ |
| 36 | +class PathMatchingResourcePatternResolverRuntimeHintsTests { |
| 37 | + |
| 38 | + private RuntimeHints hints; |
| 39 | + |
| 40 | + @BeforeEach |
| 41 | + void setup() { |
| 42 | + this.hints = new RuntimeHints(); |
| 43 | + SpringFactoriesLoader.forResourceLocation("META-INF/spring/aot.factories") |
| 44 | + .load(RuntimeHintsRegistrar.class).forEach(registrar -> registrar |
| 45 | + .registerHints(this.hints, ClassUtils.getDefaultClassLoader())); |
| 46 | + } |
| 47 | + |
| 48 | + @Test |
| 49 | + void EclipseOsgiFileLocatorHasHints() { |
| 50 | + assertThat(RuntimeHintsPredicates.reflection().onType(TypeReference.of("org.eclipse.core.runtime.FileLocator"))).accepts(this.hints); |
| 51 | + } |
| 52 | + |
| 53 | +} |
0 commit comments