### Question:
BerlinGroupLinksRewriter implements LinksRewriter { protected Optional<String> retrievePaymentService(String link) { String[] linkPaths = getLinkPathsAsArray(link); if (linkPaths.length < 1) { return Optional.empty(); } return Optional.of(linkPaths[0]); } BerlinGroupLinksRewriter(LinksTemplate linksTemplate,
                                    String host,
                                    String version); void registerPlaceholder(String placeholder,
                                    Function<String, Optional<String>> paramRetriever); @Override Map<String, HrefType> rewrite(Map<String, HrefType> links);  }### Answer:
@Test void retrievePaymentService_success_existsInLink() { String link = "https: Optional<String> actualPaymentServiceOptional = berlinGroupLinksRewriter.retrievePaymentService(link); assertThat(actualPaymentServiceOptional).contains(PAYMENT_SERVICE); }
@Test void retrievePaymentService_failure_notExistsInLink() { String link = "https: Optional<String> actualPaymentServiceOptional = berlinGroupLinksRewriter.retrievePaymentService(link); assertThat(actualPaymentServiceOptional).isNotPresent(); }