JobRuntimePredictions { public Optional<String> toSimpleString() { return simpleStringRepresentation; } JobRuntimePredictions(String version, String modelId, SortedSet<JobRuntimePrediction> predictions); String getVersion(); String getModelId(); SortedSet<JobRuntimePrediction> getPredictions(); Optional<String> toSimpleString(); @Override String toString();  }
@Test public void testOneLineRepresentation() { SortedSet<JobRuntimePrediction> predictions = new TreeSet<>(); predictions.add(new JobRuntimePrediction(0.95, 26.2)); predictions.add(new JobRuntimePrediction(0.1, 10.0)); predictions.add(new JobRuntimePrediction(0.2, 15.0)); JobRuntimePredictions jobRuntimePredictions = new JobRuntimePredictions("1", "some-id", predictions); Optional<String> asString = jobRuntimePredictions.toSimpleString(); assertThat(asString).isPresent(); assertThat(asString.get()).isEqualTo("0.1=10.0;0.2=15.0;0.95=26.2"); }
@Test public void testOneLineRepresentationForEmptyPredictions() { JobRuntimePredictions predictions = new JobRuntimePredictions("1", "some-id", new TreeSet<>()); assertThat(predictions.toSimpleString()).isEmpty(); }