Java Doc for Assert.java in  » Net » Terracotta » com » tc » 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 » Net » Terracotta » com.tc.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.tc.util.Assert

Assert
public class Assert (Code)
A general purpose assertion utility. By default it is on, but you can disable the throwing of exceptions by giving the system property "tcassert" a value of 'false'.




Method Summary
public static  voidassertConsistentCollection(Collection collection, Class elementClass, boolean allowNullElements)
     Assert that all items in collection are of type elementClass, also if !allowNullElements, check that all items in the collection are non-null.
public static  voidassertContainsElement(Object[] objectArray, Object requiredElement)
     Tests for equality using the == operator, not Object.equals(Object).
public static  voidassertEquals(int expected, int actual)
    
public static  voidassertEquals(Object msg, int expected, int actual)
    
public static  voidassertEquals(double expected, double actual)
    
public static  voidassertEquals(double expected, double actual, double epsilon)
    
public static  voidassertEquals(boolean expected, boolean actual)
    
public static  voidassertEquals(byte[] expected, byte[] actual)
    
public static  voidassertEquals(Object expected, Object actual)
    
public static  voidassertEquals(Object msg, Object expected, Object actual)
    
public static  voidassertFalse(boolean expr)
    
public static  voidassertFalse(Object message, boolean expr)
    
public static  voidassertNoBlankElements(String[] array)
    
public static  voidassertNoNullElements(Object[] array)
    
public static  voidassertNotBlank(Object what, String s)
    
public static  voidassertNotBlank(String s)
    
public static  voidassertNotEmpty(Object what, String s)
    
public static  voidassertNotEmpty(String s)
    
public static  voidassertNotNull(Object what, Object o)
    
public static  voidassertNotNull(Object o)
    
public static  voidassertNull(Object o)
    
public static  voidassertNull(Object what, Object o)
    
public static  voidassertSame(Object lhs, Object rhs)
    
public static  voidassertTrue(boolean expr)
    
public static  voidassertTrue(Object message, boolean expr)
    
public static  voideval(boolean expr)
    
public static  voideval(Object message, boolean expr)
    
public static  voidfail()
    
public static  voidfail(String message)
    
public static  TCAssertionErrorfailure(Object message, Throwable t)
     This returns an exception, instead of throwing one, so that you can do (e.g.): public Object foo() { throw Assert.failure("doesn't work"); } or whatever.
public static  TCAssertionErrorfailure(Object message)
     This returns an exception, instead of throwing one, so that you can do (e.g.): public Object foo() { throw Assert.failure("doesn't work"); } or whatever.
public static  voidinv(boolean v)
    
public static  voidpost(boolean v)
    
public static  voidpre(boolean v)
    



Method Detail
assertConsistentCollection
public static void assertConsistentCollection(Collection collection, Class elementClass, boolean allowNullElements)(Code)
Assert that all items in collection are of type elementClass, also if !allowNullElements, check that all items in the collection are non-null.
Parameters:
  collection - The collection
Parameters:
  elementClass - The expected super type of all items in collection
Parameters:
  allowNullElements - Flag for whether null elements are allowed or not



assertContainsElement
public static void assertContainsElement(Object[] objectArray, Object requiredElement)(Code)
Tests for equality using the == operator, not Object.equals(Object). null is a valid element.
Parameters:
  objectArray - Array of objects
Parameters:
  requiredElement - Must be in objectArray



assertEquals
public static void assertEquals(int expected, int actual)(Code)
Assert expected and actual values are equal
Parameters:
  expected - Expected value
Parameters:
  actual - Actual value



assertEquals
public static void assertEquals(Object msg, int expected, int actual)(Code)
Assert expected and actual values are equal and return what as a message
Parameters:
  expected - Expected value
Parameters:
  actual - Actual value
Parameters:
  msg - Message, should be non-null



assertEquals
public static void assertEquals(double expected, double actual)(Code)
Assert expected and actual values are equal
Parameters:
  expected - Expected value
Parameters:
  actual - Actual value



assertEquals
public static void assertEquals(double expected, double actual, double epsilon)(Code)
Assert expected and actual values are equal within epsilon
Parameters:
  expected - Expected value
Parameters:
  actual - Actual value
Parameters:
  epsilon - Maximum allowed difference between expected and actual



assertEquals
public static void assertEquals(boolean expected, boolean actual)(Code)
Assert expected and actual values are equal
Parameters:
  expected - Expected value
Parameters:
  actual - Actual value



assertEquals
public static void assertEquals(byte[] expected, byte[] actual)(Code)
Assert expected and actual values are equal or both null
Parameters:
  expected - Expected value
