cur4so cur4so - 7 months ago 29
Java Question

how to refer to a method, defined in a package being tested from a test

For example a package being tested has a method:

package package.being.tested
public class MainActivity extends AppCompatActivity {
public Int myMehod(String s){
<do something>

How to call this method in tests?


Exactly as you would call this method in a non-test class.

public void myMethodTest() {
    MainActivity mainActivity = new MainActivity();
    Integer i = mainActivity.myMethod("A string");