Skip to content

Commit

Permalink
chore: move PactBrokerLoaderSpec to provider test source
Browse files Browse the repository at this point in the history
  • Loading branch information
uglyog authored and rholshausen committed Nov 24, 2022
1 parent babb880 commit 78a6dc8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 23 deletions.
5 changes: 5 additions & 0 deletions provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ compileTestGroovy {
dependsOn compileTestScala
classpath = classpath.plus(files(compileTestScala.destinationDir))
}

test {
useJUnitPlatform()
maxHeapSize = "1g"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package au.com.dius.pact.provider.junit.loader
package au.com.dius.pact.provider.junitsupport.loader

import au.com.dius.pact.core.model.Pact
import au.com.dius.pact.core.model.PactBrokerSource
Expand All @@ -12,14 +12,6 @@ import au.com.dius.pact.core.support.expressions.DataType
import au.com.dius.pact.core.support.expressions.ExpressionParser
import au.com.dius.pact.core.support.expressions.SystemPropertyResolver
import au.com.dius.pact.core.support.expressions.ValueResolver
import au.com.dius.pact.provider.junitsupport.loader.IConsumerVersionSelectors
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerConsumerVersionSelectors
import au.com.dius.pact.provider.junitsupport.loader.SelectorBuilder
import au.com.dius.pact.provider.junitsupport.loader.VersionSelector
import au.com.dius.pact.provider.junitsupport.loader.NoPactsFoundException
import au.com.dius.pact.provider.junitsupport.loader.PactBroker
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerAuth
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerLoader
import com.github.michaelbull.result.Err
import com.github.michaelbull.result.Ok
import spock.lang.Issue
Expand Down Expand Up @@ -1446,16 +1438,19 @@ class PactBrokerLoaderSpec extends Specification {

where:

clazz | result
null | false
PactBrokerLoaderSpec | false
FullPactBrokerAnnotation | false
IncorrectTypesOnSelectorMethod | false
IncorrectTypesOnSelectorMethod2 | false
IncorrectScopeOnSelectorMethod | false
CorrectSelectorMethod | true
CorrectSelectorMethod2 | true
CorrectSelectorMethod3 | true
clazz | result
null | false
PactBrokerLoaderSpec | false
FullPactBrokerAnnotation | false
IncorrectTypesOnSelectorMethod | false
IncorrectTypesOnSelectorMethod2 | false
IncorrectScopeOnSelectorMethod | false
CorrectSelectorMethod | true
CorrectSelectorMethod2 | true
CorrectSelectorMethod3 | true
KotlinClassWithSelectorMethod | true
ExtendedFromKotlin | true
KotlinAbstractClassWithSelectorMethod | true
}

@Unroll
Expand All @@ -1465,10 +1460,12 @@ class PactBrokerLoaderSpec extends Specification {

where:

clazz | instance | result
CorrectSelectorMethod | new CorrectSelectorMethod() | [new ConsumerVersionSelectors.Environment('CorrectSelectorMethod')]
CorrectSelectorMethod2 | new CorrectSelectorMethod2() | [new ConsumerVersionSelectors.Environment('CorrectSelectorMethod2')]
CorrectSelectorMethod3 | null | [new ConsumerVersionSelectors.Environment('CorrectSelectorMethod3')]
clazz | instance | result
CorrectSelectorMethod | new CorrectSelectorMethod() | [new ConsumerVersionSelectors.Environment('CorrectSelectorMethod')]
CorrectSelectorMethod2 | new CorrectSelectorMethod2() | [new ConsumerVersionSelectors.Environment('CorrectSelectorMethod2')]
CorrectSelectorMethod3 | null | [new ConsumerVersionSelectors.Environment('CorrectSelectorMethod3')]
KotlinClassWithSelectorMethod | new KotlinClassWithSelectorMethod() | [new ConsumerVersionSelectors.Environment('KotlinSelectorMethod')]
ExtendedFromKotlin | new ExtendedFromKotlin() | [new ConsumerVersionSelectors.Environment('KotlinSelectorMethod')]
}

private static VersionSelector createVersionSelector(Map args = [:]) {
Expand Down Expand Up @@ -1603,4 +1600,6 @@ class PactBrokerLoaderSpec extends Specification {
new SelectorBuilder().environment('CorrectSelectorMethod3').build()
}
}

static class ExtendedFromKotlin extends KotlinAbstractClassWithSelectorMethod { }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package au.com.dius.pact.provider.junitsupport.loader

class KotlinClassWithSelectorMethod {
@PactBrokerConsumerVersionSelectors
fun consumerVersionSelectors() = SelectorBuilder().environment("KotlinSelectorMethod")
}

abstract class KotlinAbstractClassWithSelectorMethod {
@PactBrokerConsumerVersionSelectors
fun consumerVersionSelectors() = SelectorBuilder().environment("KotlinSelectorMethod")
}

class KotlinClassWithStaticSelectorMethod {
companion object {
@PactBrokerConsumerVersionSelectors
fun consumerVersionSelectors() = SelectorBuilder().environment("KotlinStaticSelectorMethod")
}
}

0 comments on commit 78a6dc8

Please sign in to comment.