DockerInstance implements CloudInstance, DockerCloudErrorHandler { @Nonnull public Optional<String> getAgentHolderName() { return Optional.ofNullable(lock.call(() -> agentHolderName)); } DockerInstance(@Nonnull DockerImage img); @Nonnull @Override String getInstanceId(); @Nonnull Optional<String> getTaskId(); @Nonnull @Override String getName(); @Nonnull Optional<String> getAgentHolderName(); @Nonnull Optional<String> getResolvedImageName(); void bindWithAgentHolder(@Nonnull NewAgentHolderInfo agentHolderInfo); @Nonnull @Override String getImageId(); @Nonnull @Override DockerImage getImage(); @Nonnull @Override Date getStartedTime(); @Nullable @Override String getNetworkIdentity(); @Nonnull @Override InstanceStatus getStatus(); @Nullable @Override CloudErrorInfo getErrorInfo(); @Nonnull Optional<AgentHolderInfo> getAgentHolderInfo(); boolean registerOrCompareAgentId(int agentId); @Nonnull Optional<UUID> getAgentRuntimeUuid(); void registerAgentRuntimeUuid(@Nonnull UUID agentRuntimeUuid); void unregisterAgentRuntimeUUid(@Nonnull UUID agentRuntimeUuid); @Override void notifyFailure(@Nonnull String msg, @Nullable Throwable throwable); @Override boolean containsAgent(@Nonnull AgentDescription agent); @Override String toString();  }
@Test public void getAgentHolderName() { DockerInstance instance = createInstance(); assertThat(instance.getAgentHolderName()).isEmpty(); NewAgentHolderInfo agentHolderInfo = new NewAgentHolderInfo(TestUtils.createRandomSha256(), "agent_holder_name", "", Collections.emptyList()); instance.bindWithAgentHolder(agentHolderInfo); assertThat(instance.getAgentHolderName()).isEqualTo(Optional.of("agent_holder_name")); }