public Generics(Fury fury) {
    this.fury = fury;
  }
@Test
  public void testGenerics() throws NoSuchFieldException {
    Fury fury = Fury.builder().withLanguage(Language.JAVA).build();
    Generics generics = new Generics(fury);
    {
      GenericType genericType =
          GenericType.build(Test4.class, Test2.class.getField("fromFieldNested").getGenericType());
      // push generics in outer serialization.
      generics.pushGenericType(genericType);
      // increase serialization depth.
      increaseFuryDepth(fury, 1);
      // get generics in inner serialization.
      GenericType genericType1 = generics.nextGenericType();
      Assert.assertSame(genericType1, genericType);
      increaseFuryDepth(fury, -1);
      generics.popGenericType();
    }
    {
      for (String fieldName : new String[] {"fromField2", "arrayWithTypeVar", "fromFieldNested"}) {
        GenericType genericType =
            GenericType.build(Test4.class, Test2.class.getField(fieldName).getGenericType());
        generics.pushGenericType(genericType);
        increaseFuryDepth(fury, 1);
      }
      for (String fieldName :
          ImmutableList.of("fromField2", "arrayWithTypeVar", "fromFieldNested").reverse()) {
        GenericType genericType =
            GenericType.build(Test4.class, Test2.class.getField(fieldName).getGenericType());
        GenericType genericType1 = generics.nextGenericType();
        Assert.assertEquals(genericType1.typeRef, genericType.typeRef);
        increaseFuryDepth(fury, -1);
        generics.popGenericType();
      }
    }
    Assert.assertEquals(TestUtils.getFieldValue(generics, "genericTypesSize"), Integer.valueOf(0));
    GenericType[] genericTypes = TestUtils.getFieldValue(generics, "genericTypes");
    Assert.assertNull(genericTypes[0]);
    Assert.assertNull(genericTypes[1]);
  }