user6456773 user6456773 - 1 year ago 78
Android Question

How to run a particular .java class from Android project (Android Studio 2.2)?

I'm trying to find the "run the class" option in Android Studio 2.2. How can I run just a particular class (for test purposes) withour launching the whole application?

Answer Source

You can add a main method to the class to run it.

public static void main(String[] args) {
    // this code will be run

In there you can instantiate an instance of your class.

The typical and robust way to assert behaviour would be to write unit tests instead.