@Test(expected = Test.None.class)
    public void Given_CyclicalBeanReference_When_SerializingToJson_Then_ExpectSuccessfulSerializationWithIDReference()
        throws JsonProcessingException {
        ApiVersionBean apiVersion = new ApiVersionBean();
        apiVersion.setId(1234L);


        ApiDefinitionBean adb = new ApiDefinitionBean();
        adb.setId(1132L);
        adb.setData("wibbly, wobbly, woo".getBytes(StandardCharsets.UTF_8));
        adb.setApiVersion(apiVersion);

        apiVersion.apiDefinition = adb;

        // If we successfully serialize here, then the cycle detection worked.
        ObjectMapper om = new ObjectMapper();
        System.out.println(om.writeValueAsString(apiVersion));
        System.out.println(om.writeValueAsString(adb));
    }
We expect that serialization will succeed, but are not testing specific output.

If this fails a stack overflow error or similar will occur due to the cyclical reference being chased
infinitely.
manager/api/beans/src/test/java/io/apiman/manager/api/beans/apis/JacksonCyclicalSerialisationTest.java