### Question:
CAdvisorMonitoringManager implements UsageMonitoringManager { @Override public List<MonitoringStats> getStatsForNode(final String nodeName, final LocalDateTime from, final LocalDateTime to) { final LocalDateTime start = Optional.ofNullable(from).orElse(LocalDateTime.MIN); final LocalDateTime end = Optional.ofNullable(to).orElse(LocalDateTime.MAX); return getStats(nodeName, start, end); } @Autowired  CAdvisorMonitoringManager(
            NodesManager nodesManager,
            MessageHelper messageHelper,
            JsonMapper objectMapper,
            KubernetesManager kubernetesManager,
            @Value("${cluster.cadvisor.timeout:5}") int timeout,
            @Value("${cluster.cadvisor.port:4194}") int cAdvisorPort,
            @Value("${cluster.cadvisor.disable.proxy:false}") boolean disableProxyForCadvisor); @Override List<MonitoringStats> getStatsForNode(final String nodeName, final LocalDateTime from,
                                                 final LocalDateTime to); @Override InputStream getStatsForNodeAsInputStream(final String nodeName,
                                                    final LocalDateTime from,
                                                    final LocalDateTime to,
                                                    final Duration interval); @Override long getDiskSpaceAvailable(final String nodeName,
                                      final String podId,
                                      final String dockerImage); List<MonitoringStats> getStats(final String nodeName);  }### Answer:
@Test public void testGetStatsForNodeWithIp() { configureMocksForGetStatsForNodeWithIp(); List<MonitoringStats> monitoringStatsList = cAdvisorMonitoringManager.getStatsForNode(NODE_WITH_INTERNALIP_ADRESS); assertNotNull(monitoringStatsList); assertThat(monitoringStatsList.size(), is(7)); assertThat(monitoringStatsList.get(0).getEndTime(), is(EXPECTED_END_DATE)); assertThat(monitoringStatsList.get(0).getContainerSpec().getMaxMemory(), is(EXPECTED_MAX_MEMORY)); assertThat(monitoringStatsList.get(0).getCpuUsage().getLoad(), is(EXPECTED_CPU_USAGE)); assertThat(monitoringStatsList.get(0).getMemoryUsage().getCapacity(), is(EXPECTED_MEMORY_CAPACITY)); assertThat(monitoringStatsList.get(1).getMemoryUsage().getUsage(), is(EXPECTED_MEMORY_USAGE)); assertThat(monitoringStatsList.get(1).getDisksUsage().getStatsByDevices().size(), is(2)); assertThat(monitoringStatsList.get(2).getNetworkUsage().getStatsByInterface().size(), is(3)); }
@Test public void testGetStatsForNodeWithoutIp() { NodeInstance nodeWithoutIP = getNodeInstance(NOT_INTERNALIP_ADDRESS, NOT_INTERNALIP_TYPE, NODE_WITHOUT_INTERNALIP_ADRESS); when(nodesManager.getNode(NODE_WITHOUT_INTERNALIP_ADRESS)).thenReturn(nodeWithoutIP); assertThat(cAdvisorMonitoringManager.getStatsForNode(NODE_WITHOUT_INTERNALIP_ADRESS), is(Collections.emptyList())); }