BAEL-2781 - metaprogramming in groovy - review fixes

This commit is contained in:
Anshul Bansal 2019-07-29 20:57:12 +03:00
parent 6eb4d10886
commit 6fe2a0fdcc
2 changed files with 9 additions and 2 deletions

View File

@ -38,4 +38,8 @@ class Employee {
"method '$methodName' is not defined"
}
def logEmp() {
log.info "Employee: $lastName, $firstName is of $age years age"
}
}

View File

@ -97,7 +97,7 @@ class MetaprogrammingUnitTest extends GroovyTestCase {
void testEqualsAndHashCodeAnnotation() {
Employee norman = new Employee(1, "norman", "lewis", 28)
Employee normanCopy = new Employee(1, "norman", "lewis", 28)
assert norman == normanCopy
assert norman.equals(normanCopy)
assert norman.hashCode() == normanCopy.hashCode()
}
@ -109,7 +109,10 @@ class MetaprogrammingUnitTest extends GroovyTestCase {
} catch(CloneNotSupportedException e) {
e.printStackTrace()
}
}
void testLoggingAnnotation() {
Employee employee = new Employee(1, "Norman", "Lewis", 28)
employee.logEmp()
}
}