title: Testing Activity Using Mockito Framework
body: <p>Below is the Simple Calculator Application and I want to test it using Junit4 and mockito Framework i test that application on Junit4 and it works properly but I am facing problem on mockito implementation</p>
  
  <p><strong>CalculatorOperationsInterfaces.java</strong></p>
  
  <pre><code>public interface CalculatorOperationsInterfaces {
      public double add(double input1, double input2);
      public double subtract(double input1, double input2);
      public double multiply(double input1, double input2);
      public double divide(double input1, double input2);
  }
  </code></pre>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  
  public class MainActivity extends AppCompatActivity implements CalculatorOperationsInterfaces {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  
      @Override
      public double add(double input1, double input2) {
          return (input1 + input2);
      }
  
      @Override
      public double subtract(double input1, double input2) {
          return (input1 - input2);
      }
  
      @Override
      public double multiply(double input1, double input2) {
          return (input1 * input2);
      }
  
      @Override
      public double divide(double input1, double input2) {
          if(input2==0)
              return -1;
          else
              return (input1 / input2);
      }
  }
  </code></pre>
  
  <p><strong>CalculatorOperationsMockTest.java</strong></p>
  
  <pre><code>import org.junit.After;
  import org.junit.Assert;
  import org.junit.Before;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.mockito.Mock;
  import org.mockito.runners.MockitoJUnitRunner;
  
  import static org.mockito.Mockito.when;
  
  // @RunWith attaches a runner with the test class to initialize the test data
  @RunWith(MockitoJUnitRunner.class)
  public class CalculatorOperationsMockTest {
  
      //@Mock annotation is used to create the mock object to be injected
      @Mock
      CalculatorOperationsInterfaces calcService;
  
      @Before
      public void setUp() {
          calcService = new MainActivity();
      }
  
      @After
      public void tearDown() {
          calcService = null;
      }
  
  
      @Test
      public void add(){
          //add the behavior of calc service to add two numbers
          when(calcService.add(10.0,20.0)).thenReturn(30.00);
          //test the add functionality
          Assert.assertEquals(calcService.add(10.0, 20.0),30.0,0);
      }
  
  }
  </code></pre>
  
  <p>I successfully test the Above <code>MainActivity.java</code> using <code>Junit</code> but I am new to Mockito framework when i try to run the <code>CalculatorOperationsMockTest.java</code> File i am getting the below error and i do not know how to solve it</p>
  
  <pre><code>Class not found: "myappmania.local_jvm_unit_test.CalculatorOperationsMockTest"Empty test suite.
  </code></pre>