Groovy Documentation

grails.test
[Groovy] Class TagLibUnitTestCase

java.lang.Object
  junit.framework.Assert
      junit.framework.TestCase
          groovy.util.GroovyTestCase
              grails.test.GrailsUnitTestCase
                  grails.test.MvcUnitTestCase
                      grails.test.TagLibUnitTestCase

class TagLibUnitTestCase
extends MvcUnitTestCase

Support class for writing unit tests for tag libraries. Its main job is to mock the various properties and methods that Grails injects into taglibs. By default it determines what tag library to mock based on the name of the test, but this can be overridden by one of the constructors.


Field Summary
protected java.lang.Object tagLib

 
Fields inherited from class MvcUnitTestCase
forwardArgs, mockFlash, mockParams, mockRequest, mockResponse, mockSession, redirectArgs, renderArgs, webRequest
 
Fields inherited from class groovy.util.GroovyTestCase
TEST_SCRIPT_NAME_PREFIX
 
Constructor Summary
TagLibUnitTestCase()

Creates a new test case for the tag library that is in the same package as the test case and has the same prefix in its name.

TagLibUnitTestCase(java.lang.Class tagLibClass)

Creates a new test case for the given tag lib class.

 
Method Summary
java.lang.Class getTagLibClass()

protected java.lang.Object newInstance()

protected void setUp()

 
Methods inherited from class MvcUnitTestCase
bindMockWebRequest, getTestClass, newInstance, reset, tearDown
 
Methods inherited from class GrailsUnitTestCase
addConverters, enableCascadingValidation, loadCodec, mockConfig, mockController, mockDomain, mockFor, mockForConstraintsTests, mockLogging, mockTagLib, registerMetaClass, setUp, tearDown
 
Methods inherited from class groovy.util.GroovyTestCase
groovy.util.GroovyTestCase#getName(), groovy.util.GroovyTestCase#getMethodName(), groovy.util.GroovyTestCase#assertEquals(java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#assertEquals(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#assertEquals(java.lang.String, java.lang.String), groovy.util.GroovyTestCase#notYetImplemented(), groovy.util.GroovyTestCase#notYetImplemented(junit.framework.TestCase), groovy.util.GroovyTestCase#run(), groovy.util.GroovyTestCase#run(junit.framework.TestResult), groovy.util.GroovyTestCase#toString(), groovy.util.GroovyTestCase#setName(java.lang.String), groovy.util.GroovyTestCase#countTestCases(), groovy.util.GroovyTestCase#runBare(), groovy.util.GroovyTestCase#format(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#fail(), groovy.util.GroovyTestCase#fail(java.lang.String), groovy.util.GroovyTestCase#assertNotNull(java.lang.String, java.lang.Object), groovy.util.GroovyTestCase#assertNotNull(java.lang.Object), groovy.util.GroovyTestCase#assertEquals(java.lang.String, double, double, double), groovy.util.GroovyTestCase#assertEquals(double, double, double), groovy.util.GroovyTestCase#assertEquals(java.lang.String, float, float, float), groovy.util.GroovyTestCase#assertEquals(float, float, float), groovy.util.GroovyTestCase#assertEquals(java.lang.String, long, long), groovy.util.GroovyTestCase#assertEquals(long, long), groovy.util.GroovyTestCase#assertEquals(java.lang.String, boolean, boolean), groovy.util.GroovyTestCase#assertEquals(boolean, boolean), groovy.util.GroovyTestCase#assertEquals(java.lang.String, byte, byte), groovy.util.GroovyTestCase#assertEquals(byte, byte), groovy.util.GroovyTestCase#assertEquals(java.lang.String, char, char), groovy.util.GroovyTestCase#assertEquals(char, char), groovy.util.GroovyTestCase#assertEquals(java.lang.String, short, short), groovy.util.GroovyTestCase#assertEquals(short, short), groovy.util.GroovyTestCase#assertEquals(int, int), groovy.util.GroovyTestCase#assertEquals(java.lang.String, int, int), groovy.util.GroovyTestCase#assertEquals(java.lang.String, java.lang.String, java.lang.String), groovy.util.GroovyTestCase#assertTrue(java.lang.String, boolean), groovy.util.GroovyTestCase#assertTrue(boolean), groovy.util.GroovyTestCase#failNotEquals(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#assertFalse(java.lang.String, boolean), groovy.util.GroovyTestCase#assertFalse(boolean), groovy.util.GroovyTestCase#assertNull(java.lang.String, java.lang.Object), groovy.util.GroovyTestCase#assertNull(java.lang.Object), groovy.util.GroovyTestCase#assertSame(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#assertSame(java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#assertNotSame(java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#assertNotSame(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#failSame(java.lang.String), groovy.util.GroovyTestCase#failNotSame(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#wait(), groovy.util.GroovyTestCase#wait(long), groovy.util.GroovyTestCase#wait(long, int), groovy.util.GroovyTestCase#equals(java.lang.Object), groovy.util.GroovyTestCase#hashCode(), groovy.util.GroovyTestCase#getClass(), groovy.util.GroovyTestCase#notify(), groovy.util.GroovyTestCase#notifyAll()
 

Field Detail

tagLib

protected java.lang.Object tagLib


 
Constructor Detail

TagLibUnitTestCase

TagLibUnitTestCase()
Creates a new test case for the tag library that is in the same package as the test case and has the same prefix in its name. For example, if the class name of the test were org.example.MyTagLibTests, this constructor would mock org.example.MyTagLib.


TagLibUnitTestCase

TagLibUnitTestCase(java.lang.Class tagLibClass)
Creates a new test case for the given tag lib class.


 
Method Detail

getTagLibClass

java.lang.Class getTagLibClass()


newInstance

protected java.lang.Object newInstance()


setUp

protected void setUp()


 

Groovy Documentation