Skip to content

Commit 5ea9915

Browse files
author
Ronald Holshausen
authoredFeb 27, 2020
Merge pull request #1030 from kppullin/fix-exception-in-validateTestTarget
Avoid unhandled exception in `validateTestTarget`
2 parents 7e81778 + 2a1af9b commit 5ea9915

File tree

1 file changed

+1
-3
lines changed
  • provider/pact-jvm-provider-junit/src/main/kotlin/au/com/dius/pact/provider/junit

1 file changed

+1
-3
lines changed
 

Diff for: ‎provider/pact-jvm-provider-junit/src/main/kotlin/au/com/dius/pact/provider/junit/InteractionRunner.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import org.junit.runner.Description
2626
import org.junit.runner.Runner
2727
import org.junit.runner.notification.Failure
2828
import org.junit.runner.notification.RunNotifier
29-
import org.junit.runners.model.FrameworkField
3029
import org.junit.runners.model.FrameworkMethod
3130
import org.junit.runners.model.InitializationError
3231
import org.junit.runners.model.Statement
@@ -117,15 +116,14 @@ open class InteractionRunner<I>(
117116

118117
protected fun hasOneConstructor() = testClass.javaClass.constructors.size == 1
119118

120-
protected fun validateTestTarget(errors: MutableList<Throwable>): FrameworkField {
119+
protected fun validateTestTarget(errors: MutableList<Throwable>) {
121120
val annotatedFields = testClass.getAnnotatedFields(TestTarget::class.java)
122121
if (annotatedFields.size != 1) {
123122
errors.add(Exception("Test class should have exactly one field annotated with ${TestTarget::class.java.name}"))
124123
} else if (!Target::class.java.isAssignableFrom(annotatedFields[0].type)) {
125124
errors.add(Exception("Field annotated with ${TestTarget::class.java.name} should implement " +
126125
"${Target::class.java.name} interface"))
127126
}
128-
return annotatedFields[0]
129127
}
130128

131129
protected fun validateRules(errors: List<Throwable>) {

0 commit comments

Comments
 (0)
Please sign in to comment.