I have this class, but eclipse does not recognize it as a test class, so I can not run it as a Junit test, I am using TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use,
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class ApplicationServiceImplTest {
@Mock
ApplicationDao dao;
@InjectMocks
ApplicationMutatorServiceImpl applicationMutatorServiceImpl;
@BeforeClass
public void setUp(){
MockitoAnnotations.initMocks(this);
}
@Test
public void testSave() throws Exception {
Application application = new Application();
applicationMutatorServiceImpl.save(application);
System.out.println (application);
}
}
in my pom.xml
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>
Check if you have TestNG plugin installed. http://singinginthesunlight.blogspot.in/2016/02/testng-for-dummies.html
Otherwise you can run it through Maven