@Test
public void verify_parsing_NativeMethodSample() throws IOException {

    JfrEventParser parser = new JfrEventParser();
    CommonEvent event = parser.parseNextEvent(new JsonEventSource() {
        boolean hasNext = true;
        @Override
        public boolean readNext(JsonStreamWriter writer) throws IOException {
            jostart(writer);
                jput(writer, "eventType", "jdk.NativeMethodSample");
                jput(writer, "startTime", 1561544945483325579l);
                jostart(writer, "sampledThread");
                    jput(writer, "osThreadId", 14064);
                    jput(writer, "javaName", "(JDP Packet Listener)");
                    jput(writer, "javaThreadId", 37);
                    jostart(writer, "group");
                        jput(writer, "parent", null);
                        jput(writer, "name", "JDP Client");
                    joend(writer);
                joend(writer);
                jostart(writer, "stackTrace");
                    jput(writer, "truncated", false);
                    jastart(writer, "frames");
                        jframe(writer,
                                "java.net.TwoStacksPlainDatagramSocketImpl",
                                "receive0",
                                0, 0, "Native"
                        );
                        jframe(writer,
                                "java.net.TwoStacksPlainDatagramSocketImpl",
                                "receive",
                                0, 2, "Interpreted"
                                );
                        jframe(writer,
                                "java.net.DatagramSocket",
                                "receive",
                                0, 322, "Interpreted"
                                );
                    jaend(writer);
                joend(writer);
                jput(writer, "state", "STATE_RUNNABLE");
            joend(writer);
            return hasNext | (hasNext = false);
        }
    });
    ThreadSnapshotEvent tevent = (ThreadSnapshotEvent) event;
    Assertions.assertThat(tevent.threadName()).isEqualTo("(JDP Packet Listener)");
    Assertions.assertThat(tevent.threadId()).isEqualTo(37l);
    Assertions.assertThat(tevent.threadState()).isEqualTo(State.RUNNABLE);
    Assertions.assertThat(tevent.tags().firstTagFor("jfr.typeId")).isEqualTo("jdk.NativeMethodSample");
    Assertions.assertThat(tevent.stackTrace().depth()).isEqualTo(3);
    Assertions.assertThat(tevent.stackTrace().frameAt(0))
        .isEqualTo(new StackFrame("", "java.net.TwoStacksPlainDatagramSocketImpl", "receive0", "java", -2));
    Assertions.assertThat(tevent.stackTrace().frameAt(1))
        .isEqualTo(new StackFrame("", "java.net.TwoStacksPlainDatagramSocketImpl", "receive", null, -1));
    Assertions.assertThat(tevent.stackTrace().frameAt(2))
        .isEqualTo(new StackFrame("", "java.net.DatagramSocket", "receive", null, -1));
}