ErlangList extends ErlangTerm { @Override public int size () { return elements.length; } ErlangList(TermType type, @NonNull ByteBuf buffer);  ErlangList(ErlangTerm... elements);  ErlangList(@NonNull Collection<ErlangTerm> elements); @Builder  ErlangList(ErlangTerm tail, @Singular List<ErlangTerm> elements); boolean isProper(); @Override boolean isTextual(); @Override String asText(String defaultValue); @Override ErlangList asList(); @Override Iterator<ErlangTerm> elements(); @Override ErlangTerm getUnsafe(int index); @Override int size();  }
@Test public void newInstance () { val value = new ErlangNil(); val bytes = Bytes.resizableArray() .write1B(LIST.getCode()) .write4B(1) .writeNB(value.toBytes()) .writeNB(new ErlangNil().toBytes()) .arrayCopy(); ErlangList list = ErlangTerm.newInstance(wrappedBuffer(bytes)); assertThat(list).isNotNull(); SoftAssertions.assertSoftly(softly -> { softly.assertThat(list.isCollectionTerm()) .isTrue(); softly.assertThat(list.isList()) .isTrue(); softly.assertThat(list.get(0)) .isPresent() .hasValue(value); softly.assertThat(list.size()) .isEqualTo(1); softly.assertThat(list.getTail()) .isEqualTo(new ErlangNil()); }); }