use of org.grails.core.AbstractGrailsClass in project grails-core by grails.
the class GrailsClassTests method testAbstractGrailsClassNoPackage.
@Test
public void testAbstractGrailsClassNoPackage() throws Exception {
GroovyClassLoader cl = new GroovyClassLoader();
Class<?> clazz = cl.parseClass("class TestService { }");
GrailsClass grailsClass = new AbstractGrailsClass(clazz, "Service") {
};
assertEquals("TestService", clazz.getName());
assertEquals("Test", grailsClass.getName());
assertEquals("TestService", grailsClass.getFullName());
assertNotNull(grailsClass.newInstance());
}
use of org.grails.core.AbstractGrailsClass in project grails-core by grails.
the class GrailsClassTests method testAbstractGrailsClassPackage.
@Test
public void testAbstractGrailsClassPackage() throws Exception {
GroovyClassLoader cl = new GroovyClassLoader();
Class<?> clazz = cl.parseClass("package test.casey; class TestService { }");
GrailsClass grailsClass = new AbstractGrailsClass(clazz, "Service") {
};
assertEquals("test.casey.TestService", clazz.getName());
assertEquals("Test", grailsClass.getName());
assertEquals("test.casey.TestService", grailsClass.getFullName());
assertNotNull(grailsClass.newInstance());
}
use of org.grails.core.AbstractGrailsClass in project grails-core by grails.
the class GrailsClassTests method testGrailsClassNonPublicConstructor.
@Test
public void testGrailsClassNonPublicConstructor() throws Exception {
GroovyClassLoader cl = new GroovyClassLoader();
Class<?> clazz = cl.parseClass("class ProtectedConstructor { protected ProtectedConstructor() {}}");
GrailsClass grailsClass = new AbstractGrailsClass(clazz, "ProtectedConstructor") {
};
assertNotNull(grailsClass.newInstance());
}
Aggregations