@SuppressWarnings("unchecked") @Test public void innerEnum(){
  Class<?> pc=PlayingCard.class;
  List<Enum<?>> include=new ArrayList<>();
  List<Enum<?>> exclude=new ArrayList<>();
  for (  Class<?> c : pc.getDeclaredClasses()) {
    int mods=c.getModifiers();
    if (c.isEnum()) {
      if (Modifier.isPublic(mods)) {
        include.addAll(asList(c.getEnumConstants()));
      }
 else {
        exclude.addAll(asList(c.getEnumConstants()));
      }
    }
  }
  Set<TypedOperation> actual=getConcreteOperations(pc);
  assertEquals("number of statements",include.size() + 5,actual.size());
  for (  Enum<?> e : include) {
    assertTrue("enum constant " + e.name() + " should occur",actual.contains(createEnumOperation(e)));
  }
  for (  Enum<?> e : exclude) {
    assertFalse("enum constant " + e.name() + " should not occur",actual.contains(createEnumOperation(e)));
  }
}

@ SuppressWarnings ( "unchecked" ) @ Test public void innerEnum ( ) { Class < ? > pc = PlayingCard . class ; List < Enum < ? > > include = new ArrayList < > ( ) ; List < Enum < ? > > exclude = new ArrayList < > ( ) ; for ( Class < ? > c : pc . getDeclaredClasses ( ) ) { int mods = c . getModifiers ( ) ; if ( c . isEnum ( ) ) { if ( Modifier . isPublic ( mods ) ) { include . addAll ( asList ( c . getEnumConstants ( ) ) ) ; } else { exclude . addAll ( asList ( c . getEnumConstants ( ) ) ) ; } } } Set < TypedOperation > actual = getConcreteOperations ( pc ) ; assertEquals ( "number of statements" , include . size ( ) + 5 , actual . size ( ) ) ; for ( Enum < ? > e : include ) { assertTrue ( "enum constant " + e . name ( ) + " should occur" , actual . contains ( createEnumOperation ( e ) ) ) ; } for ( Enum < ? > e : exclude ) { assertFalse ( "enum constant " + e . name ( ) + " should not occur" , actual . contains ( createEnumOperation ( e ) ) ) ; } }
innerenum tests that reflection . getstatements is collecting simple enum constants from a class . uses randoop . test . playingcard , which has two public enums , one private enum , and one enum with package access .
