Java Doc for GroovyTestCase.java in  » Scripting » groovy-1.0 » groovy » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » groovy 1.0 » groovy.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


groovy.util.GroovyTestCase

All known Subclasses:   org.codehaus.groovy.ant.GroovyTest,  org.codehaus.groovy.antlr.treewalker.Java2GroovyTest,  org.codehaus.groovy.classgen.BytecodeHelperTest,  org.codehaus.groovy.classgen.CapitalizeTest,  org.codehaus.groovy.tools.CompilerTest,  org.codehaus.groovy.classgen.ReflectorGeneratorTest,  org.codehaus.groovy.runtime.PropertyTest,  org.codehaus.groovy.runtime.InvokerTest,  org.codehaus.groovy.runtime.InvokeMethodTest,  org.codehaus.groovy.antlr.SourceBufferTest,  org.codehaus.groovy.runtime.DefaultGroovyMethodsTest,  org.codehaus.groovy.tools.FileSystemCompilerTest,  org.codehaus.groovy.syntax.TokenTest,  org.codehaus.groovy.runtime.InvokeGroovyMethodTest,  org.codehaus.groovy.syntax.parser.TestParserSupport,  org.codehaus.groovy.runtime.InvokeConstructorTest,  org.codehaus.groovy.runtime.TupleListTest,  org.codehaus.groovy.antlr.treewalker.SourcePrinterTest,  org.codehaus.groovy.classgen.DummyTestDerivation,  org.codehaus.groovy.antlr.GroovySourceASTTest,  org.codehaus.groovy.runtime.MethodFailureTest,  org.codehaus.groovy.classgen.TestSupport,
GroovyTestCase
public class GroovyTestCase extends TestCase (Code)
A default JUnit TestCase in Groovy. This provides a number of helper methods plus avoids the JUnit restriction of requiring all test* methods to be void return type.
author:
   bob mcwhirter
author:
   James Strachan
author:
   Dierk Koenig (the notYetImplemented feature, changes to shouldFail)
version:
   $Revision: 4201 $


Field Summary
protected static  Loggerlog
    

Constructor Summary
public  GroovyTestCase()
    

Method Summary
protected  voidassertArrayEquals(Object[] expected, Object[] value)
    
protected  voidassertContains(char expected, char[] array)
    
protected  voidassertContains(int expected, int[] array)
    
protected  voidassertInspect(Object value, String expected)
    
protected  voidassertLength(int length, char[] array)
    
protected  voidassertLength(int length, int[] array)
    
protected  voidassertLength(int length, Object[] array)
    
protected  voidassertScript(String script)
    
protected  voidassertToString(Object value, String expected)
    
protected  StringfixEOLs(String value)
     Returns a copy of a string in which all EOLs are \n.
public  StringgetMethodName()
    
public  StringgetName()
    
protected  StringgetTestClassName()
    
public static  booleannotYetImplemented(TestCase caller)
     Runs the calling JUnit test again and fails only if it unexpectedly runs.
This is helpful for tests that don't currently work but should work one day, when the tested functionality has been implemented.
The right way to use it is:
 public void testXXX() {
 if (GroovyTestCase.notYetImplemented(this)) return;
 ...
public  booleannotYetImplemented()
     Convenience method for subclasses of GroovyTestCase, identical to
 GroovyTestCase.notYetImplemented(this); 
.
protected  StringshouldFail(Closure code)
    
protected  StringshouldFail(Class clazz, Closure code)
     Asserts that the given code closure fails when it is evaluated and that a particular exception is thrown.

Field Detail
log
protected static Logger log(Code)




Constructor Detail
GroovyTestCase
public GroovyTestCase()(Code)




Method Detail
assertArrayEquals
protected void assertArrayEquals(Object[] expected, Object[] value)(Code)
Asserts that the arrays are equivalent and contain the same values
Parameters:
  expected -
Parameters:
  value -



assertContains
protected void assertContains(char expected, char[] array)(Code)
Asserts that the array of characters contains a given char
Parameters:
  expected - expected character to be found
Parameters:
  array - the array



assertContains
protected void assertContains(int expected, int[] array)(Code)
Asserts that the array of ints contains a given int
Parameters:
  expected - expected int
Parameters:
  array - the array



assertInspect
protected void assertInspect(Object value, String expected)(Code)
Asserts that the value of inspect() on the given object matches the given text string
Parameters:
  value - the object to be output to the console
Parameters:
  expected - the expected String representation



assertLength
protected void assertLength(int length, char[] array)(Code)
Asserts that the array of characters has a given length
Parameters:
  length - expected length
Parameters:
  array - the array



assertLength
protected void assertLength(int length, int[] array)(Code)
Asserts that the array of ints has a given length
Parameters:
  length - expected length
Parameters:
  array - the array



assertLength
protected void assertLength(int length, Object[] array)(Code)
Asserts that the array of objects has a given length
Parameters:
  length - expected length
Parameters:
  array - the array



assertScript
protected void assertScript(String script) throws Exception(Code)
Asserts that the script runs without any exceptions
Parameters:
  script - the script that should pass without any exception thrown



assertToString
protected void assertToString(Object value, String expected)(Code)
Asserts that the value of toString() on the given object matches the given text string
Parameters:
  value - the object to be output to the console
Parameters:
  expected - the expected String representation



fixEOLs
protected String fixEOLs(String value)(Code)
Returns a copy of a string in which all EOLs are \n.



getMethodName
public String getMethodName()(Code)



getName
public String getName()(Code)
Overload the getName() method to make the test cases look more like AgileDox (thanks to Joe Walnes for this tip!)



getTestClassName
protected String getTestClassName()(Code)



notYetImplemented
public static boolean notYetImplemented(TestCase caller)(Code)
Runs the calling JUnit test again and fails only if it unexpectedly runs.
This is helpful for tests that don't currently work but should work one day, when the tested functionality has been implemented.
The right way to use it is:
 public void testXXX() {
 if (GroovyTestCase.notYetImplemented(this)) return;
 ... the real (now failing) unit test
 }
 
Idea copied from HtmlUnit (many thanks to Marc Guillemot). Future versions maybe available in the JUnit distro. The purpose of providing a 'static' version is such that you can use the feature even if not subclassing GroovyTestCase. when not itself already in the call stack



notYetImplemented
public boolean notYetImplemented()(Code)
Convenience method for subclasses of GroovyTestCase, identical to
 GroovyTestCase.notYetImplemented(this); 
.
See Also:   GroovyTestCase.notYetImplemented(junit.framework.TestCase) when not itself already in the call stack



shouldFail
protected String shouldFail(Closure code)(Code)
Asserts that the given code closure fails when it is evaluated
Parameters:
  code - the message of the thrown Throwable



shouldFail
protected String shouldFail(Class clazz, Closure code)(Code)
Asserts that the given code closure fails when it is evaluated and that a particular exception is thrown.
Parameters:
  clazz - the class of the expected exception
Parameters:
  code - the closure that should fail the message of the expected Throwable



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.