@Test void parseShouldThrowWhenVersionIsNull() { assertThatThrownBy(() -> versionParser.parse(null)) .isInstanceOf(NullPointerException.class); }
@VisibleForTesting Version parse(String version) { Preconditions.checkNotNull(version); return supportedVersions.stream() .filter(jmapVersion -> jmapVersion.asString().equalsIgnoreCase(version)) .findFirst() .orElseThrow(() -> new IllegalArgumentException(version + " is not a supported version")); }
VersionParser { @VisibleForTesting Version parse(String version) { Preconditions.checkNotNull(version); return supportedVersions.stream() .filter(jmapVersion -> jmapVersion.asString().equalsIgnoreCase(version)) .findFirst() .orElseThrow(() -> new IllegalArgumentException(version + " is not a supported version")); } }
VersionParser { @VisibleForTesting Version parse(String version) { Preconditions.checkNotNull(version); return supportedVersions.stream() .filter(jmapVersion -> jmapVersion.asString().equalsIgnoreCase(version)) .findFirst() .orElseThrow(() -> new IllegalArgumentException(version + " is not a supported version")); } @Inject  VersionParser(Set<Version> supportedVersions); }
VersionParser { @VisibleForTesting Version parse(String version) { Preconditions.checkNotNull(version); return supportedVersions.stream() .filter(jmapVersion -> jmapVersion.asString().equalsIgnoreCase(version)) .findFirst() .orElseThrow(() -> new IllegalArgumentException(version + " is not a supported version")); } @Inject  VersionParser(Set<Version> supportedVersions);  }
VersionParser { @VisibleForTesting Version parse(String version) { Preconditions.checkNotNull(version); return supportedVersions.stream() .filter(jmapVersion -> jmapVersion.asString().equalsIgnoreCase(version)) .findFirst() .orElseThrow(() -> new IllegalArgumentException(version + " is not a supported version")); } @Inject  VersionParser(Set<Version> supportedVersions);   }