@Test public void get_should_return_empty_if_not_found() { IFeature wantedFeature = Mockito.mock(IFeature.class); Mockito.doReturn(false).when(availableFeaturesMock).containsKey("nope"); Optional<IFeature> iFeature = cut.get("nope"); Assertions.assertThat(iFeature.isPresent()).isFalse(); Mockito.verify(availableFeaturesMock, Mockito.never()).get(Mockito.anyString()); }
public Optional<IFeature> get(String code) { if (this.availableFeatures.containsKey(code)) { return Optional.of(this.availableFeatures.get(code)); } return Optional.empty(); }
FeatureCollection { public Optional<IFeature> get(String code) { if (this.availableFeatures.containsKey(code)) { return Optional.of(this.availableFeatures.get(code)); } return Optional.empty(); } }
FeatureCollection { public Optional<IFeature> get(String code) { if (this.availableFeatures.containsKey(code)) { return Optional.of(this.availableFeatures.get(code)); } return Optional.empty(); } FeatureCollection();   FeatureCollection(Map<String, IFeature> allFeatures); }
FeatureCollection { public Optional<IFeature> get(String code) { if (this.availableFeatures.containsKey(code)) { return Optional.of(this.availableFeatures.get(code)); } return Optional.empty(); } FeatureCollection();   FeatureCollection(Map<String, IFeature> allFeatures); List<IFeature> list(); Optional<IFeature> get(String code); }
FeatureCollection { public Optional<IFeature> get(String code) { if (this.availableFeatures.containsKey(code)) { return Optional.of(this.availableFeatures.get(code)); } return Optional.empty(); } FeatureCollection();   FeatureCollection(Map<String, IFeature> allFeatures); List<IFeature> list(); Optional<IFeature> get(String code);  }