FallbackVersionDiscovery implements VersionDiscovery { @Override public Version getLatestVersion() { Version latestVersion = wrapped.getLatestVersion(); if (latestVersion.isEqualTo(new NullVersion())) { return fallback; } return latestVersion; } FallbackVersionDiscovery(VersionDiscovery wrapped, Version fallback); @Override Version getLatestVersion(); @Override void reportAllProgressTo(ProgressReport report);  }
@Test public void returnsOriginalVersionIfItIsNotTheNullVersion() throws Exception { Version original = new NumericVersion(0, 8, 9); when(wrapped.getLatestVersion()).thenReturn(original); assertThat(discovery.getLatestVersion(), is(original)); }