Created
October 20, 2016 20:23
-
-
Save ryanlea/5547d80f04f65b2d506528effc0f4330 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package au.ryanlea.chronicle.wire; | |
import net.openhft.chronicle.bytes.Bytes; | |
import net.openhft.chronicle.wire.Wire; | |
import net.openhft.chronicle.wire.WireType; | |
import org.junit.Test; | |
import java.nio.ByteBuffer; | |
import static org.assertj.core.api.Assertions.assertThat; | |
public class ChronicleWireBugTest { | |
@Test | |
public void objectsInSequence() { | |
final Bytes<ByteBuffer> bytes = Bytes.elasticByteBuffer(1024); | |
final Wire wire = WireType.TEXT.apply(bytes); | |
wire.write(() -> "seq").sequence(seq -> { | |
seq.marshallable(obj -> obj.write(() -> "key").text("value")); | |
seq.marshallable(obj -> obj.write(() -> "key").text("value")); | |
}); | |
final CharSequence text = wire.asText(); | |
assertThat(text).isEqualTo("seq: [{\n" + | |
" key: value\n" + | |
" }, {\n" + | |
" key: value\n" + | |
" }\n" + | |
"]"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment