From fc5bf90b3c5e157b40fe4656e189c7e52f626bf1 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Tue, 22 Jun 2004 02:27:51 +0000 Subject: [PATCH] test bogus queries too --- .../net/hyperic/sigar/test/TestInvoker.java | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/test/TestInvoker.java b/bindings/java/src/net/hyperic/sigar/test/TestInvoker.java index e9c3b4b6..a14a2b0c 100644 --- a/bindings/java/src/net/hyperic/sigar/test/TestInvoker.java +++ b/bindings/java/src/net/hyperic/sigar/test/TestInvoker.java @@ -1,6 +1,7 @@ package net.hyperic.sigar.test; import net.hyperic.sigar.Sigar; +import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarLoader; import net.hyperic.sigar.SigarProxy; import net.hyperic.sigar.SigarProxyCache; @@ -28,6 +29,14 @@ public class TestInvoker extends SigarTestCase { { "sigar:Type=CpuPercList,Arg=0", "Idle" }, }; + private static final String[][] BROKEN_QUERIES = { + { "sigar:Type=BREAK", "Free" }, + { "sigar:Type=Mem", "BREAK" }, + { "sigar:Type=ProcTime,Arg=BREAK", "Stime" }, + { "sigar:Type=CpuPercList,Arg=1000", "Idle" }, + { "sigar:Type=CpuPercList,Arg=BREAK", "Idle" }, + }; + public TestInvoker(String name) { super(name); } @@ -56,8 +65,26 @@ public class TestInvoker extends SigarTestCase { */ continue; } - Object o = invoker.invoke(query[1]); - traceln(query[0] + ":" + query[1] + "=" + o); + try { + Object o = invoker.invoke(query[1]); + traceln(query[0] + ":" + query[1] + "=" + o); + assertTrue(true); + } catch (SigarException e) { + assertTrue(false); + } + } + + for (int i=0; i