### Question:
VersionedFlowsResult extends AbstractWritableResult<List<VersionedFlow>> implements Referenceable { @Override public ReferenceResolver createReferenceResolver(final Context context) { final Map<Integer,VersionedFlow> backRefs = new HashMap<>(); final AtomicInteger position = new AtomicInteger(0); versionedFlows.forEach(f -> backRefs.put(position.incrementAndGet(), f)); return new ReferenceResolver() { @Override public ResolvedReference resolve(final CommandOption option, final Integer position) { final VersionedFlow versionedFlow = backRefs.get(position); if (versionedFlow != null) { if (option != null && option == CommandOption.BUCKET_ID) { return new ResolvedReference(option, position, versionedFlow.getBucketName(), versionedFlow.getBucketIdentifier()); } else { return new ResolvedReference(option, position, versionedFlow.getName(), versionedFlow.getIdentifier()); } } else { return null; } } @Override public boolean isEmpty() { return backRefs.isEmpty(); } }; } VersionedFlowsResult(final ResultType resultType, final List<VersionedFlow> flows); @Override List<VersionedFlow> getResult(); @Override ReferenceResolver createReferenceResolver(final Context context);  }### Answer:
@Test public void testReferenceResolver() { final VersionedFlowsResult result = new VersionedFlowsResult(ResultType.SIMPLE, flows); final ReferenceResolver resolver = result.createReferenceResolver(Mockito.mock(Context.class)); Assert.assertEquals("ea752054-22c6-4fc0-b851-967d9a3837cb", resolver.resolve(null, 1).getResolvedValue()); Assert.assertEquals("ddf5f289-7502-46df-9798-4b0457c1816b", resolver.resolve(null, 2).getResolvedValue()); Assert.assertEquals("ea752054-22c6-4fc0-b851-967d9a3837cb", resolver.resolve(CommandOption.FLOW_ID, 1).getResolvedValue()); Assert.assertEquals("ddf5f289-7502-46df-9798-4b0457c1816b", resolver.resolve(CommandOption.FLOW_ID, 2).getResolvedValue()); Assert.assertEquals("b1", resolver.resolve(CommandOption.BUCKET_ID, 1).getResolvedValue()); Assert.assertEquals("b2", resolver.resolve(CommandOption.BUCKET_ID, 2).getResolvedValue()); Assert.assertEquals(null, resolver.resolve(CommandOption.FLOW_ID, 3)); }