final YumHosted yum = mock(YumHosted.class);
when(yumRegistry.get(RELEASES)).thenReturn(yum);
when(yum.getVersion(EXISTING_ALIAS)).thenReturn(TRUNK_VERSION);
when(yum.getVersion(ALIAS_TO_CREATE)).thenReturn(VERSION_TO_CREATE);
final CapabilityReference reference = mock(CapabilityReference.class);
final Collection<CapabilityReference> references = Lists.newArrayList();
references.add(reference);
final GenerateMetadataCapability yumRepositoryCapability = mock(GenerateMetadataCapability.class);
final CapabilityContext capabilityContext = mock(CapabilityContext.class);
when(reference.context()).thenReturn(capabilityContext);
when(capabilityContext.id()).thenReturn(CapabilityIdentity.capabilityIdentity("ID"));
when(capabilityContext.isEnabled()).thenReturn(true);
when(capabilityContext.notes()).thenReturn("Notes");
when(reference.capabilityAs(GenerateMetadataCapability.class)).thenReturn(yumRepositoryCapability);
Map<String, String> aliases = Maps.newHashMap();
aliases.put("foo", "bar");
when(yumRepositoryCapability.getConfig()).thenReturn(
new GenerateMetadataCapabilityConfiguration(RELEASES, aliases, true, 1, "/comps.xml")
);