Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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,407 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.*;