### Question:
ClassExamplesLoader implements ExamplesLoader { public List<Example.Builder> load(final Class featureClass) { final Reflections reflections = new Reflections(featureClass.getPackage().getName()); final Set<Class<? extends Example.Source>> examplesSuppliers = reflections.getSubTypesOf(Example.Source.class); return examplesSuppliers.stream() .map(Class::getDeclaredMethods) .flatMap(Arrays::stream) .filter(method -> method.isAnnotationPresent(Example.Supplier.class)) .map(ClassExamplesLoader::retrieveExample) .filter(Optional::isPresent) .map(Optional::get) .filter(example -> example.getFeatureClass().equals(featureClass)) .collect(Collectors.toList()); }  List<Example.Builder> load(final Class featureClass);  }### Answer:
@Test public void noExamples() { final Class<String> featureClass; final List<Example.Builder> examples; given: featureClass = String.class; when: examples = this.loader.load(featureClass); then: assertThat(examples) .as("No examples sources in the String package should not create examples.") .isEmpty(); }
@Test public void suppliedExamplesForTheSameTargetClass() { final Class<ClassExamplesLoaderTest> featureClass; final List<Example.Builder> examples; given: featureClass = ClassExamplesLoaderTest.class; when: examples = this.loader.load(featureClass); then: assertThat(examples) .as("The class has one valid supplier for the target test class.") .hasSize(1); assertThat(examples.get(0).getFeatureClass()) .as("The feature class is the target test class.") .isEqualTo(featureClass); assertThat(examples.get(0).getScenarioMethodName()) .as("The scenario method name is the one supplied for the target test class.") .isEqualTo(ExampleSource.EXAMPLE_SUPPLIER_STATIC_TEST_CLASS); }
@Test public void suppliedExamplesForTheSameDifferentTargetClass() { final Class<ClassExamplesLoader> featureClass; final List<Example.Builder> examples; given: featureClass = ClassExamplesLoader.class; when: examples = this.loader.load(featureClass); then: assertThat(examples) .as("The class has one valid supplier for the target test class.") .hasSize(1); assertThat(examples.get(0).getFeatureClass()) .as("The feature class is the target test class.") .isEqualTo(featureClass); assertThat(examples.get(0).getScenarioMethodName()) .as("The scenario method name is the one supplied for the target test class.") .isEqualTo(ExampleSource.EXAMPLE_SUPPLIER_STATIC_MAIN_CLASS); }