cur4so cur4so - 1 year ago 84
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?

Answer Source

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");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download