add NetStat test

This commit is contained in:
Doug MacEachern 2005-05-10 20:32:52 +00:00
parent 3e48aa1c0b
commit 916a46bce3
2 changed files with 28 additions and 0 deletions

View File

@ -33,6 +33,7 @@ public class SigarTestRunner extends SigarCommandBase {
TestLoadAverage.class,
TestMem.class,
TestNetIf.class,
TestNetStat.class,
TestProcArgs.class,
TestProcEnv.class,
TestProcExe.class,

View File

@ -0,0 +1,27 @@
package net.hyperic.sigar.test;
import net.hyperic.sigar.NetStat;
import net.hyperic.sigar.Sigar;
import net.hyperic.sigar.SigarNotImplementedException;
public class TestNetStat extends SigarTestCase {
public TestNetStat(String name) {
super(name);
}
public void testCreate() throws Exception {
Sigar sigar = getSigar();
NetStat netstat;
try {
netstat = sigar.getNetStat();
} catch (SigarNotImplementedException e) {
return;
}
assertGtEqZeroTrace("Outbound", netstat.getTcpOutboundTotal());
assertGtEqZeroTrace("Inbound", netstat.getTcpInboundTotal());
assertGtEqZeroTrace("Listen", netstat.getTcpListen());
}
}