-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(cherry picked from commit dde8c81)
- Loading branch information
1 parent
1b0fcde
commit 9cc12cb
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ng-boot-starter-camunda-operate/src/test/java/io/camunda/operate/spring/BeanNameTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.camunda.operate.spring; | ||
|
||
import static org.assertj.core.api.Assertions.*; | ||
|
||
import io.camunda.operate.CamundaOperateClient; | ||
import io.camunda.operate.CamundaOperateClientConfiguration; | ||
import io.camunda.operate.auth.Authentication; | ||
import java.util.stream.Stream; | ||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; | ||
import org.junit.jupiter.api.DynamicTest; | ||
import org.junit.jupiter.api.TestFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.context.ApplicationContext; | ||
|
||
@SpringBootTest(properties = "operate.client.profile=simple") | ||
public class BeanNameTest { | ||
@Autowired ApplicationContext applicationContext; | ||
|
||
@TestFactory | ||
Stream<DynamicTest> shouldHaveBeanName() { | ||
return Stream.of( | ||
applicationContext.getBeanNamesForType(Authentication.class), | ||
applicationContext.getBeanNamesForType(CamundaOperateClient.class), | ||
applicationContext.getBeanNamesForType(CloseableHttpClient.class), | ||
applicationContext.getBeanNamesForType(CamundaOperateClientConfiguration.class)) | ||
.map(s -> DynamicTest.dynamicTest(s[0], () -> testBeanName(s))); | ||
} | ||
|
||
private void testBeanName(String[] beanNames) { | ||
assertThat(beanNames).hasSize(1); | ||
assertThat(beanNames[0]).containsIgnoringCase("operate"); | ||
} | ||
} |