### Question:
DatastoreSchemaRepository implements ISchemaRepository { @Override public SchemaData findByTitle(String title) { log.debug("Requesting schema data. Schema title : {}", title); SchemaDataEntity entity = schemaDataEntityRepository.findByTitle(title); SchemaData schemaData = schemaDataMapper.schemaDataDtoToSchemaData(entity); log.debug("Found schema data : {}", schemaData); return schemaData; }  @Override SchemaData findByTitle(String title);  }### Answer:
@Test void shouldFindSchemaDataByTitle() throws Exception { Date now = new Date(); given(entityRepository.findByTitle(SCHEMA_TITLE)).willReturn(SchemaDataEntity.builder() .title(SCHEMA_TITLE) .schema(getResource(DRAFT_07_SCHEMA_PATH)) .createdAt(now) .build()); given(schemaDataMapper.schemaDataDtoToSchemaData(any())).willAnswer(invocation -> { SchemaDataEntity entity = invocation.getArgument(0); return SchemaData.builder() .title(entity.getTitle()) .schema(objectMapper.readTree(entity.getSchema())) .created(now) .build(); }); SchemaData schemaData = schemaRepository.findByTitle(SCHEMA_TITLE); then(schemaData).isEqualTo(SchemaData.builder() .title(SCHEMA_TITLE) .schema(objectMapper.readTree(getResource(DRAFT_07_SCHEMA_PATH))) .created(now) .build()); }
@Test void shouldReturnNullWhenNothingWasFound() { SchemaData schemaData = schemaRepository.findByTitle("nothing"); then(schemaData).isNull(); }