### Question:
FieldExamplesLoader implements ExamplesLoader { public List<Example.Builder> load(final Class featureClass) { return Arrays.stream(featureClass.getDeclaredFields()) .filter(FieldExamplesLoader::providesExamples) .map(FieldExamplesLoader::retrieveExample) .filter(Optional::isPresent) .map(Optional::get) .flatMap(Collection::stream) .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: Assertions.assertThat(examples).as("No example fields in the target class.").isEmpty(); }
@Test public void examples() { final Class featureClass; final List<Example.Builder> examples; given: featureClass = ExampleFieldsProvider.class; when: examples = this.loader.load(featureClass); then: Assertions.assertThat(examples).as("The target class has one valid example field.").hasSize(1); }
@Test public void initializationErrorExample() { final Class featureClass; final List<Example.Builder> examples; given: featureClass = InitializationErrorExampleFieldsProvider.class; when: examples = this.loader.load(featureClass); then: Assertions.assertThat(examples).as("The target class has one invalid example field.").isEmpty(); }