SubstitutionStrategyRegistry { public final Optional<SubstitutionStrategy> getMatchingStrategy(final WithDittoHeaders withDittoHeaders) { for (final SubstitutionStrategy strategy : strategies) { if (strategy.matches(withDittoHeaders)) { return Optional.of(strategy); } } return Optional.empty(); } private  SubstitutionStrategyRegistry(); static SubstitutionStrategyRegistry newInstance(); final Optional<SubstitutionStrategy> getMatchingStrategy(final WithDittoHeaders withDittoHeaders);  }
@Test public void getMatchingStrategyReturnsEmptyOptionalWhenNoStrategyMatches() { final ModifyAttribute nonHandledCommand = ModifyAttribute.of(ThingId.of("org.eclipse.ditto:my-thing"), JsonPointer.of("attributePointer"), JsonValue.of("attributeValue"), DITTO_HEADERS); final Optional<SubstitutionStrategy> strategy = underTest.getMatchingStrategy(nonHandledCommand); assertThat(strategy).isEmpty(); }