Skip to content
Mariusz Smykuła edited this page Oct 1, 2015 · 5 revisions

Prerequisites

catch-exception requires JDK 1.6 due to a compiler issue of JDK 1.5.

Download

catch-exception can be downloaded from Maven Central.

The Maven coordinates are

<dependency>
    <groupId>eu.codearte.catch-exception</groupId>
    <artifactId>catch-exception</artifactId>
    <version>1.4.4</version>
    <scope>test</scope> <!-- test scope to use it only in tests -->
</dependency>

If you want to catch throwables, use

<dependency>
    <groupId>eu.codearte.catch-exception</groupId>
    <artifactId>catch-throwable</artifactId>
    <version>1.4.4</version>
    <scope>test</scope> <!-- test scope to use it only in tests -->
</dependency>

Dependencies

Users who do not use Maven or another dependeny management tool have to manually download the libraries catch-exception depends on, namely Mockito and, optionally, Powermock.

PowerMock

catch-exception optionally uses Powermock in order to catch exceptions thrown by final classes.

The maven coordinates of that dependency are

<dependency>
  <groupId>org.powermock</groupId>
  <artifactId>powermock-module-junit4</artifactId>
  <version>1.6.1</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.powermock</groupId>
  <artifactId>powermock-api-mockito</artifactId>
  <version>1.6.1</version>
  <scope>test</scope>
</dependency>
Clone this wiki locally