test_class.declarator: sigar
test_class.modifier: private
test_class.original_string: private Sigar sigar;
test_class.type: Sigar
test_class.var_name: sigar
test_class.declarator: swap
test_class.modifier: private
test_class.original_string: private Swap swap;
test_class.type: Swap
test_class.var_name: swap
test_class.declarator: cpuPerc
test_class.modifier: private
test_class.original_string: private CpuPerc cpuPerc;
test_class.type: CpuPerc
test_class.var_name: cpuPerc
test_class.declarator: cpuInfo
test_class.modifier: private
test_class.original_string: private CpuInfo cpuInfo;
test_class.type: CpuInfo
test_class.var_name: cpuInfo
test_class.declarator: mem
test_class.modifier: private
test_class.original_string: private Mem mem;
test_class.type: Mem
test_class.var_name: mem
test_class.declarator: machineStatsChecker
test_class.modifier: private
test_class.original_string: private MachineStatsChecker machineStatsChecker;
test_class.type: MachineStatsChecker
test_class.var_name: machineStatsChecker
test_class.file: micro-machine-stats/src/test/java/com/oath/micro/server/machine/stats/sigar/MachineStatsCheckerTest.java
test_class.identifier: MachineStatsCheckerTest
test_case.body: @Test
  	public void testGetStats() throws SigarException {
  		
  		when(sigar.getSwap()).thenReturn(swap)
  		                     .thenReturn(swap)
  		                     .thenReturn(swap)
  		                     .thenReturn(swap)
  		                     .thenReturn(swap);
  		
  		when(sigar.getCpuPerc()).thenReturn(cpuPerc)
  								.thenReturn(cpuPerc)
  								.thenReturn(cpuPerc);
  		
  		CpuInfo[] cpuInfos = new CpuInfo[] { cpuInfo };
  		
  		when(sigar.getCpuInfoList()).thenReturn(cpuInfos)
  									.thenReturn(cpuInfos)
  									.thenReturn(cpuInfos);
  		
  		double[] doubleValue = new double[] { 0.0 };
  		when(sigar.getLoadAverage()).thenReturn(doubleValue);
  		
  		when(sigar.getMem()).thenReturn(mem)
  						    .thenReturn(mem)
  						    .thenReturn(mem)
  						    .thenReturn(mem)
  						    .thenReturn(mem);
  		
  		
  		machineStatsChecker.getStats(sigar);
  		
  		verify(sigar, times(5)).getSwap();
  		verify(swap, times(1)).getPageIn();
  		verify(swap, times(1)).getPageOut();
  		verify(swap, times(1)).getFree();
  		verify(swap, times(1)).getUsed();
  		verify(swap, times(1)).getTotal();
  		
  		verify(sigar, times(1)).getCpuPerc();
  		verify(cpuPerc, times(1)).getIdle();
  		
  		
  		verify(sigar, times(3)).getCpuInfoList();
  		verify(cpuInfo, times(1)).getTotalCores();
  		verify(cpuInfo, times(1)).getMhz();
  		verify(cpuInfo, times(1)).getModel();
  		
  		verify(sigar, times(1)).getLoadAverage();
  		
  		verify(sigar, times(5)).getMem();
  		verify(mem, times(1)).getActualFree();
  		verify(mem, times(1)).getActualUsed();
  		verify(mem, times(1)).getTotal();
  		verify(mem, times(1)).getUsedPercent();
  		verify(mem, times(1)).getFreePercent();
  		
  		verify(sigar, times(1)).close();
  		
  	}
