@Test
public void shouldReturnTheLatestStageCounter() {

    ObjectListing listing = new ObjectListing();
    List<String> commonPrefixes = new ArrayList<>();
    commonPrefixes.add("pipeline/stage/job/1.2");
    commonPrefixes.add("pipeline/stage/job/1.1");
    commonPrefixes.add("pipeline/stage/job/1.7");
    listing.setCommonPrefixes(commonPrefixes);
    doReturn(listing).when(mockClient).listObjects(any(ListObjectsRequest.class));
    S3ArtifactStore store = new S3ArtifactStore(mockClient, "foo-bar");
    String prefix = store.getLatestPrefix("pipeline", "stage", "job", "1");
    assertEquals("pipeline/stage/job/1.7", prefix);
}