### Question:
ProvisioningScreensServiceImpl implements ProvisioningScreensService { @Override public RuntimesInfo getRuntimesInfo(final ProviderKey providerKey) { checkNotNull("providerKey", providerKey); final Provider provider = providerService.getProvider(providerKey); if (provider == null) { return null; } final Collection<RuntimeListItem> items = runtimeService.getRuntimeItems(providerKey); return new RuntimesInfo(provider, items); } ProvisioningScreensServiceImpl(); @Inject  ProvisioningScreensServiceImpl(final ProviderTypeService providerTypeService,
                                          final ProviderService providerService,
                                          final RuntimeService runtimeService); @Override ProvidersInfo getProvidersInfo(final ProviderTypeKey providerTypeKey); @Override RuntimesInfo getRuntimesInfo(final ProviderKey providerKey); @Override boolean hasRuntimes(final ProviderKey providerKey);  }### Answer:
@Test public void testGetRuntimesInfoProviderExisting() { when(providerService.getProvider(providerKey)).thenReturn(provider); when(runtimeService.getRuntimeItems(providerKey)).thenReturn(runtimeListItems); RuntimesInfo info = service.getRuntimesInfo(providerKey); assertNotNull(info); assertEquals(provider, info.getProvider()); assertEquals(runtimeListItems, info.getRuntimeItems()); verify(providerService, times(1)).getProvider(providerKey); verify(runtimeService, times(1)).getRuntimeItems(providerKey); }
@Test public void testGetRuntimesInfoProviderNotExisting() { when(providerService.getProvider(providerKey)).thenReturn(null); RuntimesInfo info = service.getRuntimesInfo(providerKey); assertNull(info); verify(providerService, times(1)).getProvider(providerKey); verify(runtimeService, never()).getRuntimeItems(providerKey); }