GeneratorReference { ErlangReference generate () { val nextId1 = nextId1(); val nextId2 = nextId1 == 0 ? id2.incrementAndGet() : id2.get(); val nextId3 = nextId1 == 0 && nextId2 == 0 ? id3.incrementAndGet() : id3.get(); return ErlangReference.builder() .node(fullName) .ids(new long[] { nextId1, nextId2, nextId3 }) .creation(creation) .build(); }    }
@Test public void generateReference () { val descriptor = NodeDescriptor.from("popa"); val creation = 1; val generator = new GeneratorReference(descriptor.getFullName(), creation); val reference = generator.generate(); assertThat(reference).isNotNull(); SoftAssertions.assertSoftly(softly -> { softly.assertThat(reference.getDescriptor().getFullName()) .isNotNull() .isEqualTo(descriptor.getFullName()); softly.assertThat(reference.getIds()) .isNotNull() .isEqualTo(new long[] { 1, 0, 0 }); softly.assertThat(reference.getCreation()) .isEqualTo(creation); }); }