Adam Lee
Adam Lee

Reputation: 25778

How to resolve the following import?

Just add some Junit4 test cases,

import static org.junit.Assert.*;

but it prompts some errors until I changed to @org.junit.Test from @Test

What should I do if I would like to just use @Test?

Upvotes: 0

Views: 44

Answers (4)

manishgdev
manishgdev

Reputation: 147

If there is @Test annotations defined in the code from testng i.e. org.testng.annotations.Test package then the for defining @Test annotation of junit you will have to write @org.junit.Test unless you delete the import statement of the testng package org.testng.annotations.Test

Upvotes: 0

david a.
david a.

Reputation: 5291

@Test is an annotation class, and you need to import it as such. Including the package, it's name is org.junit.Test

Thus, you need to add this to your imports:

import org.junit.Test;

Upvotes: 0

Roland
Roland

Reputation: 23352

Test is not part of org.junit.Assert. It is rather part of org.junit.

So it should suffice to do:

import org.junit.Test;

Upvotes: 0

Robby Cornelissen
Robby Cornelissen

Reputation: 97331

You need to also

import org.junit.Test;

Upvotes: 2

Related Questions