### Question:
FeatureService { public DetailledFeatureDTO find(String code) throws NotFoundException { return this.featureCollection.get(code) .map(feature -> new DetailledFeatureDTO( feature.getCode(), this.featureActivator.getState(feature.getCode()), feature.getName(), feature.getDescription())) .orElseThrow(() -> throwFeatureDontExists(code)); }  List<FeatureDTO> listAll(); DetailledFeatureDTO find(String code); FeatureDTO findDefaultOf(String code); List<FeatureDTO> retrieveStateOf(List<String> codes); void update(List<FeatureDTO> featuresToUpdate); void reset(List<String> featuresToReset); boolean isEnabled(String featureCode);  }### Answer:
@Test public void find_should_return_the_detailled_informations() throws NotFoundException { String wantedFeatureCode = "my-feature"; String wantedFeatureDesc = "Description of Feature"; String wantedFeatureName = "Name of Feature"; IFeature wantedFeature = given_a_feature(wantedFeatureCode, wantedFeatureDesc, wantedFeatureName); IFeature unwantedFeature = given_a_feature("nope", "Nope Desc", "Nope Name"); List<IFeature> features = new ArrayList<>(); features.add(unwantedFeature); features.add(wantedFeature); Mockito.doReturn(true).when(featureActivatorMock).getState(wantedFeatureCode); Mockito.doReturn(Optional.of(wantedFeature)).when(featureCollectionMock).get(wantedFeatureCode); DetailledFeatureDTO detailledFeatureDTO = cut.find(wantedFeatureCode); Assertions.assertThat(detailledFeatureDTO).isNotNull(); Assertions.assertThat(detailledFeatureDTO).isEqualTo(new DetailledFeatureDTO(wantedFeatureCode, true, wantedFeatureName, wantedFeatureDesc)); }
@Test public void find_should_throw_not_found_if_code_doesnt_exists() throws NotFoundException { String wantedFeatureCode = "not-existing"; Mockito.doReturn(Optional.empty()).when(featureCollectionMock).get(wantedFeatureCode); assertThrows(NotFoundException.class, () -> cut.find(wantedFeatureCode)); }