Issue
I'm trying to test for exceptions using AndroidTestCase. I'm trying to use the annotation:
@Test(expected=UnsupportedOperationException.class)
But the compiler doesn't like that. I thought that this was possible since AndroidTestCase extends JUnit. Am I missing something? Or do i have to resort to the older try catch idiom to test for exceptions?
Edit:
When I say "the compiler doesn't like that" I mean that android studio cannot resolve the symbol Test or expected.
Solution
Turns out I did not add JUnit to the classpath, after adding it compiles as expected(expected). Not sure why I need to add it though. I thought it was part of AndroidTestCase
Answered By - cmejia
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.