Skip to content

Commit

Permalink
FasterXML#248 - fix VerisonUti.versionFor() unintended to return null…
Browse files Browse the repository at this point in the history
… instead of Version.unknownVersion() after commit 88c296c
  • Loading branch information
Sammy Chu committed Jan 26, 2016
1 parent c1922ac commit 18ad3bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ protected VersionUtil()
*/
public static Version versionFor(Class<?> cls)
{
return packageVersionFor(cls);
Version version = packageVersionFor(cls);
return version == null ? Version.unknownVersion() : version;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ public void testMavenVersionParsing() {
public void testPackageVersionMatches() {
assertEquals(PackageVersion.VERSION, VersionUtil.versionFor(UTF8JsonGenerator.class));
}

public void testVersionForUnknownVersion() {
// expecting return version.unknownVersion() instead of null
assertEquals(Version.unknownVersion(), VersionUtil.versionFor(TestVersionUtil.class));
}
}

0 comments on commit 18ad3bc

Please sign in to comment.