|
| 1 | +package io.camunda.operate.spring; |
| 2 | + |
| 3 | +import static org.assertj.core.api.Assertions.*; |
| 4 | + |
| 5 | +import io.camunda.operate.CamundaOperateClient; |
| 6 | +import io.camunda.operate.CamundaOperateClientConfiguration; |
| 7 | +import io.camunda.operate.auth.Authentication; |
| 8 | +import java.util.stream.Stream; |
| 9 | +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; |
| 10 | +import org.junit.jupiter.api.DynamicTest; |
| 11 | +import org.junit.jupiter.api.TestFactory; |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; |
| 13 | +import org.springframework.boot.test.context.SpringBootTest; |
| 14 | +import org.springframework.context.ApplicationContext; |
| 15 | + |
| 16 | +@SpringBootTest(properties = "operate.client.profile=simple") |
| 17 | +public class BeanNameTest { |
| 18 | + @Autowired ApplicationContext applicationContext; |
| 19 | + |
| 20 | + @TestFactory |
| 21 | + Stream<DynamicTest> shouldHaveBeanName() { |
| 22 | + return Stream.of( |
| 23 | + applicationContext.getBeanNamesForType(Authentication.class), |
| 24 | + applicationContext.getBeanNamesForType(CamundaOperateClient.class), |
| 25 | + applicationContext.getBeanNamesForType(CloseableHttpClient.class), |
| 26 | + applicationContext.getBeanNamesForType(CamundaOperateClientConfiguration.class)) |
| 27 | + .map(s -> DynamicTest.dynamicTest(s[0], () -> testBeanName(s))); |
| 28 | + } |
| 29 | + |
| 30 | + private void testBeanName(String[] beanNames) { |
| 31 | + assertThat(beanNames).hasSize(1); |
| 32 | + assertThat(beanNames[0]).containsIgnoringCase("operate"); |
| 33 | + } |
| 34 | +} |
0 commit comments