Reputation: 473
I am trying to write unit tests for my project in Maven
using Eclipse
IDE on Windows.
I have imported jUnit4
on build Path using Eclipse
plugin.
(junit.jar under /path/to/eclipse/plugins/org.junit4.12.0.v201504281640).
I am able to import these. (weirdly)
import org.junit.Test;
import org.junit.runner.RunWith;
But I have problem importing these
import static org.junit.Assert.assertEquals;
import org.junit.Before;
Do I have to add another JUnit
library or is there some other problem?
Note: There are no JUnit
dependencies in Maven
. I am importing JUnit
jar directly in build path.
EDIT: I forgot to mention but I did use static for junit.Assert
.
Upvotes: 0
Views: 915
Reputation: 525
assertEquals isn't a class but a methods so you have to option :
import org.junit.Assert;
and calls Assert.assertEquals
or use :
import static org.junit.Assert.assertEquals;
and call : assertEquals
Upvotes: 1