Java Doc for Assertions.java in  » Database-Client » iSQL-Viewer » org » isqlviewer » 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 » Database Client » iSQL Viewer » org.isqlviewer.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.isqlviewer.util.Assertions

Assertions
final public class Assertions (Code)
General utilities class for common data validation patterns and assertions.

Some of these methods are variations on the themes in JUnit however the exceptions thrown herein are more appropriate for runtime situations like NullPointerException , and IllegalArgumentException . Where as most applications are not actively catching an AssertionFailedError which can fall through an Exception trap.

The NULL_XXX constants defined within this class also help facilitate the usage of Object versions of primitive data-types, where normally primitives cannot be null, and typically a -1 or NaN would represent a null primitive. These object instances assist with code-readability when dealing with those types of situations.
author:
   Mark A. Kobold
version:
   1.0



Field Summary
final public static  BooleanNULL_BOOLEAN
     User constant for defining an null primitive boolean value.
final public static  ByteNULL_BYTE
     User constant for defining an null primitive byte value.
final public static  CharacterNULL_CHARACTER
     User constant for defining an null primitive character value.
final public static  DateNULL_DATE
     User constant for defining an null date.
final public static  DoubleNULL_DOUBLE
     User constant for defining an null primitive double value.
final public static  FloatNULL_FLOAT
     User constant for defining an null primitive float value.
final public static  IntegerNULL_INTEGER
     User constant for defining an null primitive integer value.
final public static  LongNULL_LONG
     User constant for defining an null primitive long value.
final public static  ShortNULL_SHORT
     User constant for defining an null primitive short value.


Method Summary
public static  voidassertEqual(String identifier, double expected, double actualValue)
     Asserts that the expected value is equal to the actual value.
public static  voidassertEqual(double expected, double actualValue)
     Asserts that the expected value is equal to the actual value.
public static  voidassertGreaterThanEqual(String identifier, double value, double minimumValue)
     Checks to ensure that the given value is greater than or equal to minimum required value.
public static  voidassertGreaterThanEqual(double value, double minimumValue)
     Checks to ensure that the given value is greater than or equal to minimum required value.
public static  voidassertLessThanEqual(String identifier, double value, double maximumValue)
     Checks to ensure that the given value is less than or equal to given maximum value.
public static  voidassertLessThanEqual(double value, double maximumValue)
     Checks to ensure that the given value is less than or equal to given maximum value.
public static  voidassertNotNull(String identifier, Object value)
     Check to make sure that given value by name is not null.
public static  voidassertNotNull(Object value)
     Check to make sure that given value is not null.
public static  voidassertNull(String identifier, Object value)
     Check to make sure that given value by name is null.
public static  voidassertNull(Object value)
     Check to make sure that given value is null.
public static  voidassertPositive(Number value)
     Checks to ensure that the value is not less than zero.

Utility method for ensuring that the given value is positive otherwise throw an exception.

public static  voidassertPositive(String identifier, double value)
     Checks to ensure that the value is not less than zero.
public static  voidassertPositive(String identifier, Number value)
     Checks to ensure that a Number value is not less than zero.
public static  voidassertPositive(double value)
     Checks to ensure that the value is not less than zero.

Utility method for ensuring that the given value is positive otherwise throw an exception.

public static  voidassertPositiveExcludeZero(double value)
     Checks to ensure that the value is not less than or equal zero.
public static  voidassertPositiveExcludeZero(Number value)
     Checks to ensure that the value is not less than or equal zero.
public static  voidassertPositiveExcludeZero(String identifier, double value)
     Checks to ensure that the value is not less than or equal zero.
public static  voidassertPositiveExcludeZero(String identifier, Number value)
     Checks to ensure that the value is not less than or equal zero.

Field Detail
NULL_BOOLEAN
final public static Boolean NULL_BOOLEAN(Code)
User constant for defining an null primitive boolean value.

Assertions.NULL_BOOLEAN.booleanValue() == false




