# Lesson 15 - Activity 1 - Can you create a test that checks for an exception?

**URL:** <https://club.ministryoftesting.com/t/lesson-15-activity-1-can-you-create-a-test-that-checks-for-an-exception/31727>\
**Category:** Discussions\
**Tags:** java-intro\
**Created:** [28 November 2019 18:11 UTC](https://club.ministryoftesting.com/t/lesson-15-activity-1-can-you-create-a-test-that-checks-for-an-exception/31727 "2019-11-28T18:11:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike\_talks](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/mike_talks/32/11115_2.png) [@mike\_talks](https://club.ministryoftesting.com/u/mike_talks)\
**Post date:** [28 November 2019 18:11 UTC](https://club.ministryoftesting.com/t/lesson-15-activity-1-can-you-create-a-test-that-checks-for-an-exception/31727/1 "2019-11-28T18:11:37Z")

</div>

**Time:** 15 minutes

**Purpose:** This activity helps you get familiar with thrown exceptions

**Introduction:** You’re had experience using a assertions, now create one for checking for thrown exceptions

**Task:** public static int parseInt(String s) throws NumberFormatException if it can’t convert to int

Create,

1. A JUnit test where a string is successfully converted int
2. A JUnit tests which checks for an exception is thrown
