|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectpatterntesting.runtime.junit.ComparableTester
public final class ComparableTester
This utility class checks classes which implements the Comparable
interface. E.g. for two objects which are equals it is expected that the
Comparable.compareTo(Object) method returns 0.
| Method Summary | |
|---|---|
static void |
assertCompareTo(Class<? extends Comparable> clazz)
This method will create two objects of the given class using the default constructor and compares them. |
static void |
assertCompareTo(Collection<Class<Comparable>> classes)
Check for each class in the given collection if the compareTo method works as expected |
static void |
assertCompareTo(Comparable c1,
Comparable c2)
The Comparable.compareTo(Object) method should return 0 if the
given objects are eqals. |
static void |
assertCompareTo(Package pkg)
Check for each Comparable class in the given package if the
compareTo(..) method works as expected. |
static void |
assertCompareToOfPackage(String packageName)
Check for each Comparable class in the given package if the
compareTo(..) method works as expected. |
static void |
assertCompareToOfPackage(String packageName,
Class<? extends Comparable<?>>... excluded)
Check for each Comparable class in the given package if the
compareTo(..) method works as expected. |
static void |
assertCompareToOfPackage(String packageName,
List<Class<? extends Comparable<?>>> excluded)
Check for each Comparable class in the given package if the
compareTo(..) method works as expected. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void assertCompareTo(Comparable c1,
Comparable c2)
Comparable.compareTo(Object) method should return 0 if the
given objects are eqals. If they are not equals the shouldn't return 0.
This is checked here.
c1 - the first Comparablec2 - the second Comparable
AssertionError - if the check fails
public static void assertCompareTo(Class<? extends Comparable> clazz)
throws AssertionError
clazz - the clazz
AssertionError - if the check failspublic static void assertCompareTo(Collection<Class<Comparable>> classes)
classes - a collection of classes to be checkedpublic static void assertCompareTo(Package pkg)
Comparable class in the given package if the
compareTo(..) method works as expected.
Package.getPackage(String).
But be sure that you can't get null as result. In this case
use assertCompareToOfPackage(String).
pkg - the package e.g. "patterntesting.runtime"assertCompareToOfPackage(String)public static void assertCompareToOfPackage(String packageName)
Comparable class in the given package if the
compareTo(..) method works as expected.
packageName - the package name e.g. "patterntesting.runtime"
public static void assertCompareToOfPackage(String packageName,
Class<? extends Comparable<?>>... excluded)
Comparable class in the given package if the
compareTo(..) method works as expected.
packageName - the package name e.g. "patterntesting.runtime"excluded - classes which should be excluded from the checkassertCompareToOfPackage(String)
public static void assertCompareToOfPackage(String packageName,
List<Class<? extends Comparable<?>>> excluded)
Comparable class in the given package if the
compareTo(..) method works as expected.
packageName - the package name e.g. "patterntesting.runtime"excluded - classes which should be excluded from the checkassertCompareToOfPackage(String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||