Created
May 5, 2014 14:02
-
-
Save tassioauad/a89c4463424f6486249d to your computer and use it in GitHub Desktop.
Android JUnit4 Test Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.zaal.quiosque.test; | |
import android.test.ActivityInstrumentationTestCase2; | |
import com.zaal.quiosque.presenter.impl.AccessPresenter; | |
import com.zaal.quiosque.view.AccessViewInterface; | |
import com.zaal.quiosque.view.activity.AccessView; | |
public class AccessPresenterTest extends ActivityInstrumentationTestCase2<AccessView>{ | |
private AccessPresenter mPresenter; | |
public AccessPresenterTest() { | |
super(AccessView.class); | |
} | |
@Override | |
protected void setUp() throws Exception { | |
super.setUp(); | |
mPresenter = new AccessPresenter(getInstrumentation().getTargetContext(), getActivity()); | |
} | |
public void testAccessFailed() { | |
mPresenter.access(-1); | |
if(mPresenter.thereIsLoggedFuncionario()) { | |
fail("Acesso deveria ter falhado!"); | |
} | |
} | |
public void testAccessSuccessful() { | |
mPresenter.access(1); | |
if(!mPresenter.thereIsLoggedFuncionario()) { | |
fail("Acesso deveria ter sido aceito!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment