expected-failure

see: http://www.ensor.cc/2012/09/allowing-junit-tests-to-pass-test-case.html

License

License

Categories

Categories

JUnit Unit Testing CLI User Interface
GroupId

GroupId

com.clickconcepts.junit
ArtifactId

ArtifactId

expected-failure
Last Version

Last Version

0.0.9
Release Date

Release Date

Type

Type

jar
Description

Description

expected-failure
see: http://www.ensor.cc/2012/09/allowing-junit-tests-to-pass-test-case.html
Project URL

Project URL

http://www.ensor.cc/2012/09/allowing-junit-tests-to-pass-test-case.html
Project Organization

Project Organization

Click Concepts
Source Code Management

Source Code Management

http://github.com/mike-ensor/expected-failure/

Download expected-failure

How to add to project

<!-- https://jarcasting.com/artifacts/com.clickconcepts.junit/expected-failure/ -->
<dependency>
    <groupId>com.clickconcepts.junit</groupId>
    <artifactId>expected-failure</artifactId>
    <version>0.0.9</version>
</dependency>
// https://jarcasting.com/artifacts/com.clickconcepts.junit/expected-failure/
implementation 'com.clickconcepts.junit:expected-failure:0.0.9'
// https://jarcasting.com/artifacts/com.clickconcepts.junit/expected-failure/
implementation ("com.clickconcepts.junit:expected-failure:0.0.9")
'com.clickconcepts.junit:expected-failure:jar:0.0.9'
<dependency org="com.clickconcepts.junit" name="expected-failure" rev="0.0.9">
  <artifact name="expected-failure" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.clickconcepts.junit', module='expected-failure', version='0.0.9')
)
libraryDependencies += "com.clickconcepts.junit" % "expected-failure" % "0.0.9"
[com.clickconcepts.junit/expected-failure "0.0.9"]

Dependencies

compile (2)

Group / Artifact Type Version
com.google.guava : guava jar 13.0.1
junit : junit-dep jar 4.10

test (1)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.9.0

Project Modules

There are no modules declared in this project.

Project documentation: http://mike-ensor.github.com/expected-failure/

This project creates a @Rule object to govern test cases and then provides the ability to annotate a test case with @ExpectedFailure allowing a test case that would fail to succeed.

In this example, the test case would normally fail given that the "exception" would fail based on the assertion in the exception assertion object

public class ExceptionAssertTest {

    @Rule
    public ExpectedException exception = ExpectedException.none();

    @Rule
    public ExpectedTestFailureWatcher expectedTestFailureWatcher = ExpectedTestFailureWatcher.instance();

    @Test
    @ExpectedFailure("The matcher should fail becasue exception is not a SimpleException")
    public void assertSimpleExceptionAssert_exceptionIsOfType() {
        // expected exception will be of type "SimpleException"
        exception.instanceOf(SimpleException.class);
        // throw something other than SimpleException...expect failure
        throw new RuntimeException("this is an exception");
    }
}

Versions

Version
0.0.9