@@ -0,0 +1,1787 @@
+package se.christianjensen.maintenance.sigar;%0A%0Aimport org.hyperic.sigar.Sigar;%0Aimport org.hyperic.sigar.SigarException;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport se.christianjensen.maintenance.representation.processes.*;%0Aimport se.christianjensen.maintenance.representation.processes.Process;%0A%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.*;%0Aimport static org.mockito.Matchers.anyLong;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0A%0Apublic class ProcessMetricsTest %7B%0A%0A    private Sigar sigar;%0A    private ProcessMetrics processMetrics;%0A    private Process process1;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        sigar = mock(Sigar.class);%0A        processMetrics = new ProcessMetrics(sigar);%0A        process1 = new Process(123L, new String%5B0%5D, new ProcessExecutable(), new ProcessCreator(), new ProcessCpu(), new ProcessMemory());%0A%0A    %7D%0A%0A    @Test%0A    public void getProcessListHappyPath() throws Exception %7B%0A        setupProcessMock();%0A        List%3Cse.christianjensen.maintenance.representation.processes.Process%3E processes = processMetrics.getProcesses();%0A        assertThat(processes.get(0).getPid(), is(123L));%0A    %7D%0A%0A    private void setupProcessMock() throws SigarException %7B%0A        long%5B%5D pidArray = %7Bprocess1.getPid()%7D;%0A        when(sigar.getProcList()).thenReturn(pidArray);%0A        when(sigar.getProcArgs(anyLong())).thenReturn(new String%5B0%5D);%0A        when(sigar.getProcExe(anyLong())).thenThrow(new SigarException());%0A        when(sigar.getProcCredName(anyLong())).thenThrow(new SigarException());%0A        when(sigar.getProcCpu(anyLong())).thenThrow(new SigarException());%0A        when(sigar.getProcMem(anyLong())).thenThrow(new SigarException());%0A    %7D%0A%7D

Create simple test for ProcessMetrics