@Test public void constructLinkWithNullLinkSettings() { expectedException.expect(NullPointerException.class); expectedException.expectMessage("linkSettings must not be null"); statelessSpspReceiverLinkFactory.constructLink(() -> OPERATOR_ADDRESS, null); }
@Override 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") ); } Preconditions.checkArgument( StatelessSpspReceiverLinkSettings.class.isAssignableFrom(linkSettings.getClass()), "Constructing an instance of StatelessSpspReceiverLink requires an instance of StatelessSpspReceiverLinkSettings" ); return new StatelessSpspReceiverLink( operatorAddressSupplier, (StatelessSpspReceiverLinkSettings) linkSettings, statelessStreamReceiver ); }
StatelessSpspReceiverLinkFactory implements LinkFactory { @Override 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") ); } Preconditions.checkArgument( StatelessSpspReceiverLinkSettings.class.isAssignableFrom(linkSettings.getClass()), "Constructing an instance of StatelessSpspReceiverLink requires an instance of StatelessSpspReceiverLinkSettings" ); return new StatelessSpspReceiverLink( operatorAddressSupplier, (StatelessSpspReceiverLinkSettings) linkSettings, statelessStreamReceiver ); } }
StatelessSpspReceiverLinkFactory implements LinkFactory { @Override 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") ); } Preconditions.checkArgument( StatelessSpspReceiverLinkSettings.class.isAssignableFrom(linkSettings.getClass()), "Constructing an instance of StatelessSpspReceiverLink requires an instance of StatelessSpspReceiverLinkSettings" ); return new StatelessSpspReceiverLink( operatorAddressSupplier, (StatelessSpspReceiverLinkSettings) linkSettings, statelessStreamReceiver ); } StatelessSpspReceiverLinkFactory(
      final PacketRejector packetRejector, final StatelessStreamReceiver statelessStreamReceiver
  ); }
StatelessSpspReceiverLinkFactory implements LinkFactory { @Override 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") ); } Preconditions.checkArgument( StatelessSpspReceiverLinkSettings.class.isAssignableFrom(linkSettings.getClass()), "Constructing an instance of StatelessSpspReceiverLink requires an instance of StatelessSpspReceiverLinkSettings" ); return new StatelessSpspReceiverLink( operatorAddressSupplier, (StatelessSpspReceiverLinkSettings) linkSettings, statelessStreamReceiver ); } StatelessSpspReceiverLinkFactory(
      final PacketRejector packetRejector, final StatelessStreamReceiver statelessStreamReceiver
  ); @Override Link<?> constructLink(
      final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings
  ); @Override boolean supports(LinkType linkType); }
StatelessSpspReceiverLinkFactory implements LinkFactory { @Override 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") ); } Preconditions.checkArgument( StatelessSpspReceiverLinkSettings.class.isAssignableFrom(linkSettings.getClass()), "Constructing an instance of StatelessSpspReceiverLink requires an instance of StatelessSpspReceiverLinkSettings" ); return new StatelessSpspReceiverLink( operatorAddressSupplier, (StatelessSpspReceiverLinkSettings) linkSettings, statelessStreamReceiver ); } StatelessSpspReceiverLinkFactory(
      final PacketRejector packetRejector, final StatelessStreamReceiver statelessStreamReceiver
  ); @Override Link<?> constructLink(
      final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings
  ); @Override boolean supports(LinkType linkType);  }