DefaultDockerCloudClient extends BuildServerAdapter implements DockerCloudClient { @Nullable @Override public DockerImage findImageById(@Nonnull String id) throws CloudException { return lock.call(() -> { for (DockerImage img : images.values()) { if (img.getId().equals(id)) { return img; } } return null; }); } DefaultDockerCloudClient(@Nonnull DockerCloudClientConfig clientConfig,
                             @Nonnull final List<DockerImageConfig> imageConfigs,
                             @Nonnull final DockerImageNameResolver resolver,
                             @Nonnull CloudState cloudState,
                             @Nonnull final SBuildServer buildServer); @Nonnull @Override UUID getUuid(); @Nonnull @Override DockerCloudSupport getCloudSupport(); @Override void serverStartup(); @Override boolean isInitialized(); @Nullable @Override DockerImage findImageById(@Nonnull String id); @Nullable @Override DockerInstance findInstanceByAgent(@Nonnull AgentDescription agent); @Nonnull @Override Collection<DockerImage> getImages(); @Nullable @Override CloudErrorInfo getErrorInfo(); @Override boolean canStartNewInstance(@Nonnull CloudImage image); @Nullable @Override String generateAgentName(@Nonnull AgentDescription agent); @Nonnull @Override DockerInstance startNewInstance(@Nonnull final CloudImage image, @Nonnull final CloudInstanceUserData tag); @Override void restartInstance(@Nonnull final CloudInstance instance); @Override void terminateInstance(@Nonnull final CloudInstance instance); @Override void dispose(); Optional<Instant> getLastDockerSyncTime(); @Override void notifyFailure(@Nonnull String msg, @Nullable Throwable throwable);  }
@Test public void findImageById() { DefaultDockerCloudClient client = createClient(); DockerImage dockerImage = waitForImage(client); assertThat(client.findImageById(dockerImage.getId())).isSameAs(dockerImage); }