@Test
    public void testReference_SameType() {
        ResolvedType javaType = Mockito.mock(ResolvedType.class);
        DefinitionKey key = new DefinitionKey(javaType, null);

        // initially, all lists are empty
        Assertions.assertEquals(Collections.<ObjectNode>emptyList(), this.contextImpl.getReferences(key));
        Assertions.assertEquals(Collections.<ObjectNode>emptyList(), this.contextImpl.getNullableReferences(key));

        // adding a not-nullable entry creates the "references" list
        ObjectNode referenceInputOne = Mockito.mock(ObjectNode.class);
        SchemaGenerationContextImpl returnValue = this.contextImpl.addReference(javaType, referenceInputOne, null, false);
        Assertions.assertSame(this.contextImpl, returnValue);
        Assertions.assertEquals(Collections.singletonList(referenceInputOne), this.contextImpl.getReferences(key));
        Assertions.assertEquals(Collections.<ObjectNode>emptyList(), this.contextImpl.getNullableReferences(key));

        // adding another not-nullable entry adds it to the existing "references" list
        ObjectNode referenceInputTwo = Mockito.mock(ObjectNode.class);
        returnValue = this.contextImpl.addReference(javaType, referenceInputTwo, null, false);
        Assertions.assertSame(this.contextImpl, returnValue);
        Assertions.assertEquals(Arrays.asList(referenceInputOne, referenceInputTwo), this.contextImpl.getReferences(key));
        Assertions.assertEquals(Collections.<ObjectNode>emptyList(), this.contextImpl.getNullableReferences(key));

        // adding a nullable entry creates the "nullableReferences" list
        ObjectNode referenceInputThree = Mockito.mock(ObjectNode.class);
        returnValue = this.contextImpl.addReference(javaType, referenceInputThree, null, true);
        Assertions.assertSame(this.contextImpl, returnValue);
        Assertions.assertEquals(Arrays.asList(referenceInputOne, referenceInputTwo), this.contextImpl.getReferences(key));
        Assertions.assertEquals(Collections.singletonList(referenceInputThree), this.contextImpl.getNullableReferences(key));
    }
Test for the {@link SchemaGenerationContextImpl} class.
jsonschema-generator/src/test/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImplTest.java