### Question:
SystemInfoServiceImpl implements SystemInfoService { @Override public SystemInfoDto getSystemInfo() { HardwareAbstractionLayer hal = si.getHardware(); final OperatingSystem operatingSystem = si.getOperatingSystem(); return new SystemInfoDto(getOsInfo(operatingSystem), getProcessorInfo(hal), getMemoryInfo(hal), getDiskInfoList(File.listRoots())); }  @Override SystemInfoDto getSystemInfo();  }### Answer:
@Test public void getSystemInfo() { final OperatingSystem os = mock(OperatingSystem.class); final HardwareAbstractionLayer hardwareAbstractionLayer = mock(HardwareAbstractionLayer.class); final OperatingSystemVersion operatingSystemVersion = mock(OperatingSystemVersion.class); final CentralProcessor centralProcessor = mock(CentralProcessor.class); final GlobalMemory globalMemory = mock(GlobalMemory.class); final FileSystem fileSystem = mock(FileSystem.class); final OSFileStore osFileStore = new OSFileStore(); osFileStore.setUsableSpace(USABLE_SPACE); osFileStore.setTotalSpace(TOTAL_SPACE); when(fileSystem.getFileStores()).thenReturn(new OSFileStore[]{osFileStore}); when(operatingSystemVersion.getVersion()).thenReturn(OS_VERSION); when(operatingSystemVersion.getBuildNumber()).thenReturn(BUILD_NUMBER); when(hardwareAbstractionLayer.getDiskStores()).thenReturn(new HWDiskStore[]{}); when(os.getFamily()).thenReturn(OS_FAMILY); when(os.getVersion()).thenReturn(operatingSystemVersion); when(si.getOperatingSystem()).thenReturn(os); when(os.getFileSystem()).thenReturn(fileSystem); when(globalMemory.getAvailable()).thenReturn(AVAILABLE_MEMORY); when(hardwareAbstractionLayer.getMemory()).thenReturn(globalMemory); when(centralProcessor.getModel()).thenReturn(PROCESSOR_MODEL); when(hardwareAbstractionLayer.getProcessor()).thenReturn(centralProcessor); when(si.getHardware()).thenReturn(hardwareAbstractionLayer); SystemInfoDto systemInfo = systemInfoService.getSystemInfo(); assertEquals(BUILD_NUMBER, systemInfo.getOsInfo().getBuildNumber()); assertEquals(OS_VERSION, systemInfo.getOsInfo().getVersion()); assertEquals(OS_FAMILY, systemInfo.getOsInfo().getFamily()); assertEquals(PROCESSOR_MODEL, systemInfo.getProcessorInfo().getModel()); assertEquals(AVAILABLE_MEMORY, systemInfo.getMemoryInfo().getAvailableMemory()); assertEquals(1, systemInfo.getDisksInfo().size()); verify(si).getOperatingSystem(); verify(si).getHardware(); verifyNoMoreInteractions(si, fileSystem); }