### Question:
FromCodebase implements Glossary { @Override public Stream<Definition> definitions() { return this.types .filter(Type::hasGlossaryTermAnnotation) .filter(Type::hasJavadoc) .map(Type::definition); } FromCodebase(final @NonNull Stream<Type> types);  FromCodebase(final Codebase codebase); @Override Stream<Definition> definitions();  }### Answer:
@Test public void anEmptyListOfTypesHasNoDefinitions() { Assertions.assertThat( new FromCodebase( new ListOf<Type>().stream() ).definitions() ).isEmpty(); }
@Test public void anEmptyCodebaseHasNoDefinitions() { Assertions.assertThat( new FromCodebase( new EmptyCodebase() ).definitions() ).isEmpty(); }
@Test @SuppressWarnings("PMD.AvoidDuplicateLiterals") public void codebaseOfTypeWithAnnotationAndJavadocHasDefinitions() { Assertions.assertThat( new FromCodebase( new ListOf<Type>( new FakeType( "FakeType", "Acts like a Type." ) ).stream() ).definitions() ).containsExactlyInAnyOrder( new Definition("FakeType", "Acts like a Type.") ); }
@Test public void codebaseWithTypeWithoutAnnotationHasNoDefinitions() { Assertions.assertThat( new FromCodebase( new ListOf<Type>( new FakeTypeWithoutAnnotation() ).stream() ).definitions() ).isEmpty(); }
@Test public void codebaseWithTypeWithoutJavadocHasNoDefinitions() { Assertions.assertThat( new FromCodebase( new ListOf<Type>( new FakeTypeWithoutJavadoc() ).stream() ).definitions() ).isEmpty(); }
@Test @SuppressWarnings({ "PMD.AvoidDuplicateLiterals", "PMD.JUnitAssertionsShouldIncludeMessage" }) public void codebaseWithTypesHasDefinitionsForTheRightTypes() { Assertions.assertThat( new FromCodebase( new ListOf<>( new FakeTypeWithoutJavadoc(), new FakeType( "FakeType1", "Acts like a Type." ), new FakeTypeWithoutAnnotation(), new FakeType( "FakeType2", "Also acts like a Type." ), new FakeTypeWithoutAnnotation() ).stream() ).definitions() ).containsExactlyInAnyOrder( new Definition("FakeType1", "Acts like a Type."), new Definition("FakeType2", "Also acts like a Type.") ); }