### Question:
RuntimeManagementServiceImpl implements RuntimeManagementService { @Override public ContainerList getContainers(final ServerTemplate serverTemplate, final ContainerSpec containerSpec) { return getServerTemplateContainers(serverTemplate.getId(), containerSpec.getId()); }  @Override ServerInstanceKeyList getServerInstances(final String serverTemplateId); @Override ContainerList getContainers(final ServerTemplate serverTemplate,
                                       final ContainerSpec containerSpec); ContainerList getServerTemplateContainers(final String serverTemplateId,
                                                        final String containerSpecId); ContainerList getServerInstanceContainers(final String serverTemplateId,
                                                        final String serverInstanceId); @Override ContainerList getContainers(ServerInstanceKey serverInstanceKey); KieServerTemplateStorage getTemplateStorage(); void setTemplateStorage(KieServerTemplateStorage templateStorage); KieServerInstanceManager getKieServerInstanceManager(); void setKieServerInstanceManager(KieServerInstanceManager kieServerInstanceManager);  }### Answer:
@Test public void testGetContainersByInstance() { when(kieServerInstanceManager.getContainers(any(ServerInstanceKey.class))).thenReturn(singletonList(container)); org.kie.server.controller.api.model.runtime.ServerInstanceKey instanceKey = new ServerInstanceKey(serverTemplate.getId(), "test server", "instanceId", "http: serverTemplate.addServerInstance(instanceKey); specManagementService.saveServerTemplate(serverTemplate); ContainerList containers = runtimeManagementService.getContainers(instanceKey); assertNotNull(containers); assertEquals(1, containers.getContainers().length); assertEquals(container, containers.getContainers()[0]); verify(kieServerInstanceManager).getContainers(any()); }
@Test public void testGetContainersByTemplate() { when(kieServerInstanceManager.getContainers(any(), any())).thenReturn(singletonList(container)); org.kie.server.controller.api.model.runtime.ServerInstanceKey instanceKey = new ServerInstanceKey("instanceId", "test server", serverTemplate.getId(), "http: serverTemplate.addServerInstance(instanceKey); specManagementService.saveServerTemplate(serverTemplate); ContainerList containers = runtimeManagementService.getContainers(serverTemplate, containerSpec); assertNotNull(containers); assertEquals(1, containers.getContainers().length); assertEquals(container, containers.getContainers()[0]); verify(kieServerInstanceManager).getContainers(any(), any()); }