https://pact.io logo
#pact-jvm
Title
# pact-jvm
m

Mike

02/17/2022, 9:56 AM
Hi, I try to use Pact broker consumerVersionSelectors in kotlin. Seems its not working
Copy code
@PactBroker(
        authentication= @PactBrokerAuth(username = "", password = ""),
        port="8080",
        consumerVersionSelectors={ @VersionSelector(latest = "true") }
)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class PactCPEProviderTest {
I take it from Docs https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors/ But compiler argues on VersionSelector with An annotation can't be used as the annotations argument Is it possible to solve it somehow?
p

Pavlo Sprogis

02/17/2022, 11:30 AM
I just tried an example from the docs and it works fine:
Copy code
@Provider("my provider name")
@PactBroker(host = "${PACT_BROKER_HOST}",
        authentication = @PactBrokerAuth(username = "${PACT_BROKER_USERNAME}", password = "${PACT_BROKER_PASSWORD}"),
        consumerVersionSelectors = {
                @VersionSelector(tag = "master"),
                @VersionSelector(tag = "dev"),
                @VersionSelector(tag = "production")
        }
)
I’m using
Copy code
<dependency>
          <groupId>au.com.dius.pact.provider</groupId>
          <artifactId>junit5</artifactId>
          <version>4.1.17</version>
          <scope>test</scope>
        </dependency>
m

Mike

02/17/2022, 11:45 AM
Do you use kotlin?
p

Pavlo Sprogis

02/17/2022, 11:46 AM
no, I use java 11 (zulu build)
m

Mike

02/17/2022, 11:48 AM
that's the reason, thanks for sharing
Copy code
@PactBroker(
        authentication= PactBrokerAuth(username = "", password = ""),
        consumerVersionSelectors=[ VersionSelector(latest = "true") ]
)
Seems it should looks like that in kotlin