From 03cc86b890d2d7fa0fbfef65214197f805b817df Mon Sep 17 00:00:00 2001 From: Daniel Madejek Date: Wed, 1 Aug 2018 23:18:16 +0200 Subject: [PATCH] #153 fix for listener --- .../com/cognifide/qa/bb/RunWithJunit5.java | 34 +++++++++++++++++++ .../mapper/TestObjectTypeListener.java | 3 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 bb-core/src/main/java/com/cognifide/qa/bb/RunWithJunit5.java diff --git a/bb-core/src/main/java/com/cognifide/qa/bb/RunWithJunit5.java b/bb-core/src/main/java/com/cognifide/qa/bb/RunWithJunit5.java new file mode 100644 index 00000000..d2a23d18 --- /dev/null +++ b/bb-core/src/main/java/com/cognifide/qa/bb/RunWithJunit5.java @@ -0,0 +1,34 @@ +/*- + * #%L + * Bobcat + * %% + * Copyright (C) 2018 Cognifide Ltd. + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package com.cognifide.qa.bb; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Inherited +public @interface RunWithJunit5 { + + +} diff --git a/bb-core/src/main/java/com/cognifide/qa/bb/loadable/mapper/TestObjectTypeListener.java b/bb-core/src/main/java/com/cognifide/qa/bb/loadable/mapper/TestObjectTypeListener.java index 900c1fe1..781f4a27 100644 --- a/bb-core/src/main/java/com/cognifide/qa/bb/loadable/mapper/TestObjectTypeListener.java +++ b/bb-core/src/main/java/com/cognifide/qa/bb/loadable/mapper/TestObjectTypeListener.java @@ -13,6 +13,7 @@ */ package com.cognifide.qa.bb.loadable.mapper; +import com.cognifide.qa.bb.RunWithJunit5; import com.google.inject.TypeLiteral; import com.google.inject.spi.TypeEncounter; import com.google.inject.spi.TypeListener; @@ -40,7 +41,7 @@ public void hear(TypeLiteral type, TypeEncounter encounter) { private boolean isApplicable(Class rawType) { boolean result; - if (rawType.isAnnotationPresent(RunWith.class) + if ( (rawType.isAnnotationPresent(RunWith.class) || rawType.isAnnotationPresent(RunWithJunit5.class)) && !rawType.isAnnotationPresent(CucumberOptions.class)) { result = true; } else {