### Question:
AbstractLink implements Link<L> { @Override public LinkId getLinkId() { if (linkId.get() == null) { throw new IllegalStateException("The LinkId must be set before using a Link"); } return linkId.get(); } protected  AbstractLink(
      final Supplier<InterledgerAddress> operatorAddressSupplier,
      final L linkSettings
  ); @Override LinkId getLinkId(); @Override void setLinkId(final LinkId linkId); @Override Supplier<InterledgerAddress> getOperatorAddressSupplier(); @Override L getLinkSettings(); @Override void registerLinkHandler(final LinkHandler ilpDataHandler); @Override void unregisterLinkHandler(); @Override Optional<LinkHandler> getLinkHandler(); @Override String toString();  }### Answer:
@Test(expected = IllegalStateException.class) public void getLinkIdWhenNull() { this.link = new TestAbstractLink( () -> OPERATOR_ADDRESS, LinkSettings.builder().linkType(LinkType.of("foo")).build() ); try { link.getLinkId(); } catch (IllegalStateException e) { assertThat(e.getMessage()).isEqualTo("The LinkId must be set before using a Link"); throw e; } }
@Test public void getLinkId() { assertThat(link.getLinkId()).isEqualTo(LINK_ID); }