Added tests for WindowRegistry.getValueNames

This commit is contained in:
Michael Putters
2013-12-12 00:12:10 +01:00
parent 45dc2bc7be
commit 9c4efce3d4
2 changed files with 16 additions and 2 deletions

View File

@@ -47,4 +47,18 @@ class WindowsRegistryTest extends Specification {
def e = thrown(MissingRegistryEntryException)
e.message == /Could not list the subkeys of registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Unknown' as it does not exist./
}
def "can read value names"() {
expect:
windowsRegistry.getValueNames(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, /SOFTWARE\Microsoft\Windows NT\CurrentVersion/).flatten().contains("CurrentVersion")
}
def "cannot read value names of key that does not exist"() {
when:
windowsRegistry.getValueNames(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, /SOFTWARE\Unknown/)
then:
def e = thrown(MissingRegistryEntryException)
e.message == /Could not list the value names of registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Unknown' as it does not exist./
}
}