### Question:
ClassFileMetadataReader { public static ClassMetadata instance( InputStream stream ) throws Exception { ClassFile clazz = new ClassFile(new DataInputStream(stream)); if ((AccessFlag.ENUM & clazz.getAccessFlags()) == AccessFlag.ENUM) { return new EnumMetadata(clazz); } return new ClassMetadata(clazz); }  static ClassMetadata instance( InputStream stream );  }### Answer:
@SuppressWarnings( "unchecked" ) @Test public void shouldReadEnum() throws Exception { String resourceName = "/" + MockEnum.class.getName().replace('.', '/') + ".class"; input = getClass().getResourceAsStream(resourceName); ClassMetadata cmd = ClassFileMetadataReader.instance(input); assertThat(cmd, instanceOf(EnumMetadata.class)); EnumMetadata emd = (EnumMetadata)cmd; List<String> enumValues = Arrays.asList(new String[] {"VALUE_A", "VALUE_B", "VALUE_C"}); assertThat(emd.getValues(), is(enumValues)); for (FieldMetadata fmd : emd.getFields()) { assertThat(fmd.getName(), not(anyOf(is("VALUE_A"), is("VALUE_B"), is("VALUE_C")))); } }