Last active
December 28, 2015 10:58
-
-
Save mariuszs/7489706 to your computer and use it in GitHub Desktop.
BDD Style expect exception for JUnit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.Test; | |
import static com.googlecode.catchexception.CatchException.caughtException; | |
import static com.googlecode.catchexception.apis.CatchExceptionBdd.then; | |
import static com.googlecode.catchexception.apis.CatchExceptionBdd.when; | |
public class SomeServiceTest { | |
@Test | |
public void testDoThat() { | |
when(new SomeService()).doThat(); | |
then(caughtException()).isExactlyInstanceOf(GenericException.class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment