|
||||||||||
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).AnnotationsValidator
validates all annotations of a test class,
including its annotated fields and methods.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.
target
.
target
using this ordering.
target
using comparator
.
RuleChain
, which encloses the given TestRule
with
the rules of the current RuleChain
.
Assert
instead.assertEquals(double expected, double actual, double delta)
instead
assertEquals(String message, double expected, double actual, double delta)
instead
org.hamcrest.junit.MatcherAssert.assertThat()
org.hamcrest.junit.MatcherAssert.assertThat()
runnable
throws an exception of type expectedThrowable
when
executed.
runnable
throws an exception of type expectedThrowable
when
executed.
StringDescription.toString(SelfDescribing)
.
Assume.assumeTrue(boolean)
.
Assume.assumeTrue(String, boolean)
.
e
is
not null
.
null
array or one or more null
elements in objects
,
the test will halt and be ignored.
org.hamcrest.junit.MatcherAssume.assumeThat()
org.hamcrest.junit.MatcherAssume.assumeThat()
false
, the test will halt and be ignored.
false
, the test will halt and be ignored.
Description
that is stored as a string.testClass
testClass
.
BlockJUnit4ClassRunner
with parameters support.ParametersRunnerFactory
that creates
BlockJUnit4ClassRunnerWithParameters
.CoreMatchers.both(Matcher)
instead.
TemporaryFolder
instance using the values in this builder.
Timeout
instance using the values in this builder.,
TemporaryFolder
.
Category
annotation.callable
.
org.hamcrest.junit.ErrorCollector.checkThat()
org.hamcrest.junit.ErrorCollector.checkThat()
runnable
does not throw an
exception of type expectedThrowable
when executed.
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.
ValidateWith
.
Statement
that will run the given
statement
, and timeout the operation based
on the values configured in this rule.
Filter
which is only passed by tests that are
not categorized with any of the specified categories.
Filter
which is only passed by tests that are
categorized with any of the specified categories.
Filter
given a FilterFactoryParams
argument.
TestWithParameters
.
Description
named name
.
Description
named name
.
Description
named after testClass
Description
named after testClass
method
against.
ParentRunner.ParentRunner(org.junit.runners.model.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
.
Theories
runner.Theories
runner.Ordering
from the given factory class.
Ordering
from the given factory.
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.DisableOnDebug
Rule allows you to label certain rules to be
disabled when debugging.DisableOnDebug
instance with the timeout specified in
milliseconds.
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.
Request
that, when processed, will report an error for the given
test class with the given cause.
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.
FilterFactory
to exclude categories.org.hamcrest.junit.ExpectedException.expect()
type
.
org.hamcrest.junit.ExpectedException.expectCause()
Assert.assertThrows
can be used to verify that your code throws a specific
exception.org.hamcrest.junit.ExpectedException.expectMessage()
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
.Filter
cannot be created.filter
is applied
Description
matches the given description.
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
@Theory
method with @FromDataPoints
will limit the
datapoints considered as potential values for that parameter to just the
DataPoints
with the given
name.target
annotationClass
.
annotationClass
.
annotationType
on this method, if
one exists.
Description
.
Failure
s describing tests that failed and the problems they encountered
Timeout
will look for a stuck thread
when the test times out.
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
FilterFactory
to include categories.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
Runner
s in case the class under test is not valid.target
with
parameters params
.
is(equalTo(x))
.
is(equalTo(x))
.
is(instanceOf(SomeClass.class))
.
is(instanceOf(SomeClass.class))
.
true
.true
if the JVM is in debug mode.
Object.equals(java.lang.Object)
invokedMethod?true
if the error is considered a failure
(i.e.
FrameworkMethod
s are ignored based on the
Ignore
annotation.
JUnitCore
is a facade for running tests.org.hamcrest.junit.JUnitMatchers
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
Timeout
that will timeout a test after the
given duration, in milliseconds.
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
.
orderer
orderer
Orderable.order(Orderer)
.
Ordering
instances.@OrderWith
or extends a class annotated
with @OrderWith
, JUnit will order the tests in the test class (and child
test classes, if any) using the ordering defined by the Ordering
class.ordering
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.public static void
methods which should be executed after
evaluating tests with particular parameters.public static void
methods which should be executed before
evaluating tests with particular parameters.Parameters
.Parameterized
.ParametersRunnerFactory
creates a runner for a single
TestWithParameters
.Theory
method
parameter with @ParametersSuppliedBy causes it to be supplied with
values from the named
ParameterSupplier
when run as a theory by the Theories
runner.T
.ParentRunner
that will run @TestClass
ParentRunner
that will run the TestClass
.
Statement
: if method
's @Test
annotation
has the Test.expected()
attribute, return normally only if next
throws an exception of the correct type, and throw an exception
otherwise.
failures
TestClass
is public.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.
RunNotifier
to be notified
of events that occur during a test run.RunListener
that can have its methods called
concurrently.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.Timeout
that will timeout a test after the
given duration, in seconds.
Ordering
that shuffles the items using the given
Random
instance.
TestWatcher.skipped(AssumptionViolatedException, Description)
sorter
Sorter
orders tests.Sorter
that uses comparator
to sort tests
comparator
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.TemporaryFolder
initialized with
values from a builder.
TemporaryFolder
.Test
annotation tells JUnit that the public void
method
to which it is attached can be run as a test case.TestClass
wrapping clazz
.
Theory
method int
parameter with @TestedOn causes it to be supplied with values from the
ints array given when run as a theory by the
Theories
runner.TestFailure
collects a failed test together with
the caught exception.Ignore
.
method
for Description
s.
TestResult
collects the results of executing
a test case.type
request
TestSuite
is a Composite
of Tests.TestWatcher
(which implements TestRule
) instead.TestWithParameters
keeps the data together that are needed for
creating a runner for a single data set of a parameterized test.Theories
runner.Assert.assertThrows(Class, ThrowingRunnable)
from Java 8.Timeout
instance with the timeout specified
at the timeUnit of granularity of the provided TimeUnit
.
Timeout
instance initialized with values from
a builder.
Timeout
.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
a throwable for each problem detected.
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
).
ValidateWith
.
TestClass
is public.
errors
for each method annotated with @Test
that
is not a public, void instance method with no arguments.
AnnotationValidator
to be attached to an annotation.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 after 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 @After
methods on this class and superclasses before running next
; all
After methods are always executed: exceptions thrown by previous steps
are combined, if necessary, with exceptions from After 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.
Statement
: run all non-overridden @Before
methods on this class and superclasses before running next
; if
any throws an Exception, stop execution and pass the exception on.
|
||||||||||
PREV NEXT | FRAMES NO FRAMES |