VersionInformation { public String getSemanticVersion() { return getVersionDescriptionComponents()[0]; } VersionInformation(VersionDescriptionProvider versionDescriptionProvider); String getSemanticVersion(); @Nullable Integer getBetaNumber(); @Nullable String getCommitSHA(); @Nullable Integer getCommitCount(); boolean isRelease(); boolean isDirty();  }
@Test public void getSemanticVersion_returnsFirstComponent() { VersionInformation versionInformation = new VersionInformation(() -> "777"); assertThat(versionInformation.getSemanticVersion(), is("777")); versionInformation = new VersionInformation(() -> "my-cool-version"); assertThat(versionInformation.getSemanticVersion(), is("my")); }
@Test public void getSemanticVersion_whenEmpty_returnsEmpty() { VersionInformation versionInformation = new VersionInformation(() -> ""); assertThat(versionInformation.getSemanticVersion(), is("")); }