Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.Serializable;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -58,7 +58,7 @@ public final class StatusInfo implements Serializable {
private StatusInfo(String status, @Nullable Map<String, ?> details) {
Assert.hasText(status, "'status' must not be empty.");
this.status = status.toUpperCase();
this.details = (details != null) ? new HashMap<>(details) : Collections.emptyMap();
this.details = (details != null && !details.isEmpty()) ? new LinkedHashMap<>(details) : Collections.emptyMap();
}

public static StatusInfo valueOf(String statusCode, @Nullable Map<String, ?> details) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;

Expand Down Expand Up @@ -93,9 +93,9 @@ void setup() {

@Test
void should_send_mail_using_default_template() throws IOException, MessagingException {
Map<String, Object> details = new HashMap<>();
details.put("Simple Value", 1234);
Map<String, Object> details = new LinkedHashMap<>();
details.put("Complex Value", singletonMap("Nested Simple Value", "99!"));
details.put("Simple Value", 1234);

StepVerifier.create(notifier.notify(
new InstanceStatusChangedEvent(instance.getId(), instance.getVersion(), StatusInfo.ofDown(details))))
Expand Down