test_case.class_method_signature: MachineStatsCheckerTest.testGetStats()
test_case.full_signature: @Test public void testGetStats()
test_case.identifier: testGetStats
test_case.invocations: thenReturn thenReturn thenReturn thenReturn thenReturn when getSwap thenReturn thenReturn thenReturn when getCpuPerc thenReturn thenReturn thenReturn when getCpuInfoList thenReturn when getLoadAverage thenReturn thenReturn thenReturn thenReturn thenReturn when getMem getStats getSwap verify times getPageIn verify times getPageOut verify times getFree verify times getUsed verify times getTotal verify times getCpuPerc verify times getIdle verify times getCpuInfoList verify times getTotalCores verify times getMhz verify times getModel verify times getLoadAverage verify times getMem verify times getActualFree verify times getActualUsed verify times getTotal verify times getUsedPercent verify times getFreePercent verify times close verify times
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetStats()
focal_class.declarator: logger = LoggerFactory.getLogger(this.getClass())
focal_class.modifier: private final
focal_class.original_string: private final Logger logger = LoggerFactory.getLogger(this.getClass());
focal_class.type: Logger
focal_class.var_name: logger
focal_class.file: micro-machine-stats/src/main/java/com/oath/micro/server/machine/stats/sigar/MachineStatsChecker.java
focal_class.identifier: MachineStatsChecker
focal_class.class_method_signature: MachineStatsChecker.getStats(Sigar sigar)
focal_class.full_signature: public MachineStats getStats(Sigar sigar)
focal_class.identifier: getStats
focal_class.modifiers: public
focal_class.parameters: (Sigar sigar)
focal_class.return: MachineStats
focal_class.signature: MachineStats getStats(Sigar sigar)
focal_class.class_method_signature: MachineStatsChecker.cpuStats(Sigar sigar)
focal_class.full_signature:  CpuStats cpuStats(Sigar sigar)
focal_class.identifier: cpuStats
focal_class.parameters: (Sigar sigar)
focal_class.return: CpuStats
focal_class.signature: CpuStats cpuStats(Sigar sigar)
focal_class.class_method_signature: MachineStatsChecker.getSwapStats(Sigar sigar)
focal_class.full_signature: private SwapStats getSwapStats(Sigar sigar)
focal_class.identifier: getSwapStats
focal_class.modifiers: private
focal_class.parameters: (Sigar sigar)
focal_class.return: SwapStats
focal_class.signature: SwapStats getSwapStats(Sigar sigar)
focal_class.class_method_signature: MachineStatsChecker.getCpuStats(Sigar sigar)
focal_class.full_signature: private CpuStats getCpuStats(Sigar sigar)
focal_class.identifier: getCpuStats
focal_class.modifiers: private
focal_class.parameters: (Sigar sigar)
focal_class.return: CpuStats
focal_class.signature: CpuStats getCpuStats(Sigar sigar)
focal_class.class_method_signature: MachineStatsChecker.getMemoryStats(Sigar sigar)
focal_class.full_signature: private MemoryStats getMemoryStats(Sigar sigar)
focal_class.identifier: getMemoryStats
focal_class.modifiers: private
focal_class.parameters: (Sigar sigar)
focal_class.return: MemoryStats
focal_class.signature: MemoryStats getMemoryStats(Sigar sigar)
focal_class.class_method_signature: MachineStatsChecker.getMachineStats(SwapStats swapStats, CpuStats cpuStats, MemoryStats memoryStats)
focal_class.full_signature: private MachineStats getMachineStats(SwapStats swapStats, CpuStats cpuStats, MemoryStats memoryStats)
focal_class.identifier: getMachineStats
focal_class.modifiers: private
focal_class.parameters: (SwapStats swapStats, CpuStats cpuStats, MemoryStats memoryStats)
focal_class.return: MachineStats
focal_class.signature: MachineStats getMachineStats(SwapStats swapStats, CpuStats cpuStats, MemoryStats memoryStats)
focal_method.body: public MachineStats getStats(Sigar sigar) {
          CpuStats cpuStats = CpuStats.builder()
                                      .build();
          SwapStats swapStats = SwapStats.builder()
                                         .build();
          MemoryStats memoryStats = MemoryStats.builder()
                                               .build();
          try {
              swapStats = getSwapStats(sigar);
              cpuStats = getCpuStats(sigar);
              getMemoryStats(sigar);
  
          } catch (SigarException | UnsatisfiedLinkError e) {
              logger.error("Error during sigar stats operation", e);
          } finally {
              sigar.close();
          }
  
          return getMachineStats(swapStats, cpuStats, memoryStats);
  
      }
focal_method.class_method_signature: MachineStatsChecker.getStats(Sigar sigar)
focal_method.full_signature: public MachineStats getStats(Sigar sigar)
focal_method.identifier: getStats
focal_method.invocations: build builder build builder build builder getSwapStats getCpuStats getMemoryStats error close getMachineStats
focal_method.modifiers: public
focal_method.parameters: (Sigar sigar)
focal_method.return: MachineStats
focal_method.signature: MachineStats getStats(Sigar sigar)