NULL_BYTE
final public static Byte NULL_BYTE(Code)
User constant for defining an null primitive byte value.

(Assertions.NULL_BYTE.byteValue() == -1) == true




NULL_CHARACTER
final public static Character NULL_CHARACTER(Code)
User constant for defining an null primitive character value.

(Assertions.NULL_CHARACTER.charValue() == 0) == true




NULL_DATE
final public static Date NULL_DATE(Code)
User constant for defining an null date.

(Assertions.NULL_DATE.getTime() == 0) == true

Though this isn't a primitive type, it is effectively a wrapper for a long value,plus it is common data-type.




NULL_DOUBLE
final public static Double NULL_DOUBLE(Code)
User constant for defining an null primitive double value.

Double.isNaN(Assertions.NULL_DOUBLE) == true




NULL_FLOAT
final public static Float NULL_FLOAT(Code)
User constant for defining an null primitive float value.

Float.isNaN(Assertions.NULL_FLOAT) == true




NULL_INTEGER
final public static Integer NULL_INTEGER(Code)
User constant for defining an null primitive integer value.

(Assertions.NULL_INTEGER.intValue() == -1) == true




NULL_LONG
final public static Long NULL_LONG(Code)
User constant for defining an null primitive long value.

(Assertions.NULL_LONG.longValue() == -1) == true




NULL_SHORT
final public static Short NULL_SHORT(Code)
User constant for defining an null primitive short value.

(Assertions.NULL_SHORT.shortValue() == -1) == true






Method Detail
assertEqual
public static void assertEqual(String identifier, double expected, double actualValue)(Code)
Asserts that the expected value is equal to the actual value.


Parameters:
  string - identifier for this assertion; can be null.
Parameters:
  expected - value of the actualValue variable.
Parameters:
  actualValue - to verify against the expected value.
throws:
  IllegalArgumentException - if the values are not equal.




assertEqual
public static void assertEqual(double expected, double actualValue)(Code)
Asserts that the expected value is equal to the actual value.


Parameters:
  expected - value of the actualValue variable.
Parameters:
  actualValue - to verify against the expected value.
throws:
  IllegalArgumentException - if the values are not equal.




assertGreaterThanEqual
public static void assertGreaterThanEqual(String identifier, double value, double minimumValue)(Code)
Checks to ensure that the given value is greater than or equal to minimum required value.


Parameters:
  identifier - a logical name that will accompany the exception if generated; can be null.
Parameters:
  value - to assert that is less or equal to the maximum value.
Parameters:
  minimumValue - the smallest value allowed.
throws:
  IllegalArgumentException - if the value is greater than the maximum value.




assertGreaterThanEqual
public static void assertGreaterThanEqual(double value, double minimumValue)(Code)
Checks to ensure that the given value is greater than or equal to minimum required value.


Parameters:
  value - to assert that is less or equal to the maximum value.
Parameters:
  minimumValue - the smallest value allowed.
throws:
  IllegalArgumentException - if the value is greater than the maximum value.




assertLessThanEqual
public static void assertLessThanEqual(String identifier, double value, double maximumValue)(Code)
Checks to ensure that the given value is less than or equal to given maximum value.


Parameters:
  identifier - a logical name that will accompany the exception if generated; can be null.
Parameters:
  value - to assert that is less or equal to the maximum value.
Parameters:
  maximumValue - that the given value is allowed to be.
throws:
  IllegalArgumentException - if the value is greater than the maximum value.




assertLessThanEqual
public static void assertLessThanEqual(double value, double maximumValue)(Code)
Checks to ensure that the given value is less than or equal to given maximum value.


Parameters:
  value - to assert that is less or equal to the maximum value.
Parameters:
  maximumValue - that the given value is allowed to be.
throws:
  IllegalArgumentException - if the value is greater than the maximum value.




assertNotNull
public static void assertNotNull(String identifier, Object value)(Code)
Check to make sure that given value by name is not null.


