DefaultDockerCloudSupportRegistry extends DockerCloudSupportRegistry { @Nonnull @Override public DefaultDockerCloudSupport getSupport(@Nonnull String code) { DockerCloudUtils.requireNonNull(code, "Cloud code cannot be null."); for (DefaultDockerCloudSupport cloudSupport : DefaultDockerCloudSupport.values()) { if (cloudSupport.code().equals(code)) { return cloudSupport; } } throw new IllegalArgumentException("Unknown cloud support code: " + code); }  @Nonnull @Override DefaultDockerCloudSupport getSupport(@Nonnull String code);  }
@Test public void normalLookup() { DefaultDockerCloudSupportRegistry registry = new DefaultDockerCloudSupportRegistry(); for (DefaultDockerCloudSupport support : DefaultDockerCloudSupport.values()) { assertThat(registry.getSupport(support.code())).isEqualTo(support); } }
@Test public void invalidInput() { DefaultDockerCloudSupportRegistry registry = new DefaultDockerCloudSupportRegistry(); assertThatExceptionOfType(NullPointerException.class).isThrownBy(() -> registry.getSupport(null)); assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> registry.getSupport("unknown code")); }