@Test(expected = NullPointerException.class) public void constructLinkWithNullLinkSettings() { try { loopbackLinkFactory.constructLink(() -> OPERATOR_ADDRESS, null); fail(); } catch (NullPointerException e) { assertThat(e.getMessage()).isEqualTo("linkSettings must not be null"); throw e; } }
public Link<?> constructLink( final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings ) { Objects.requireNonNull(operatorAddressSupplier, "operatorAddressSupplier must not be null"); Objects.requireNonNull(linkSettings, "linkSettings must not be null"); if (!this.supports(linkSettings.getLinkType())) { throw new LinkException( String.format("LinkType not supported by this factory. linkType=%s", linkSettings.getLinkType()), LinkId.of("n/a") ); } return new LoopbackLink(operatorAddressSupplier, linkSettings, packetRejector); }
LoopbackLinkFactory implements LinkFactory { public Link<?> constructLink( final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings ) { Objects.requireNonNull(operatorAddressSupplier, "operatorAddressSupplier must not be null"); Objects.requireNonNull(linkSettings, "linkSettings must not be null"); if (!this.supports(linkSettings.getLinkType())) { throw new LinkException( String.format("LinkType not supported by this factory. linkType=%s", linkSettings.getLinkType()), LinkId.of("n/a") ); } return new LoopbackLink(operatorAddressSupplier, linkSettings, packetRejector); } }
LoopbackLinkFactory implements LinkFactory { public Link<?> constructLink( final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings ) { Objects.requireNonNull(operatorAddressSupplier, "operatorAddressSupplier must not be null"); Objects.requireNonNull(linkSettings, "linkSettings must not be null"); if (!this.supports(linkSettings.getLinkType())) { throw new LinkException( String.format("LinkType not supported by this factory. linkType=%s", linkSettings.getLinkType()), LinkId.of("n/a") ); } return new LoopbackLink(operatorAddressSupplier, linkSettings, packetRejector); } LoopbackLinkFactory(final PacketRejector packetRejector); }
LoopbackLinkFactory implements LinkFactory { public Link<?> constructLink( final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings ) { Objects.requireNonNull(operatorAddressSupplier, "operatorAddressSupplier must not be null"); Objects.requireNonNull(linkSettings, "linkSettings must not be null"); if (!this.supports(linkSettings.getLinkType())) { throw new LinkException( String.format("LinkType not supported by this factory. linkType=%s", linkSettings.getLinkType()), LinkId.of("n/a") ); } return new LoopbackLink(operatorAddressSupplier, linkSettings, packetRejector); } LoopbackLinkFactory(final PacketRejector packetRejector); Link<?> constructLink(
      final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings
  ); @Override boolean supports(LinkType linkType); }
LoopbackLinkFactory implements LinkFactory { public Link<?> constructLink( final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings ) { Objects.requireNonNull(operatorAddressSupplier, "operatorAddressSupplier must not be null"); Objects.requireNonNull(linkSettings, "linkSettings must not be null"); if (!this.supports(linkSettings.getLinkType())) { throw new LinkException( String.format("LinkType not supported by this factory. linkType=%s", linkSettings.getLinkType()), LinkId.of("n/a") ); } return new LoopbackLink(operatorAddressSupplier, linkSettings, packetRejector); } LoopbackLinkFactory(final PacketRejector packetRejector); Link<?> constructLink(
      final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings
  ); @Override boolean supports(LinkType linkType);  }