@Test
public void testEnumAndNamedClassesInMethod() {

  try {
    final JavaFileAnalyzer2 jfa =
        (JavaFileAnalyzer2)
            FileAnalyzerFactory.buildFileAnalyzer(
                new File("./src/test/java/org/eclipse/steady/java/test/ConfigKey.java"));
    final Map<ConstructId, Construct> constructs = jfa.getConstructs();
    // The parsing should produce the following 5 elements:
    final JavaPackageId p = new JavaPackageId("org.eclipse.steady.java.test");
    // The enum and its methods
    final JavaEnumId e = JavaId.parseEnumQName("org.eclipse.steady.java.test.ConfigKey");
    final JavaConstructorId enum_c1 =
        JavaId.parseConstructorQName(
            "org.eclipse.steady.java.test.ConfigKey(Class,String,String)");
    final JavaMethodId enum_m1 =
        JavaId.parseMethodQName("org.eclipse.steady.java.test.ConfigKey.getType()");
    final JavaMethodId enum_m2 =
        JavaId.parseMethodQName("org.eclipse.steady.java.test.ConfigKey.getKey()");
    final JavaMethodId enum_m3 =
        JavaId.parseMethodQName("org.eclipse.steady.java.test.ConfigKey.getDefaultValue()");
    final JavaMethodId enum_m4 =
        JavaId.parseMethodQName("org.eclipse.steady.java.test.ConfigKey.fromKey(String)");
    // The anon class and its method
    final JavaClassId anon_class =
        JavaId.parseClassQName("org.eclipse.steady.java.test.ConfigKey$1");
    final JavaMethodId anon_class_m1 =
        JavaId.parseMethodQName("org.eclipse.steady.java.test.ConfigKey$1.foo()");
    // The named classes
    final JavaClassId nc1 =
        JavaId.parseClassQName("org.eclipse.steady.java.test.ConfigKey$1InnerClass1");
    final JavaConstructorId nc1_c =
        JavaId.parseConstructorQName("org.eclipse.steady.java.test.ConfigKey$1InnerClass1()");
    final JavaMethodId nc1_m =
        JavaId.parseMethodQName("org.eclipse.steady.java.test.ConfigKey$1InnerClass1.foo()");
    final JavaClassId nc2 =
        JavaId.parseClassQName("org.eclipse.steady.java.test.ConfigKey$1InnerClass2");
    final JavaMethodId nc2_m =
        JavaId.parseMethodQName("org.eclipse.steady.java.test.ConfigKey$1InnerClass2.foo()");
    final JavaClassId nc3 =
        JavaId.parseClassQName("org.eclipse.steady.java.test.ConfigKey$2InnerClass1");
    final JavaConstructorId nc3_c =
        JavaId.parseConstructorQName("org.eclipse.steady.java.test.ConfigKey$2InnerClass1()");
    final JavaMethodId nc3_m =
        JavaId.parseMethodQName("org.eclipse.steady.java.test.ConfigKey$2InnerClass1.foo()");
    // Assertions
    assertEquals(17, constructs.size());
    assertTrue(constructs.containsKey(p));
    assertTrue(constructs.containsKey(e));
    assertTrue(constructs.containsKey(enum_c1));
    assertTrue(constructs.containsKey(enum_m1));
    assertTrue(constructs.containsKey(enum_m2));
    assertTrue(constructs.containsKey(enum_m3));
    assertTrue(constructs.containsKey(enum_m4));
    assertTrue(constructs.containsKey(anon_class));
    assertTrue(constructs.containsKey(anon_class_m1));
    assertTrue(constructs.containsKey(nc1));
    assertTrue(constructs.containsKey(nc1_c));
    assertTrue(constructs.containsKey(nc1_m));
    assertTrue(constructs.containsKey(nc2));
    assertTrue(constructs.containsKey(nc2_m));
    assertTrue(constructs.containsKey(nc3));
    assertTrue(constructs.containsKey(nc3_c));
    assertTrue(constructs.containsKey(nc3_m));
  } catch (FileAnalysisException e) {
    e.printStackTrace();
    assertTrue(false);
  }
}