@Test
public void getPowerSources() {

    OshiPlatformCache oshi = newOshiPlatformCache();
    Map<String, PowerSource> powersources = oshi.getPowerSources();
    Assert.assertNotNull(powersources);
    if (powersources.size() == 0) {
        print("===NO POWER SOURCES ON THIS MACHINE===");
    } else {
        int i = 0;
        for (PowerSource powersource : powersources.values()) {
            String name = powersource.getName();
            double remainingCapacity = powersource.getRemainingCapacity();
            double timeRemaining = powersource.getTimeRemaining();
            Assert.assertNotNull(name);
            print("===POWER SOURCE #%d ===", ++i);
            print("  Name=[%s]", name);
            print("  RemainingCapacity=[%.0f%%] (%.2f)", remainingCapacity * 100, remainingCapacity);
            long roundedTimeRemaining = Math.round(timeRemaining);
            if (roundedTimeRemaining == -1) {
                print("  TimeRemaining=[calculating] (%.1f)", timeRemaining);
            } else if (roundedTimeRemaining == -2) {
                print("  TimeRemaining=[unlimited] (%.1f)", timeRemaining);
            } else {
                print("  TimeRemaining=[%s] (%.1f)", FormatUtil.formatElapsedSecs(roundedTimeRemaining),
                        timeRemaining);
            }
            print("  toString=[%s]", powersource.toString());
        }
    }
}