void () { if (SystemInfo.isLinux) { String powerSupplySysNode = "/sys/class/power_supply"; File[] sysFsPowerSupplyFiles = notNull(new File(powerSupplySysNode).listFiles(), ArrayUtilRt.EMPTY_FILE_ARRAY); assumeTrue("Linux: can't query power source if '" + powerSupplySysNode + "' is empty or not exist", sysFsPowerSupplyFiles.length > 0); } PowerStatus status = PowerStatus.getPowerStatus(); if (UsefulTestCase.IS_UNDER_TEAMCITY) { //UPS could be treated as battery (see MacPowerService comments: for Mac API UPS is 'battery'). // But I doubt this is actual for our agents, and running from UPS is not a normal thing anyway. assertEquals( "TeamCity agents are definitely powered from AC line, not battery", PowerStatus.AC, status ); } else { assertNotEquals( "UNKNOWN status usually means some error in API call", PowerStatus.UNKNOWN, status ); } }