score:1

Accepted answer

you are getting the error like assertequals method is undefined for mockito because we can't use mockito as in mockito.assertequals as in your codes try changing it with junit.assertequals()

and what my experience on mockito says that you should avoid mock classes of the same project,we use to mock classes for which we are dependent on other projects or module,so don't mock no_1 class in your codes and try these codes::

import static org.junit.assert.*;

import org.junit.test;
import org.mockito.mockito;

public class no_1test {

   @test
   public void testno_1() {

      mockito.when(mytest.helloworld()).thenreturn("hello world");
      junit.assertequals("hello world", mytest.helloworld());

   }
}

and mockito is for mocking java classes or method results but try using junit for your testing as in junit.assertequals


Related Query

More Query from same tag