Parameters:
  identifier - a logical name that will accompany the exception if generated; can be null.
Parameters:
  value - to check for null.
throws:
  NullPointerException - if the given value is null.




assertNotNull
public static void assertNotNull(Object value)(Code)
Check to make sure that given value is not null.


Parameters:
  value - to check for null.
throws:
  NullPointerException - if the given value is null.




assertNull
public static void assertNull(String identifier, Object value)(Code)
Check to make sure that given value by name is null.


Parameters:
  identifier - a logical name that will accompany the exception if generated; can be null.
Parameters:
  value - to check for null.
throws:
  IllegalArgumentException - if the given value is not null.




assertNull
public static void assertNull(Object value)(Code)
Check to make sure that given value is null.


Parameters:
  value - to check for null.
throws:
  IllegalArgumentException - if the given value is not null.




assertPositive
public static void assertPositive(Number value)(Code)
Checks to ensure that the value is not less than zero.

Utility method for ensuring that the given value is positive otherwise throw an exception. This method version assumes no logical identifier with the given argument.
Parameters:
  value - to check for positiveness.
throws:
  IllegalArgumentException - if the given value is less than zero.
throws:
  NullPointerException - if the given value is null.




assertPositive
public static void assertPositive(String identifier, double value)(Code)
Checks to ensure that the value is not less than zero.

Utility method for ensuring that the given value is positive otherwise throw an exception.
Parameters:
  identifier - a logical name that will accompany the exception if generated; can be null.
Parameters:
  value - to check for positiveness.
throws:
  IllegalArgumentException - if the given value is less than zero.




assertPositive
public static void assertPositive(String identifier, Number value)(Code)
Checks to ensure that a Number value is not less than zero.

Utility method for ensuring that the given value is positive otherwise throw an exception.
Parameters:
  identifier - a logical name that will accompany the exception if generated; can be null.
Parameters:
  value - to check for positiveness.
throws:
  IllegalArgumentException - if the given value is less than zero.
throws:
  NullPointerException - if the given number value is null.




assertPositive
public static void assertPositive(double value)(Code)
Checks to ensure that the value is not less than zero.

Utility method for ensuring that the given value is positive otherwise throw an exception. This method version assumes no logical identifier with the given argument.
Parameters:
  value - to check for positiveness.
throws:
  IllegalArgumentException - if the given value is less than zero.




assertPositiveExcludeZero
public static void assertPositiveExcludeZero(double value)(Code)
Checks to ensure that the value is not less than or equal zero.

Utility method for ensuring that the given value is positive excluding zero, otherwise throw an exception.
Parameters:
  value - to check for positiveness.
throws:
  IllegalArgumentException - if the given value is less than or equal zero.




assertPositiveExcludeZero
public static void assertPositiveExcludeZero(Number value)(Code)
Checks to ensure that the value is not less than or equal zero.

Utility method for ensuring that the given value is positive excluding zero, otherwise throw an exception.
Parameters:
  value - to check for positiveness.
throws:
  IllegalArgumentException - if the given value is less than or equal zero.




assertPositiveExcludeZero
public static void assertPositiveExcludeZero(String identifier, double value)(Code)
Checks to ensure that the value is not less than or equal zero.

Utility method for ensuring that the given value is positive excluding zero, otherwise throw an exception.
Parameters:
  identifier - a logical name that will accompany the exception if generated; can be null.
Parameters:
  value - to check for positiveness.
throws:
  IllegalArgumentException - if the given value is less than or equal zero.




assertPositiveExcludeZero
public static void assertPositiveExcludeZero(String identifier, Number value)(Code)
Checks to ensure that the value is not less than or equal zero.

Utility method for ensuring that the given value is positive excluding zero, otherwise throw an exception.
Parameters:
  identifier - a logical name that will accompany the exception if generated; can be null.
Parameters:
  value - to check for positiveness.
throws:
  IllegalArgumentException - if the given value is less than or equal zero.
throws:
  NullPointerException - if the given number value is null.




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.