jeudi 3 mai 2018

Testing with completion listener in android

I'm creating tests for a project and I'm running into a problem. For one of them I need to wait until a listener is called to get the result and complete the test but I think the test is ending before it. Here is the method:

protected void method() {

    someClass.get(handler() {
        @Override
        public void onSuccess(int result) {
            //Need to see the result here
        }

        @Override
        public void onError(IOException e) {
        }
    });
}

I'm using Mockito and also PowerMock to create the tests, but I didn't see how to manage this situation.

Aucun commentaire:

Enregistrer un commentaire