Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Hi, do I need to import anything from the junit libraries for ExpectedExceptions? I have an unresolved symbol.

I'm trying to follow along with the video and do the same steps, but I don't know how to handle ExpectedExceptions and I can't see what he's imported.

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

IntelliJ always adds the appropriate import statement when you use auto-complete, or after the fact with QuickFix. This doesn't happen if you only type everything out yourself, and when you use an IDE you form a habit of leaning on these speed-ups because they are really convenient. Sometimes it's better to let the IDE help you out.

Here's my full imports for both AlphaNumbericChooserTest.java and BinTest.java (both are identical):

package com.teamtreehouse.vending;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import static org.junit.Assert.*;