TypeRegistry registry = getTypeRegistry("");
byte[] bytes = loadBytesForClass("data.SomeFields");
TypeDescriptor typeDescriptor = new TypeDescriptorExtractor(registry).extract(bytes, false);
FieldMember[] fields = typeDescriptor.getFields();
assertEquals(4, fields.length);
FieldMember privateField = fields[0];
assertEquals(Modifier.PRIVATE, privateField.getModifiers());
assertEquals("privateField", privateField.getName());
assertEquals("I", privateField.getDescriptor());
assertNull(privateField.getGenericSignature());
assertEquals("0x2 I privateField", privateField.toString());
FieldMember publicField = fields[1];
assertEquals(Modifier.PUBLIC, publicField.getModifiers());
assertEquals("publicField", publicField.getName());
assertEquals("Ljava/lang/String;", publicField.getDescriptor());
assertNull(publicField.getGenericSignature());
assertEquals("0x1 Ljava/lang/String; publicField", publicField.toString());
FieldMember defaultField = fields[2];
assertEquals(0, defaultField.getModifiers());
assertEquals("defaultField", defaultField.getName());
assertEquals("Ljava/util/List;", defaultField.getDescriptor());
assertEquals("Ljava/util/List<Ljava/lang/String;>;", defaultField.getGenericSignature());
assertEquals("0x0 Ljava/util/List; defaultField [Ljava/util/List<Ljava/lang/String;>;]", defaultField.toString());
FieldMember protectedField = fields[3];
assertEquals(Modifier.PROTECTED, protectedField.getModifiers());
assertEquals("protectedField", protectedField.getName());
assertEquals("Ljava/util/Map;", protectedField.getDescriptor());
assertEquals("Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/Integer;>;>;",
protectedField.getGenericSignature());
assertEquals(
"0x4 Ljava/util/Map; protectedField [Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/Integer;>;>;]",
protectedField.toString());
}