vendredi 2 septembre 2016

Marking outer class as test case

I have a class with a nested class, which contains test case. It looks like this:

public class ProviderUtilsTest {
        public static final String TAG = ProviderUtilsTest.class.getSimpleName();

        public static class TestConstructor {

            @Test
            public void noPublicConstructor() {
                Class<ProviderUtils> clazz = ProviderUtils.class;
                Constructor<?>[] constructors = clazz.getConstructors();
                for (Constructor<?> constructor : constructors) {
                    assertThat(constructor.isAccessible(), is(false));
                }
            }
        }
    }

When I use this configuration Android Studio doesn't treat ProviderUtilsTest as a test case. I.e. it doesn't allow to run it when I click on its file with RMB and it doesn't display run button on the left of the class declaration line. But it displays it for nested class.

How can I make it treat the ProviderUtilsTest as a test case i.e. display an appropriate UI alements and force it to run all tests of the nested classes?

Aucun commentaire:

Enregistrer un commentaire