@Test public void toStringTest () { Container containerWithFields = new MostlyAbstractContainer() { @Identifier(order = 0) private String name = "container name"; @Identifier(order = 1) private int index = 0; }; assertEquals("Container type: \n" + "\tname:\tcontainer name\n" + "\tindex:\t0", containerWithFields.toString()); }
@Override public String toString () { final List<Field> identifyingFields = getIdentifyingFields(); List<String> fieldValues = Stream.concat(Stream.of("Container type: " + getClass().getSimpleName()), identifyingFields .stream() .map(field -> { try { return field.getName() + ":\t" + field.get(this); } catch (IllegalAccessException e) { log.error("Caught IllegalAccessException ", e); return ""; } })).collect(Collectors.toUnmodifiableList()); return String.join("\n\t", fieldValues); }
Container implements ExperimentalObject { @Override public String toString () { final List<Field> identifyingFields = getIdentifyingFields(); List<String> fieldValues = Stream.concat(Stream.of("Container type: " + getClass().getSimpleName()), identifyingFields .stream() .map(field -> { try { return field.getName() + ":\t" + field.get(this); } catch (IllegalAccessException e) { log.error("Caught IllegalAccessException ", e); return ""; } })).collect(Collectors.toUnmodifiableList()); return String.join("\n\t", fieldValues); } }
Container implements ExperimentalObject { @Override public String toString () { final List<Field> identifyingFields = getIdentifyingFields(); List<String> fieldValues = Stream.concat(Stream.of("Container type: " + getClass().getSimpleName()), identifyingFields .stream() .map(field -> { try { return field.getName() + ":\t" + field.get(this); } catch (IllegalAccessException e) { log.error("Caught IllegalAccessException ", e); return ""; } })).collect(Collectors.toUnmodifiableList()); return String.join("\n\t", fieldValues); }  }
Container implements ExperimentalObject { @Override public String toString () { final List<Field> identifyingFields = getIdentifyingFields(); List<String> fieldValues = Stream.concat(Stream.of("Container type: " + getClass().getSimpleName()), identifyingFields .stream() .map(field -> { try { return field.getName() + ":\t" + field.get(this); } catch (IllegalAccessException e) { log.error("Caught IllegalAccessException ", e); return ""; } })).collect(Collectors.toUnmodifiableList()); return String.join("\n\t", fieldValues); }  Map<String, Boolean> getShellCapabilities(); @JsonIgnore Map<String, String> getDataDogTags(); @Override boolean canExperiment(); @JsonIgnore abstract Platform getPlatform(); boolean eligibleForExperiments(); Experiment createExperiment(); @Override boolean equals(Object o); @Override int hashCode(); long getIdentity(); @Override String toString(); ContainerHealth getContainerHealth(ExperimentType experimentType); Experiment createExperiment(String experimentMethod); void startExperiment(Experiment experiment); abstract String getSimpleName(); abstract String getAggregationIdentifier(); String getContainerType(); @JsonIgnore Duration getMinimumSelfHealingInterval(); @JsonIgnore abstract DataDogIdentifier getDataDogIdentifier(); boolean compareUniqueIdentifier(String uniqueIdentifier); void setMappedDiagnosticContext(); void clearMappedDiagnosticContext(); @JsonIgnore List<Method> getExperimentMethods(); @SuppressWarnings("unchecked") Runnable recycleCattle(); boolean isCattle(); boolean supportsShellBasedExperiments(); @SuppressWarnings("unchecked") ShellOutput runCommand(String command); @JsonIgnore Boolean isContainerRecycled(); @SuppressWarnings("unchecked") String runScript(Script script); Instant getExperimentStartTime(); Collection<String> getKnownMissingCapabilities(); void clearExperiment(); boolean supportsExperimentScope(ExperimentScope experimentScope); }
Container implements ExperimentalObject { @Override public String toString () { final List<Field> identifyingFields = getIdentifyingFields(); List<String> fieldValues = Stream.concat(Stream.of("Container type: " + getClass().getSimpleName()), identifyingFields .stream() .map(field -> { try { return field.getName() + ":\t" + field.get(this); } catch (IllegalAccessException e) { log.error("Caught IllegalAccessException ", e); return ""; } })).collect(Collectors.toUnmodifiableList()); return String.join("\n\t", fieldValues); }  Map<String, Boolean> getShellCapabilities(); @JsonIgnore Map<String, String> getDataDogTags(); @Override boolean canExperiment(); @JsonIgnore abstract Platform getPlatform(); boolean eligibleForExperiments(); Experiment createExperiment(); @Override boolean equals(Object o); @Override int hashCode(); long getIdentity(); @Override String toString(); ContainerHealth getContainerHealth(ExperimentType experimentType); Experiment createExperiment(String experimentMethod); void startExperiment(Experiment experiment); abstract String getSimpleName(); abstract String getAggregationIdentifier(); String getContainerType(); @JsonIgnore Duration getMinimumSelfHealingInterval(); @JsonIgnore abstract DataDogIdentifier getDataDogIdentifier(); boolean compareUniqueIdentifier(String uniqueIdentifier); void setMappedDiagnosticContext(); void clearMappedDiagnosticContext(); @JsonIgnore List<Method> getExperimentMethods(); @SuppressWarnings("unchecked") Runnable recycleCattle(); boolean isCattle(); boolean supportsShellBasedExperiments(); @SuppressWarnings("unchecked") ShellOutput runCommand(String command); @JsonIgnore Boolean isContainerRecycled(); @SuppressWarnings("unchecked") String runScript(Script script); Instant getExperimentStartTime(); Collection<String> getKnownMissingCapabilities(); void clearExperiment(); boolean supportsExperimentScope(ExperimentScope experimentScope);  }