Skip to content

Instantly share code, notes, and snippets.

@andresteingress
Last active December 16, 2015 06:19
Show Gist options
  • Save andresteingress/5390138 to your computer and use it in GitHub Desktop.
Save andresteingress/5390138 to your computer and use it in GitHub Desktop.
Another reason to love Groovy.
@BeforeClass void setup() {
SwingUtilities.metaClass.static.invokeLater = { Runnable runnable ->
runnable.run()
}
Thread.metaClass.static.start = { Runnable runnable ->
runnable.run()
}
}
@AfterClass void tearDown() {
// rollback metaclass changes
GroovySystem.metaClassRegistry.removeMetaClass(Thread.class)
GroovySystem.metaClassRegistry.removeMetaClass(SwingUtilities.class)
}
@Test void buttonClickedTriggersFocus() {
// do UI testing stuff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment