Fix StompSubframeEncoderTest failure

Motivation:

StompSubframeEncoderTest fails because StompHeaders does not respect the order of the headers set.

Modifications:

Use LinkedHashMap instead of HashMap

Result:

Fixes test failures
This commit is contained in:
Trustin Lee 2014-06-05 17:04:58 +09:00
parent 2e98566916
commit 84fc63f927
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ package io.netty.handler.codec.stomp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -48,7 +48,7 @@ public class StompHeaders {
public static final String CONTENT_LENGTH = "content-length";
public static final String CONTENT_TYPE = "content-type";
private final Map<String, List<String>> headers = new HashMap<String, List<String>>();
private final Map<String, List<String>> headers = new LinkedHashMap<String, List<String>>();
public boolean has(String key) {
List<String> values = headers.get(key);

View File

@ -43,8 +43,8 @@ public class StompSubframeEncoderTest {
public void testFrameAndContentEncoding() {
StompHeadersSubframe frame = new DefaultStompHeadersSubframe(StompCommand.CONNECT);
StompHeaders headers = frame.headers();
headers.set(StompHeaders.ACCEPT_VERSION, "1.1,1.2");
headers.set(StompHeaders.HOST, "stomp.github.org");
headers.set(StompHeaders.ACCEPT_VERSION, "1.1,1.2");
channel.writeOutbound(frame);
channel.writeOutbound(LastStompContentSubframe.EMPTY_LAST_CONTENT);
ByteBuf aggregatedBuffer = Unpooled.buffer();