|
|||||||||
PREV NEXT | FRAMES NO FRAMES |
Request
that, when processed, will run all the tests
in a class.
Description
as a child of the receiver.
Before
method you need to release them
after the test runs.BeforeClass
method you need to release them
after all the tests in the class have run.Filter
that passes all tests through.
suite()
method).type
,
as determined by calling the Class.isInstance(Object)
method on that type, passing the
the examined object.
type
,
as determined by calling the Class.isInstance(Object)
method on that type, passing the
the examined object.
String
.
String
.
SelfDescribing
value to this description.
SelfDescribing
objects
to the description.
Statement
to implement an additional
test-running rule.
Statement
to implement this
test-running rule.
Statement
to implement this
test-running rule.
Runner
to cause all tests it intends to run
to first be checked with the filter.
runner
using comparator
RuleChain
, which encloses the nextRule
with
the rules of the current RuleChain
.
assertEquals(double expected, double actual, double delta)
instead
assertEquals(String message, double expected, double actual, double delta)
instead
actual
satisfies the condition specified by
matcher
.
actual
satisfies the condition specified by
matcher
.
StringDescription.toString(SelfDescribing)
.
Assume.assumeTrue(boolean)
.
Assume.assumeTrue(String, boolean)
.
t
is
not null
.
objects
, the test will halt and be ignored.
actual
satisfies the condition specified by matcher
.
actual
satisfies the condition specified by matcher
.
false
, the test will halt and be ignored.
false
, the test will halt and be ignored.
Description
that is stored as a string.klass
CoreMatchers.both(Matcher)
instead.
callable
.
matcher
does not match value
.
reason
to the table if matcher
does not match value
.
Statement
: Call ParentRunner.runChild(Object, RunNotifier)
on each object returned by ParentRunner.getChildren()
(subject to any imposed
filter and sort)
Statement
to run all of the tests in the test class.
Request
that, when processed, will run all the tests
in a set of classes.
Request
that, when processed, will run all the tests
in a set of classes with the default Computer
.
Request
that, when processed, will run all the tests
in a class.
errors
a throwable for each problem noted with the test class (available from ParentRunner.getTestClass()
).
assertEquals(String, String)
fails.String
contains the specified
String
anywhere.
String
contains the specified
String
anywhere.
CoreMatchers.containsString(String)
instead.
Description
named name
.
Description
named name
.
Description
named after testClass
Description
of a single test named name
in the 'class' named
className
.
Description
of a single test named name
in the class clazz
.
Description
of a single test named name
in the class clazz
.
Description
of a single test named name
in the class clazz
.
Description
for child
, which can be assumed to
be an element of the list returned by ParentRunner.getChildren()
Description
describes a test which is to be run or has been run.CoreMatchers.either(Matcher)
instead.
RuleChain
without a TestRule
.
String
ends with the specified
String
.
String
ends with the specified
String
.
operand
, as determined by calling the Object.equals(java.lang.Object)
method on
the examined object.
operand
, as determined by calling the Object.equals(java.lang.Object)
method on
the examined object.
Throwable
if anything goes wrong.
Iterable
s that only matches when a single pass over the
examined Iterable
yields items that are all matched by the specified
itemMatcher
.
Iterable
s that only matches when a single pass over the
examined Iterable
yields items that are all matched by the specified
itemMatcher
.
CoreMatchers.everyItem(Matcher)
instead.
matcher
to the list of requirements for any thrown
exception.
type
matcher
to the list of requirements for the cause of
any thrown exception.
substring
matcher
to the list of requirements for the message returned
from any thrown exception.
Failure
holds a description of the failed test and the
exception that was thrown while running it.Failure
with the given description and exception.
count
failures
filter
.
filter
is applied
Description
equals desiredDescription
MaxHistory
from file
, or generates a new one that
will be saved to file
.
BlockJUnit4ClassRunner
, but custom runners can make other uses)FrameworkField
and FrameworkMethod
FrameworkMethod
for method
target
annotationClass
.
annotationClass
.
annotationType
on this method, if
one exists.
AssertionError
if there are more or less than one.
testClass
, using builder
Runner
for this Request
classes
, building Runners with builder
.
TestClass
object wrapping the class to be executed.
string
Iterable
s that only matches when a single pass over the
examined Iterable
yields at least one item that is matched by the specified
itemMatcher
.
Iterable
s that only matches when a single pass over the
examined Iterable
yields at least one item that is equal to the specified
item
.
Iterable
s that only matches when a single pass over the
examined Iterable
yields at least one item that is equal to the specified
item
.
Iterable
s that only matches when a single pass over the
examined Iterable
yields at least one item that is matched by the specified
itemMatcher
.
CoreMatchers.hasItem(Object)
instead.
CoreMatchers.hasItem(Matcher)
instead.
Iterable
s that matches when consecutive passes over the
examined Iterable
yield at least one item that is matched by the corresponding
matcher from the specified itemMatchers
.
Iterable
s that matches when consecutive passes over the
examined Iterable
yield at least one item that is equal to the corresponding
item from the specified items
.
Iterable
s that matches when consecutive passes over the
examined Iterable
yield at least one item that is equal to the corresponding
item from the specified items
.
Iterable
s that matches when consecutive passes over the
examined Iterable
yield at least one item that is matched by the corresponding
matcher from the specified itemMatchers
.
CoreMatchers.hasItems(Object...)
instead.
CoreMatchers.hasItems(Matcher...)
instead.
string
InitializationError
with one or more
errors errors
as causes
InitializationError
with one cause
with message string
type
,
as determined by calling the Class.isInstance(Object)
method on that type, passing the
the examined object.
type
,
as determined by calling the Class.isInstance(Object)
method on that type, passing the
the examined object.
second
target
with
parameters params
.
is(equalTo(x))
.
is(equalTo(x))
.
is(instanceOf(SomeClass.class))
.
is(instanceOf(SomeClass.class))
.
true
.Object.equals(java.lang.Object)
invokedMethod?JUnitCore
is a facade for running tests.args
.
Filter
that only runs the single method described by
desiredDescription
Request
that, when processed, will run a single test.
method
passes, or throws an exception if method
fails.
Statement
that invokes method
on test
Throwable
s into one exception.not(equalTo(x))
.
not(equalTo(x))
.
not(nullValue())
.
not(nullValue(X.class)).
- notNullValue() -
Static method in class org.hamcrest.CoreMatchers
- A shortcut to the frequently used
not(nullValue())
.
- notNullValue(Class<T>) -
Static method in class org.hamcrest.CoreMatchers
- A shortcut to the frequently used
not(nullValue(X.class)).
- NULL -
Static variable in class org.junit.runner.manipulation.Sorter
- NULL is a
Sorter
that leaves elements in an undefined order
- nullValue() -
Static method in class org.hamcrest.core.IsNull
- Creates a matcher that matches if examined object is
null
.
- nullValue(Class<T>) -
Static method in class org.hamcrest.core.IsNull
- Creates a matcher that matches if examined object is
null
.
- nullValue() -
Static method in class org.hamcrest.CoreMatchers
- Creates a matcher that matches if examined object is
null
.
- nullValue(Class<T>) -
Static method in class org.hamcrest.CoreMatchers
- Creates a matcher that matches if examined object is
null
.
Matcher
s for use with
the Assert.assertThat(Object, org.hamcrest.Matcher)
statementfilter
or sort
tests.Runner
implementations.RuleChain
with a single TestRule
.
Parameterized
implements parameterized tests.Parameters
Parameterized
T
.ParentRunner
that will run @TestClass
failures
Request
is an abstract description of tests to be run.Result
collects and summarizes information from running multiple tests.class
.
request
.
request
.
classes
.
classes
.
request
.
test
.
child
, which can be assumed to be
an element of the list returned by ParentRunner.getChildren()
.
classes
.
classes
.
Statement
that represents a leaf (aka atomic) test.
RunListener
and override the appropriate methods.Runner
runs tests and notifies a RunNotifier
of significant events as it does so.children
.
@RunWith
or extends a class annotated
with @RunWith
, JUnit will invoke the class it references to run the
tests in that class instead of the runner built into JUnit.sorter
Sorter
orders tests.Sorter
that uses comparator
to sort tests
comparator
For example, here is code to run a test suite in alphabetical order:
String
starts with the specified
String
.
String
starts with the specified
String
.
Description
that is stored as a string.Suite
as a runner allows you to manually
build a suite containing tests from many classes.@RunWith(Suite.class)
JUnitCore
SuiteClasses
annotation specifies the classes to be run when a class
annotated with @RunWith(Suite.class)
is run.Test
annotation tells JUnit that the public void
method
to which it is attached can be run as a test case.TestClass
wrapping klass
.
Ignore
.
method
for Description
s.
type
request
TestWatcher
(which implements TestRule
) instead.SelfDescribing
object as a String.
matchesSafely
is not the class that binds <T> to a type.
matchesSafely
is not the class that binds <T> to a type.
matchesSafely
is not the class that binds <T> to a type.
matchesSafely
is not the class that binds <T> to a type.
errors
if the test class has more than one constructor,
or if the constructor takes parameters.
errors
if the test class has more than one constructor
(do not override)
errors
if this method:
is not public, or
returns something other than void, or
is static (given isStatic is false
), or
is not static (given isStatic is true
).
errors
if this method:
is not public, or
takes parameters, or
returns something other than void, or
is static (given isStatic is false
), or
is not static (given isStatic is true
).
errors
if any method in this class is annotated with
annotation
, but:
is not public, or
takes parameters, or
returns something other than void, or
is static (given isStatic is false
), or
is not static (given isStatic is true
).
errors
for each method annotated with @Test
that
is not a public, void instance method with no arguments.
errors
if the test class's single constructor takes
parameters (do not override)
Statement
: run all non-overridden @AfterClass
methods on this class
and superclasses before executing statement
; all AfterClass methods are
always executed: exceptions thrown by previous steps are combined, if
necessary, with exceptions from AfterClass methods into a
MultipleFailureException
.
Statement
: run all non-overridden @BeforeClass
methods on this class
and superclasses before executing statement
; if any throws an
Exception, stop execution and pass the exception on.
|
|||||||||
PREV NEXT | FRAMES NO FRAMES |