You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/05/12 13:42:31 UTC
[GitHub] [pulsar] nicoloboschi opened a new pull request, #15566: [improve][test] Replace @BeforeTest with @BeforeClass in ProducerBuilderImplTest
nicoloboschi opened a new pull request, #15566:
URL: https://github.com/apache/pulsar/pull/15566
### Motivation
BeforeTest TestNG annotations is not "compatible" with `MockitoCleanupListener`.
Test `ProducerBuilderImplTest` uses BeforeTest in order to mock some behaviours. When running the single test from CLI (IntelliJ uses another mechanism) with `mvn test -Dtest='ProducerBuilderImplTest' -pl pulsar-client`, it fails with
```
java.lang.NullPointerException
at org.apache.pulsar.client.impl.PulsarClientImpl.createProducerAsync(PulsarClientImpl.java:304)
at org.apache.pulsar.client.impl.ProducerBuilderImpl.createAsync(ProducerBuilderImpl.java:109)
at org.apache.pulsar.client.impl.ProducerBuilderImpl.create(ProducerBuilderImpl.java:86)
at org.apache.pulsar.client.impl.ProducerBuilderImplTest.testProducerBuilderImpl(ProducerBuilderImplTest.java:76)
```
This is because the order is:
1. BeforeTest method
2. MockitoCleanupListener
3. Test
In order to solve the issue we can use @BeforeClass annotation and the order will be:
1. MockitoCleanupListener
2. BeforeClass method
3. Test
### Modifications
* Replaced BeforeTest with BeforeClass and set alwaysRun=true
- [x] `no-need-doc`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] nicoloboschi merged pull request #15566: [improve][test] Replace @BeforeTest with @BeforeClass in ProducerBuilderImplTest
Posted by GitBox <gi...@apache.org>.
nicoloboschi merged PR #15566:
URL: https://github.com/apache/pulsar/pull/15566
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org