test bogus service name

This commit is contained in:
Doug MacEachern 2005-06-26 22:00:35 +00:00
parent 3cc5715d31
commit 4fe5f84c59
1 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import net.hyperic.sigar.test.SigarTestCase;
import net.hyperic.sigar.win32.Service; import net.hyperic.sigar.win32.Service;
import net.hyperic.sigar.win32.ServiceConfig; import net.hyperic.sigar.win32.ServiceConfig;
import net.hyperic.sigar.win32.Win32Exception;
public class TestService extends SigarTestCase { public class TestService extends SigarTestCase {
private static final String TEST_NAME = "MyTestService"; private static final String TEST_NAME = "MyTestService";
@ -25,6 +26,15 @@ public class TestService extends SigarTestCase {
Service service = new Service("Eventlog"); Service service = new Service("Eventlog");
service.getConfig(); service.getConfig();
service.close(); service.close();
String dummyName = "DOESNOTEXIST";
try {
new Service(dummyName);
assertTrue(false);
} catch (Win32Exception e) {
traceln(dummyName + ": " + e.getMessage());
assertTrue(true);
}
} }
public void testServiceCreateDelete() throws Exception { public void testServiceCreateDelete() throws Exception {