This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new b8d073fd9c9 CAMEL-20838: avoid using API methods for JUnit features
b8d073fd9c9 is described below
commit b8d073fd9c9402da1caaab7981f3a20b29518939
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Tue Jul 9 10:47:49 2024 +0200
CAMEL-20838: avoid using API methods for JUnit features
---
.../camel/component/slack/SlackConsumerTest.java | 24 ++++++++--------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git
a/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackConsumerTest.java
b/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackConsumerTest.java
index 432eb492968..3a97325ea2d 100644
---
a/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackConsumerTest.java
+++
b/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackConsumerTest.java
@@ -28,22 +28,19 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperties;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
+@EnabledIfSystemProperties({
+ @EnabledIfSystemProperty(named = "SLACK_TOKEN", matches = ".*"),
+ @EnabledIfSystemProperty(named = "SLACK_HOOK", matches = ".*")
+})
public class SlackConsumerTest extends CamelTestSupport {
- private String token;
- private String hook;
-
- @Override
- public void doPreSetup() {
- token = System.getProperty("SLACK_TOKEN");
- hook = System.getProperty("SLACK_HOOK");
-
- assumeCredentials();
- }
+ private String token = System.getProperty("SLACK_TOKEN");
+ private String hook = System.getProperty("SLACK_HOOK");
@Test
public void testConsumePrefixedMessages() throws Exception {
@@ -57,11 +54,6 @@ public class SlackConsumerTest extends CamelTestSupport {
MockEndpoint.assertIsSatisfied(context);
}
- private void assumeCredentials() {
- assumeTrue(token != null, "Please specify a Slack access token");
- assumeTrue(hook != null, "Please specify a Slack application webhook
URL");
- }
-
private void sendMessage(String message) throws IOException {
RequestBody requestBody
= RequestBody.create(MediaType.parse("application/json"),
String.format("{ 'text': '%s'}", message));