Skip to content

Commit

Permalink
Fix JUnit dependencies
Browse files Browse the repository at this point in the history
- eliminate the `platform-commons` dependency
- make the `jupiter-api` dependency optional
  • Loading branch information
garyrussell authored and artembilan committed Dec 21, 2017
1 parent d73f4ff commit 822593b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ subprojects { subproject ->

testCompile "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testRuntime "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
testRuntime "org.junit.platform:junit-platform-commons:${junitPlatformVersion}"
testRuntime "org.junit.platform:junit-platform-launcher:${junitPlatformVersion}"

// To support JUnit 4 tests
Expand Down Expand Up @@ -287,8 +286,7 @@ project('spring-rabbit-junit') {
exclude group: 'org.springframework', module: 'spring-web'
}
compile "org.springframework:spring-web:$springVersion"
compile "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
compile "org.junit.platform:junit-platform-commons:${junitPlatformVersion}"
compile ("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}", optional)
compileOnly 'org.apiguardian:apiguardian-api:1.0.0'

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
import org.junit.jupiter.api.extension.ExecutionCondition;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.platform.commons.util.AnnotationUtils;

import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.StringUtils;

/**
Expand All @@ -42,9 +42,9 @@ public class LongRunningIntegrationTestCondition implements ExecutionCondition {
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
Optional<AnnotatedElement> element = context.getElement();
Optional<LongRunning> longRunning = AnnotationUtils.findAnnotation(element, LongRunning.class);
if (longRunning.isPresent()) {
String property = longRunning.get().value();
LongRunning longRunning = AnnotationUtils.findAnnotation(element.get(), LongRunning.class);
if (longRunning != null) {
String property = longRunning.value();
if (!StringUtils.hasText(property)) {
property = LongRunningIntegrationTest.RUN_LONG_INTEGRATION_TESTS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.junit.jupiter.api.extension.ParameterContext;
import org.junit.jupiter.api.extension.ParameterResolutionException;
import org.junit.jupiter.api.extension.ParameterResolver;
import org.junit.platform.commons.util.AnnotationUtils;

import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.Assert;

import com.rabbitmq.client.ConnectionFactory;
Expand All @@ -53,13 +53,13 @@ public class RabbitAvailableCondition implements ExecutionCondition, AfterAllCal
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
Optional<AnnotatedElement> element = context.getElement();
Optional<RabbitAvailable> rabbit = AnnotationUtils.findAnnotation(element, RabbitAvailable.class);
if (rabbit.isPresent()) {
RabbitAvailable rabbit = AnnotationUtils.findAnnotation(element.get(), RabbitAvailable.class);
if (rabbit != null) {
try {
String[] queues = rabbit.get().queues();
String[] queues = rabbit.queues();
BrokerRunning brokerRunning = getStore(context).get("brokerRunning", BrokerRunning.class);
if (brokerRunning == null) {
if (rabbit.get().management()) {
if (rabbit.management()) {
brokerRunning = BrokerRunning.isBrokerAndManagementRunningWithEmptyQueues(queues);
}
else {
Expand Down

0 comments on commit 822593b

Please sign in to comment.