Created
January 29, 2015 16:58
-
-
Save jsanda/5a2332c00e0429b8a901 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestScriptBase { | |
@Override | |
Object run() { | |
return null | |
} | |
def execute() { | |
BigDecimal.metaClass.equals = { return true } | |
script() | |
} | |
} | |
class RESTTest { | |
void execute(Closure test) { | |
def configuration = new CompilerConfiguration() | |
configuration.scriptBaseClass = "org.rhq.metrics.rest.TestScriptBase" | |
def binding = new Binding() | |
binding.script = test | |
def shell = new GroovyShell(this.class.classLoader, binding, configuration) | |
shell.evaluate("execute()") | |
} | |
} | |
class MyTest { | |
@Test | |
void testBigDecimal() { | |
execute { | |
assertTrue(new BigDecimal(34.33).equals(new BigDecimal(1))) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment