@Test(expected = NullPointerException.class) public void registerLinkFactoryWithNullLinkType() { try { linkFactoryProvider.registerLinkFactory(null, linkFactoryMock); } catch (NullPointerException e) { assertThat(e.getMessage()).isEqualTo("linkType must not be null"); throw e; } }
public LinkFactory registerLinkFactory(final LinkType linkType, final LinkFactory linkFactory) { Objects.requireNonNull(linkType, "linkType must not be null"); Objects.requireNonNull(linkFactory, "linkFactory must not be null"); return this.linkFactories.put(linkType, linkFactory); }
LinkFactoryProvider { public LinkFactory registerLinkFactory(final LinkType linkType, final LinkFactory linkFactory) { Objects.requireNonNull(linkType, "linkType must not be null"); Objects.requireNonNull(linkFactory, "linkFactory must not be null"); return this.linkFactories.put(linkType, linkFactory); } }
LinkFactoryProvider { public LinkFactory registerLinkFactory(final LinkType linkType, final LinkFactory linkFactory) { Objects.requireNonNull(linkType, "linkType must not be null"); Objects.requireNonNull(linkFactory, "linkFactory must not be null"); return this.linkFactories.put(linkType, linkFactory); } LinkFactoryProvider();  LinkFactoryProvider(final Map<LinkType, LinkFactory> linkFactories); }
LinkFactoryProvider { public LinkFactory registerLinkFactory(final LinkType linkType, final LinkFactory linkFactory) { Objects.requireNonNull(linkType, "linkType must not be null"); Objects.requireNonNull(linkFactory, "linkFactory must not be null"); return this.linkFactories.put(linkType, linkFactory); } LinkFactoryProvider();  LinkFactoryProvider(final Map<LinkType, LinkFactory> linkFactories); LinkFactory getLinkFactory(final LinkType linkType); LinkFactory registerLinkFactory(final LinkType linkType, final LinkFactory linkFactory); }
LinkFactoryProvider { public LinkFactory registerLinkFactory(final LinkType linkType, final LinkFactory linkFactory) { Objects.requireNonNull(linkType, "linkType must not be null"); Objects.requireNonNull(linkFactory, "linkFactory must not be null"); return this.linkFactories.put(linkType, linkFactory); } LinkFactoryProvider();  LinkFactoryProvider(final Map<LinkType, LinkFactory> linkFactories); LinkFactory getLinkFactory(final LinkType linkType); LinkFactory registerLinkFactory(final LinkType linkType, final LinkFactory linkFactory);  }