Parameters:
  actual - Actual value



assertEquals
public static void assertEquals(Object expected, Object actual)(Code)
Assert expected and actual values are equal or both null
Parameters:
  expected - Expected value
Parameters:
  actual - Actual value



assertEquals
public static void assertEquals(Object msg, Object expected, Object actual)(Code)



assertFalse
public static void assertFalse(boolean expr)(Code)
Evaluate the boolean exception and throw an assertion error if true
Parameters:
  expr - Expression
Parameters:
  message - Message for assertion error if true



assertFalse
public static void assertFalse(Object message, boolean expr)(Code)
Evaluate the boolean exception and throw an assertion error if true
Parameters:
  expr - Expression
Parameters:
  message - Message for assertion error if true



assertNoBlankElements
public static void assertNoBlankElements(String[] array)(Code)
Validate that the given array of strings contains no nulls or empty strings
Parameters:
  array - Array of strings



assertNoNullElements
public static void assertNoNullElements(Object[] array)(Code)
Validate that the given (1 dimensional) array of references contains no nulls
Parameters:
  array - Array



assertNotBlank
public static void assertNotBlank(Object what, String s)(Code)
Validate that s is not blank and throw what as a message
Parameters:
  s - String
Parameters:
  what - Message



assertNotBlank
public static void assertNotBlank(String s)(Code)
Validate that s is not blank
Parameters:
  s - String



assertNotEmpty
public static void assertNotEmpty(Object what, String s)(Code)
Validate that s is not null or empty and throw what as a message
Parameters:
  s - String
Parameters:
  what - Message



assertNotEmpty
public static void assertNotEmpty(String s)(Code)
Validate that s is not null or empty
Parameters:
  s - String



assertNotNull
public static void assertNotNull(Object what, Object o)(Code)
If o is null, throw assertion error with message what
Parameters:
  o - Object
Parameters:
  what - Message for error



assertNotNull
public static void assertNotNull(Object o)(Code)
If o is null, throw assertion error
Parameters:
  o - Object



assertNull
public static void assertNull(Object o)(Code)
If o is non-null, throw assertion error
Parameters:
  o - Object



assertNull
public static void assertNull(Object what, Object o)(Code)
If o is non-null, throw assertion error
Parameters:
  o - Object
Parameters:
  what - Message for error



assertSame
public static void assertSame(Object lhs, Object rhs)(Code)
Validate that lhs and rhs are identical object references or both are null
Parameters:
  lhs - Left hand side
Parameters:
  rhs - Right hand side



assertTrue
public static void assertTrue(boolean expr)(Code)
Evaluate the boolean exception and throw an assertion error if false
Parameters:
  expr - Expression



assertTrue
public static void assertTrue(Object message, boolean expr)(Code)
Evaluate the boolean exception and throw an assertion error if false
Parameters:
  expr - Expression
Parameters:
  message - Message for assertion error if false



eval
public static void eval(boolean expr)(Code)
Evaluate the boolean exception and throw an assertion error if false
Parameters:
  expr - Expression



eval
public static void eval(Object message, boolean expr)(Code)
Evaluate the boolean exception and throw an assertion error if false
Parameters:
  expr - Expression
Parameters:
  message - Message for assertion error if false



fail
public static void fail()(Code)
Throw assertion error with generic message



fail
public static void fail(String message)(Code)
Throw assertion error with specified message
Parameters:
  message - Message



failure
public static TCAssertionError failure(Object message, Throwable t)(Code)
This returns an exception, instead of throwing one, so that you can do (e.g.): public Object foo() { throw Assert.failure("doesn't work"); } or whatever. If this just threw the exception itself, the compiler would complain (above) that there's no value being returned.
Parameters:
  message - The message to put in the assertion error
Parameters:
  t - The exception to wrap New TCAssertionError, ready to throw



failure
public static TCAssertionError failure(Object message)(Code)
This returns an exception, instead of throwing one, so that you can do (e.g.): public Object foo() { throw Assert.failure("doesn't work"); } or whatever. If this just threw the exception itself, the compiler would complain (above) that there's no value being returned.
Parameters:
  message - The message to put in the assertion error New TCAssertionError, ready to throw



inv
public static void inv(boolean v)(Code)
Assert invariant
Parameters:
  v - Invariant



post
public static void post(boolean v)(Code)
Assert postcondition
Parameters:
  v - Postcondition



pre
public static void pre(boolean v)(Code)
Assert precondition
Parameters:
  v - Precondition



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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