@Test void defaultProtocolShouldReturnEmptyWhenEmpty() { Optional<Protocol> defaultProtocol = MailRepositoryStoreConfiguration.computeDefaultProtocol(ImmutableList.of()); assertThat(defaultProtocol).isEmpty(); }
static Optional<Protocol> computeDefaultProtocol(List<Item> items) { return items.stream() .flatMap(item -> item.getProtocols().stream()) .findFirst(); }
MailRepositoryStoreConfiguration { static Optional<Protocol> computeDefaultProtocol(List<Item> items) { return items.stream() .flatMap(item -> item.getProtocols().stream()) .findFirst(); } }
MailRepositoryStoreConfiguration { static Optional<Protocol> computeDefaultProtocol(List<Item> items) { return items.stream() .flatMap(item -> item.getProtocols().stream()) .findFirst(); } MailRepositoryStoreConfiguration(List<Item> items, Optional<Protocol> defaultProtocol); }
MailRepositoryStoreConfiguration { static Optional<Protocol> computeDefaultProtocol(List<Item> items) { return items.stream() .flatMap(item -> item.getProtocols().stream()) .findFirst(); } MailRepositoryStoreConfiguration(List<Item> items, Optional<Protocol> defaultProtocol); static MailRepositoryStoreConfiguration forItems(Item... items); static MailRepositoryStoreConfiguration forItems(List<Item> items); static MailRepositoryStoreConfiguration parse(HierarchicalConfiguration<ImmutableNode> configuration); List<Item> getItems(); Optional<Protocol> getDefaultProtocol(); }
MailRepositoryStoreConfiguration { static Optional<Protocol> computeDefaultProtocol(List<Item> items) { return items.stream() .flatMap(item -> item.getProtocols().stream()) .findFirst(); } MailRepositoryStoreConfiguration(List<Item> items, Optional<Protocol> defaultProtocol); static MailRepositoryStoreConfiguration forItems(Item... items); static MailRepositoryStoreConfiguration forItems(List<Item> items); static MailRepositoryStoreConfiguration parse(HierarchicalConfiguration<ImmutableNode> configuration); List<Item> getItems(); Optional<Protocol> getDefaultProtocol();  }