Update documentation according to testcontainer example. Fix #29936

Comment From: pivotal-cla

@samuelstein Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-cla

@samuelstein Thank you for signing the Contributor License Agreement!

Comment From: sbrannen

The container in the example does not need to be manually started since the JUnit Jupiter extension behind the @Testcontainers annotation handles that for you. In light of that, I am closing this PR.

However, this PR did inspire me to review the examples which resulted in #29939.

Thanks,

Sam

Comment From: samuelstein

The thing is, that if you don't start the container explicitly in the DynamicPropertySource hook it's possible that you run in an timing issue when the hook will be called earlier than the container is started by the JUnit extension and this will result in an "Mapped port can only be obtained after the container is started" error. The start method of the container will check anyway if the container is already started. So calling the start method explicit will only make the process more robust and has no negative consequences i would say. What do you think?

Comment From: sbrannen

@eddumelendez, what are your thoughts on the matter?

Comment From: eddumelendez

Hi, the javadoc is using Testcontainers and Container annotations. Those are part of the junit-jupiter integration and the container will start without calling start() method. So, the change doesn't apply.

Comment From: sbrannen

Thanks for confirming that, @eddumelendez.