default Integer getMappedPort(int originalPort) {
        Preconditions.checkState(
            this.getContainerId() != null,
            "Mapped port can only be obtained after the container is started"
        );

        Ports.Binding[] binding = new Ports.Binding[0];
        final InspectContainerResponse containerInfo = this.getContainerInfo();
        if (containerInfo != null) {
            binding = containerInfo.getNetworkSettings().getPorts().getBindings().get(new ExposedPort(originalPort));
        }

        if (binding != null && binding.length > 0 && binding[0] != null) {
            return Integer.valueOf(binding[0].getHostPortSpec());
        } else {
            throw new IllegalArgumentException("Requested port (" + originalPort + ") is not mapped");
        }
    }
Get the actual mapped port for a given port exposed by the container.
It should be used in conjunction with {@link #getHost()}.
<p>
Note: The returned port number might be outdated (for instance, after disconnecting from a network and reconnecting
again). If you always need up-to-date value, override the {@link #getContainerInfo()} to return the
{@link #getCurrentContainerInfo()}.

@param originalPort the original TCP port that is exposed
@return the port that the exposed port is mapped to, or null if it is not exposed
@see #getContainerInfo()
@see #getCurrentContainerInfo()
core/src/main/java/org/testcontainers/containers/ContainerState.java