ClassContext extends Context { @Override public long numSpecs() { long declaredInSelf = getSpecs().count(); long declaredInDescendants = getSubContexts() .map(Context::numSpecs) .collect(Collectors.summingLong(x -> x)); return declaredInSelf + declaredInDescendants; } protected  ClassContext(String id, Description suiteDescription); @Override void addSpec(Spec spec); void addSubContext(Context context); @Override Description getDescription(); @Override boolean hasSpecs(); @Override long numSpecs(); @Override void run(RunNotifier notifier);  }
@Test public void aSpecIs_anNonStaticItField() throws Exception { subject = ContextFactory.createRootContext(ContextClasses.StaticIt.class); assertThat(subject.numSpecs(), equalTo(0L)); }
@Test public void aSubContextIs_aNonStaticInnerClass() throws Exception { subject = ContextFactory.createRootContext(ContextClasses.NestedStaticClassIt.class); assertThat(subject.numSpecs(), equalTo(0L)); }