@Test
public void resolveVersions() throws Exception
{

    ExtensionVersionSummary v1 = mock(ExtensionVersionSummary.class);
    when(v1.getVersion()).thenReturn("1.3");
    ExtensionVersionSummary v2 = mock(ExtensionVersionSummary.class);
    when(v2.getVersion()).thenReturn("2.4.1");
    List<ExtensionVersionSummary> versionSummaries = Arrays.asList(v1, v2);
    ExtensionVersions restVersions = mock(ExtensionVersions.class);
    when(this.unmarshaller.unmarshal(any(InputStream.class))).thenReturn(restVersions);
    when(restVersions.getExtensionVersionSummaries()).thenReturn(versionSummaries);
    when(restVersions.getOffset()).thenReturn(5);
    when(restVersions.getTotalHits()).thenReturn(7);
    IterableResult<Version> result = this.repository.resolveVersions("foo", 0, -1);
    // The result must take the offset and total hits number from the REST response.
    assertEquals(5, result.getOffset());
    assertEquals(7, result.getTotalHits());
    List<Version> versions = new ArrayList<>();
    Iterators.addAll(versions, result.iterator());
    assertEquals(Arrays.asList(new DefaultVersion("1.3"), new DefaultVersion("2.4.1")), versions);
}